diff --git a/application/controllers/ajax.php b/application/controllers/ajax.php index fbbf14e..a1c99b8 100644 --- a/application/controllers/ajax.php +++ b/application/controllers/ajax.php @@ -1,18 +1,18 @@ - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is + * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -24,19 +24,16 @@ /** * Controller for Ajax requests. - * + * * @author Karsten Heiken */ -class Ajax extends CI_Controller { +class Ajax extends MY_Controller { /** * Constructor. */ public function __construct() { parent::__construct(); - - // load language file - $this->lang->load(strtolower($this->router->class)); } /** diff --git a/application/controllers/api.php b/application/controllers/api.php index 04dbd41..eccb96b 100644 --- a/application/controllers/api.php +++ b/application/controllers/api.php @@ -27,14 +27,14 @@ * * @author Karsten Heiken */ -class api extends CI_Controller { - +class Api extends CI_Controller { + /** * Update the state of a given job. - * + * * Because we do not want any access from servers we do not trust, * we need a special secret to authenticate the servers. - * + * * @param type $secret The secret to authenticate the server. * @param type $job_id The job id that is running on the server. * @param type $state The state of the job. diff --git a/application/controllers/auth.php b/application/controllers/auth.php index 27b3f00..651e6df 100755 --- a/application/controllers/auth.php +++ b/application/controllers/auth.php @@ -5,7 +5,7 @@ * * @author Eike Foken */ -class Auth extends CI_Controller { +class Auth extends MY_Controller { /** * Constructor. diff --git a/application/controllers/dashboard.php b/application/controllers/dashboard.php index 739ebc3..159a649 100644 --- a/application/controllers/dashboard.php +++ b/application/controllers/dashboard.php @@ -25,7 +25,7 @@ /** * @author Karsten Heiken */ -class Dashboard extends CI_Controller { +class Dashboard extends MY_Controller { /** * Constructor. @@ -35,9 +35,6 @@ class Dashboard extends CI_Controller { $this->load->model('job'); $this->load->model('project'); $this->load->model('user'); - - // load language file - $this->lang->load(strtolower($this->router->class)); } public function index() { diff --git a/application/controllers/jobs.php b/application/controllers/jobs.php index 50211c9..12cf44b 100644 --- a/application/controllers/jobs.php +++ b/application/controllers/jobs.php @@ -25,7 +25,7 @@ /** * @author Karsten Heiken */ -class Jobs extends CI_Controller { +class Jobs extends MY_Controller { /** * Constructor. @@ -33,9 +33,6 @@ class Jobs extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('job'); - - // load language file - $this->lang->load(strtolower($this->router->class)); } /** @@ -45,11 +42,11 @@ class Jobs extends CI_Controller { $query = $this->db->order_by('progress', 'desc') ->get_where('jobs', array('started_by' => $this->session->userdata('user_id'))); $jobs = $query->result_array(); - + for($i=0; $idb->select('name')->get_where('projects', array('id' => $jobs[$i]['project_id']))->row()->name; $progress = $jobs[$i]['progress']; - + switch($progress) { case -1: $progress = lang('waiting'); @@ -64,9 +61,9 @@ class Jobs extends CI_Controller { $progress = $progress . "%"; break; } - + $jobs[$i]['progress'] = $progress; - } + } $this->output ->set_content_type('application/json') diff --git a/application/controllers/programs.php b/application/controllers/programs.php index 43a4e80..2e19bc8 100644 --- a/application/controllers/programs.php +++ b/application/controllers/programs.php @@ -25,7 +25,7 @@ /** * @author Karsten Heiken */ -class Programs extends CI_Controller { +class Programs extends MY_Controller { /** * Constructor. @@ -33,9 +33,6 @@ class Programs extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('program'); - - // load language file - $this->lang->load(strtolower($this->router->class)); } /** @@ -43,19 +40,19 @@ class Programs extends CI_Controller { */ public function index() { $programs = $this->program->getAll(); - + $tpl['programs'] = $programs; $this->load->view('program/list', $tpl); } /** * Show detailed information about a program. - * + * * @param type $prg_id The program's id */ public function detail($prg_id) { $program = $this->program->getById($prg_id); - + $tpl['program'] = $program; $this->load->view('program/detail', $tpl); } diff --git a/application/controllers/projects.php b/application/controllers/projects.php index 457d13f..b08ab52 100644 --- a/application/controllers/projects.php +++ b/application/controllers/projects.php @@ -25,7 +25,7 @@ /** * @author Karsten Heiken */ -class Projects extends CI_Controller { +class Projects extends MY_Controller { /** * Constructor. @@ -34,9 +34,6 @@ class Projects extends CI_Controller { parent::__construct(); $this->load->model('project'); $this->load->model('trial'); - - // load language file - $this->lang->load(strtolower($this->router->class)); } /** diff --git a/application/controllers/results.php b/application/controllers/results.php index 5604c6e..7a9482d 100644 --- a/application/controllers/results.php +++ b/application/controllers/results.php @@ -1,18 +1,18 @@ - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is + * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -24,10 +24,10 @@ /** * Result browser. - * + * * @author Karsten Heiken */ -class Results extends CI_Controller { +class Results extends MY_Controller { /** * Constructor. @@ -37,11 +37,8 @@ class Results extends CI_Controller { $this->load->model('program'); $this->load->model('job'); $this->load->model('server'); - - // load language file - $this->lang->load(strtolower($this->router->class)); } - + public function index() { } diff --git a/application/controllers/settings.php b/application/controllers/settings.php index ba33064..42205d7 100644 --- a/application/controllers/settings.php +++ b/application/controllers/settings.php @@ -25,7 +25,7 @@ /** * @author Karsten Heiken */ -class Settings extends CI_Controller { +class Settings extends MY_Controller { /** * Constructor. @@ -33,9 +33,6 @@ class Settings extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('program'); - - // load language file - $this->lang->load(strtolower($this->router->class)); } /** diff --git a/application/controllers/trials.php b/application/controllers/trials.php index ff75a2e..fb7609d 100644 --- a/application/controllers/trials.php +++ b/application/controllers/trials.php @@ -27,7 +27,7 @@ * * @author Karsten Heiken */ -class Trials extends CI_Controller { +class Trials extends MY_Controller { /** * Constructor. @@ -37,9 +37,6 @@ class Trials extends CI_Controller { $this->load->model('trial'); $this->load->model('program'); $this->load->model('project'); - - // load language file - // $this->lang->load(strtolower($this->router->class)); } /** diff --git a/application/core/MY_Controller.php b/application/core/MY_Controller.php new file mode 100644 index 0000000..e425238 --- /dev/null +++ b/application/core/MY_Controller.php @@ -0,0 +1,20 @@ + +*/ +class MY_Controller extends CI_Controller { + + /** + * Calls the parent constructor and loads the relevant language file. + */ + public function __construct() { + parent::__construct(); + + // load relevant language file + $this->lang->load(strtolower($this->router->class)); + } + +} \ No newline at end of file