display.table_panel.php
Исходный код
<?php
if (!$panel) return;
ob_start();
foreach ($panel as $a) if (is_array($a)) {
if (isset($a['can'])) {
$continue = true;
foreach ((is_array($a['can']) ? $a['can'] : explode('|', $a['can'])) as $can) if ($Page->can($can)) {
$continue = false;
break;
}
if ($continue) continue;
}
switch ($image = $a['image']) {
case 'add': $image = 'plus'; break;
case 'html': $image = 'file-alt'; break;
case 'edit': $image = 'pen'; break;
case 'menu': $image = 'bars'; break;
case 'move': $image = 'arrows-alt'; break;
case 'sort': $image = 'sort'; break;
case 'seo': $image = 'search'; break;
case 'delete': $image = 'times'; break;
case 'todo': $image = 'cog'; break;
}
$add = '';
if (false) {}
elseif (strpos($a['href'], '?') === false) $add = '';
elseif (strpos($a['href'], '.pdf') !== false) $add = ' target="_blank"';
elseif (!isset($a['modal']) || $a['modal']) $add = ' data-panel="modal-form"';
$color = 'primary';
switch ($image) {
case 'plus': $color = 'success'; break;
case 'times': $color = 'danger'; break;
}
if ($a['color']) $color = $a['color'];
print '<a href="' . $a['href'] . '" class="uk-button uk-button-small uk-button-' . $color . '"' . $add . ' title="' . $a['title'] . '" uk-tooltip><i class="las la-' . $image . '"></i></a>';
}
$html = ob_get_clean();
if (!strlen($html)) return;
?>
<div class="uk-button-group btn-group-sm">
<?=$html?>
</div>