32 lines
		
	
	
		
			753 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			753 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
/**
 | 
						|
 * @var $json string
 | 
						|
 */
 | 
						|
 | 
						|
use kernel\models\Option;
 | 
						|
use kernel\widgets\ActionButtonWidget;
 | 
						|
 | 
						|
 | 
						|
$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'];
 | 
						|
    $active_admin_theme = \kernel\modules\option\service\OptionService::getItem('active_admin_theme');
 | 
						|
    $btn = ActionButtonWidget::create([
 | 
						|
        'btn_type' => "primary",
 | 
						|
        'label' => "Активировать",
 | 
						|
        'url' => "$url/activate/?p=$path",
 | 
						|
    ])->run();
 | 
						|
 | 
						|
    if ($path === $active_admin_theme){
 | 
						|
        $btn = "Активна";
 | 
						|
    }
 | 
						|
 | 
						|
    return $btn;
 | 
						|
});
 | 
						|
$table->create();
 | 
						|
$table->render(); |