mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
63 lines
1.5 KiB
PHP
63 lines
1.5 KiB
PHP
|
<?php namespace Cms\ReportWidgets;
|
||
|
|
||
|
use Cms\Classes\Theme;
|
||
|
use Cms\Models\MaintenanceSetting;
|
||
|
use Backend\Classes\ReportWidgetBase;
|
||
|
use Exception;
|
||
|
|
||
|
/**
|
||
|
* Active theme report widget.
|
||
|
*
|
||
|
* @package october\backend
|
||
|
* @author Alexey Bobkov, Samuel Georges
|
||
|
*/
|
||
|
class ActiveTheme extends ReportWidgetBase
|
||
|
{
|
||
|
/**
|
||
|
* @var string A unique alias to identify this widget.
|
||
|
*/
|
||
|
protected $defaultAlias = 'activetheme';
|
||
|
|
||
|
/**
|
||
|
* Renders the widget.
|
||
|
*/
|
||
|
public function render()
|
||
|
{
|
||
|
try {
|
||
|
$this->loadData();
|
||
|
}
|
||
|
catch (Exception $ex) {
|
||
|
$this->vars['error'] = $ex->getMessage();
|
||
|
}
|
||
|
|
||
|
return $this->makePartial('widget');
|
||
|
}
|
||
|
|
||
|
public function defineProperties()
|
||
|
{
|
||
|
return [
|
||
|
'title' => [
|
||
|
'title' => 'backend::lang.dashboard.widget_title_label',
|
||
|
'default' => 'cms::lang.dashboard.active_theme.widget_title_default',
|
||
|
'type' => 'string',
|
||
|
'validationPattern' => '^.+$',
|
||
|
'validationMessage' => 'backend::lang.dashboard.widget_title_error',
|
||
|
]
|
||
|
];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* {@inheritDoc}
|
||
|
*/
|
||
|
protected function loadAssets()
|
||
|
{
|
||
|
$this->addCss('css/activetheme.css', 'core');
|
||
|
}
|
||
|
|
||
|
protected function loadData()
|
||
|
{
|
||
|
$this->vars['theme'] = Theme::getActiveTheme();
|
||
|
$this->vars['inMaintenance'] = MaintenanceSetting::get('is_enabled');
|
||
|
}
|
||
|
}
|