Booking, QI Content, Trees, Media

This commit is contained in:
Kevin Adametz 2019-10-02 20:03:55 +02:00
parent 1f340e96fa
commit 7fbac395a9
260 changed files with 27160 additions and 3773 deletions

View file

@ -68,8 +68,8 @@ class HTMLHelper
return self::$days[intval($i)];
}
public static function getRoleLabel($role_id = 0){
return '<span class="badge badge-pill '.self::getLable($role_id).'">'.self::$roles[$role_id].'</span>';
public static function getRoleLabel($role_id = 0, $pre = "", $post = ""){
return '<span class="badge badge-pill '.self::getLable($role_id).'">'.$pre.self::$roles[$role_id].$post.'</span>';
}
public static function getLable($id){

View file

@ -41,16 +41,16 @@ class HTMLTreeHelper
</div>
<div class="dd-content">
<a href="' . route('iq_content_tree_detail', [$iq_content_tree->id, $node->id]) . '">
<div class="dd-content-link">
' . ($tree_node_id == $node->id ? '<strong> <i class="fa fa-chevron-right"></i> ' : '') . $node->name . ($tree_node_id == $node->id ? '</strong>' : '') . '
' . ($tree_node_id == $node->id ? '<strong> <i class="fa fa-chevron-right"></i> ' : '').$node->name.($tree_node_id == $node->id ? '</strong>' : '') . '
</div>
<div class="float-right">
' . ($node->site_id ? '<span class="far fa-check fa-xs text-light"></span>' : '') . '
<span class="far fa-edit"></span>
' . ($node->active ? '<i class="fa fa-eye text-success"></i>' : '<i class="fa fa-eye-slash text-danger"></i>') . '
</div>
</a>
<div class="float-right">
' . ($node->iq_content_sites->count() ? '<span class="text-light">('.$node->iq_content_sites->count().')</span>' : '') . '
<a href="#" class="iq_update_data_load" data-action="node-set-active" data-target="self" data-url="'.route('iq_content_tree_detail', [$iq_content_tree->id, $node->id]).'">' . ($node->active ? '
<i class="fa fa-eye text-success"></i>' : '<i class="fa fa-eye-slash text-danger"></i>') . '
</a>
</div>
</div>';
if ($children) {

View file

@ -67,4 +67,51 @@ class Util
}
return $search;
}
public static function cleanHTML($html)
{
$html = str_replace('font-size: 14px;', ' ', $html);
$html = str_replace('font-weight: lighter; ', ' ', $html);
$html = str_replace('font-family: Helvetica, Arial, sans-serif; ', ' ', $html);
$html = str_replace('font-family: Verdana, sans-serif; ', ' ', $html);
$html = str_replace('color: rgb(60, 60, 60); ', ' ', $html);
$html = str_replace(' style=" padding: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 20px !important; line-height: 20px !important;"', ' ', $html);
$html = str_replace('property="article"', ' ', $html);
$html = str_replace('&nbsp;', ' ', $html);
$html = str_replace('https://www.aegypten-online.de', 'https://www.sterntours.de', $html);
$dom = new \DOMDocument('1.0', 'utf-8');
@$dom->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
$removeFullTags = ['span', 'a'];
foreach ($removeFullTags as $removeFullTag){
$domElemsToRemove = [];
$elements = $dom->getElementsByTagName($removeFullTag);
foreach ($elements as $element) {
$domElemsToRemove[] = $element;
}
foreach ($domElemsToRemove as $domElem) {
if($removeFullTag == 'span' && strpos($domElem->getAttribute('style'), 'font-weight: 700') !== false){
$new_node = $dom->createTextNode("<strong>".$domElem->nodeValue."</strong>");
}else{
$new_node = $dom->createTextNode($domElem->nodeValue);
}
$domElem->parentNode->replaceChild($new_node, $domElem);
}
}
$removeStyleTags = ['ul', 'li', 'h1', 'h2', 'br'];
foreach ($removeStyleTags as $removeStyleTag){
$elements = $dom->getElementsByTagName($removeStyleTag);
foreach ($elements as $element) {
$element->removeAttribute('style');
}
}
$html = $dom->saveHTML();
return $html;
}
}