2014-05-14 23:24:20 +10:00
|
|
|
<?php namespace System\ReportWidgets;
|
|
|
|
|
|
|
|
use System\Models\Parameters;
|
|
|
|
use System\Classes\UpdateManager;
|
2014-11-10 20:34:42 +11:00
|
|
|
use Cms\Models\MaintenanceSettings;
|
2014-05-14 23:24:20 +10:00
|
|
|
use Backend\Classes\ReportWidgetBase;
|
|
|
|
use Exception;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* System status report widget.
|
|
|
|
*
|
|
|
|
* @package october\system
|
|
|
|
* @author Alexey Bobkov, Samuel Georges
|
|
|
|
*/
|
|
|
|
class Status extends ReportWidgetBase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Renders the widget.
|
|
|
|
*/
|
|
|
|
public function render()
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
$this->loadData();
|
2014-11-01 12:00:45 +11:00
|
|
|
}
|
|
|
|
catch (Exception $ex) {
|
2014-05-14 23:24:20 +10:00
|
|
|
$this->vars['error'] = $ex->getMessage();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->makePartial('widget');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function defineProperties()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'title' => [
|
2014-08-09 12:21:17 +10:00
|
|
|
'title' => 'backend::lang.dashboard.widget_title_label',
|
|
|
|
'default' => 'backend::lang.dashboard.status.widget_title_default',
|
2014-05-14 23:24:20 +10:00
|
|
|
'type' => 'string',
|
|
|
|
'validationPattern' => '^.+$',
|
2014-08-09 12:21:17 +10:00
|
|
|
'validationMessage' => 'backend::lang.dashboard.widget_title_error',
|
2014-05-14 23:24:20 +10:00
|
|
|
]
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function loadData()
|
|
|
|
{
|
|
|
|
$manager = UpdateManager::instance();
|
2014-11-10 20:34:42 +11:00
|
|
|
$this->vars['inMaintenance'] = MaintenanceSettings::get('is_enabled');
|
2014-11-09 14:04:53 +11:00
|
|
|
$this->vars['showUpdates'] = $this->controller->user->hasAccess('system.manage_updates');
|
2014-05-14 23:24:20 +10:00
|
|
|
$this->vars['updates'] = $manager->check();
|
|
|
|
}
|
2014-10-18 11:58:50 +02:00
|
|
|
}
|