2014-07-30 17:18:59 +10:00
|
|
|
<?php namespace System\Controllers;
|
|
|
|
|
|
|
|
use Str;
|
|
|
|
use Lang;
|
|
|
|
use File;
|
|
|
|
use Flash;
|
|
|
|
use Backend;
|
|
|
|
use Redirect;
|
|
|
|
use BackendMenu;
|
|
|
|
use Backend\Classes\Controller;
|
2015-01-28 18:03:35 +11:00
|
|
|
use ApplicationException;
|
2014-07-30 17:18:59 +10:00
|
|
|
use System\Classes\SettingsManager;
|
2014-07-30 17:44:50 +10:00
|
|
|
use System\Models\EventLog;
|
2014-07-30 17:18:59 +10:00
|
|
|
use Exception;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Event Logs controller
|
|
|
|
*
|
|
|
|
* @package october\system
|
|
|
|
* @author Alexey Bobkov, Samuel Georges
|
|
|
|
*/
|
|
|
|
class EventLogs extends Controller
|
|
|
|
{
|
|
|
|
public $implement = [
|
|
|
|
'Backend.Behaviors.FormController',
|
|
|
|
'Backend.Behaviors.ListController'
|
|
|
|
];
|
|
|
|
|
|
|
|
public $requiredPermissions = ['system.access_event_logs'];
|
|
|
|
|
|
|
|
public $formConfig = 'config_form.yaml';
|
|
|
|
|
|
|
|
public $listConfig = 'config_list.yaml';
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
BackendMenu::setContext('October.System', 'system', 'settings');
|
|
|
|
SettingsManager::setContext('October.System', 'event_logs');
|
|
|
|
}
|
|
|
|
|
2014-07-30 17:44:50 +10:00
|
|
|
public function onEmptyLog()
|
|
|
|
{
|
|
|
|
EventLog::truncate();
|
|
|
|
Flash::success(Lang::get('system::lang.event_log.empty_success'));
|
|
|
|
return $this->listRefresh();
|
|
|
|
}
|
2015-02-21 13:49:32 +11:00
|
|
|
|
|
|
|
public function index_onDelete()
|
|
|
|
{
|
|
|
|
if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
|
|
|
|
|
|
|
|
foreach ($checkedIds as $recordId) {
|
|
|
|
if (!$record = EventLog::find($recordId)) continue;
|
|
|
|
$record->delete();
|
|
|
|
}
|
|
|
|
|
|
|
|
Flash::success(Lang::get('backend::lang.list.delete_selected_success'));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->listRefresh();
|
|
|
|
}
|
2014-10-18 11:58:50 +02:00
|
|
|
}
|