2024-09-03 16:29:44 +03:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @var $json string
|
|
|
|
*/
|
|
|
|
|
|
|
|
use kernel\models\Option;
|
2024-11-19 14:55:25 +03:00
|
|
|
use kernel\widgets\ActionButtonWidget;
|
2024-09-03 16:29:44 +03:00
|
|
|
|
|
|
|
|
|
|
|
$table = new \Itguild\Tables\ListJsonTable($json);
|
|
|
|
$table->columns([
|
|
|
|
'preview' => function ($data) {
|
|
|
|
return "<img src='$data' width='200px'>";
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
$table->addAction(function ($row, $url){
|
|
|
|
$path = $row['path'];
|
2024-09-24 17:22:09 +03:00
|
|
|
$active_admin_theme = \kernel\modules\option\service\OptionService::getItem('active_admin_theme');
|
2024-11-19 14:55:25 +03:00
|
|
|
$btn = ActionButtonWidget::create([
|
|
|
|
'btn_type' => "primary",
|
|
|
|
'label' => "Активировать",
|
|
|
|
'url' => "$url/activate/?p=$path",
|
|
|
|
])->run();
|
|
|
|
|
2024-09-24 17:22:09 +03:00
|
|
|
if ($path === $active_admin_theme){
|
2024-09-03 16:29:44 +03:00
|
|
|
$btn = "Активна";
|
|
|
|
}
|
|
|
|
|
|
|
|
return $btn;
|
|
|
|
});
|
|
|
|
$table->create();
|
|
|
|
$table->render();
|