diff --git a/application/controllers/Cron.php b/application/controllers/Cron.php index a47052bb7..74fa3b77d 100644 --- a/application/controllers/Cron.php +++ b/application/controllers/Cron.php @@ -1,20 +1,24 @@ load->model('user_model'); - if (!$this->user_model->authorize(2)) { - $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); - redirect('dashboard'); + if (ENVIRONMENT == 'maintenance' && $this->session->userdata('user_id') == '') { + echo "Maintenance Mode is active. Try again later.\n"; + redirect('user/login'); } - - $this->load->library('Permissions'); } public function index() { + + $this->load->model('user_model'); + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + $this->load->helper('file'); $this->load->model('cron_model'); @@ -29,4 +33,8 @@ class Cron extends CI_Controller $this->load->view('cron/index'); $this->load->view('interface_assets/footer', $footerData); } + + public function run() { + echo "works\n"; + } } diff --git a/application/models/Cron_model.php b/application/models/Cron_model.php index bf6d3a114..165f9e861 100644 --- a/application/models/Cron_model.php +++ b/application/models/Cron_model.php @@ -11,4 +11,13 @@ class Cron_model extends CI_Model return $results; } + + function set_last_run($cron) { + $data = array( + 'last_run' => date('Y-m-d H:i:s') + ); + + $this->db->where('id', $cron); + $this->db->update('cron', $data); + } } diff --git a/application/views/cron/index.php b/application/views/cron/index.php index c2c4e8271..627767373 100644 --- a/application/views/cron/index.php +++ b/application/views/cron/index.php @@ -27,13 +27,8 @@ ID - Name - Function - Minute - Hour - Day (Month) - Month - Day (Week) + Description + Cron Expression Last Run Next Run @@ -43,15 +38,12 @@ - id; ?> - name; ?> - function; ?> - minute; ?> - hour; ?> - day_month; ?> - month; ?> - day_week; ?> - last_run; ?> + id; ?> + description; ?> + ' . + $cron->expression . + ''; ?> + last_run ?? 'never'; ?> @@ -66,11 +58,6 @@ - - - - - diff --git a/assets/js/sections/cron.js b/assets/js/sections/cron.js index 51a8d83b7..34a68ccb3 100644 --- a/assets/js/sections/cron.js +++ b/assets/js/sections/cron.js @@ -13,12 +13,13 @@ $('.crontable').DataTable({ "language": { url: getDataTablesLanguageUrl(), }, - responsive: false, - ordering: false, - "scrollY": "500px", + responsive: true, + ordering: true, + "scrollY": "600px", "scrollCollapse": true, "paging": false, "scrollX": true, + "autoWidth": false, "language": { url: getDataTablesLanguageUrl(), }