From 67aef802793afdcf04e4088e2ef76d55f22c8ec6 Mon Sep 17 00:00:00 2001 From: Karsten Heiken Date: Thu, 28 Jul 2011 19:53:47 +0200 Subject: [PATCH] Rename configurations to trials --- application/controllers/configurations.php | 46 --------------- application/controllers/trials.php | 21 +++++++ application/models/configuration.php | 53 ------------------ application/models/trial.php | 65 ++++++++++++++++++++++ 4 files changed, 86 insertions(+), 99 deletions(-) delete mode 100644 application/controllers/configurations.php create mode 100644 application/controllers/trials.php delete mode 100644 application/models/configuration.php create mode 100644 application/models/trial.php diff --git a/application/controllers/configurations.php b/application/controllers/configurations.php deleted file mode 100644 index a0a4f1c..0000000 --- a/application/controllers/configurations.php +++ /dev/null @@ -1,46 +0,0 @@ -load->model('configuration'); - - // load language file - // $this->lang->load(strtolower($this->router->class)); - } - - /** - * Get a specific configuration from the database. - * - * @param string $config_id The configuration id to get. - */ - public function get($config_id) { - $configs = $this->configuration->get($config_id); - - $this->output - ->set_content_type('application/json') - ->set_output(json_encode($configs)); - } - - /** - * Search for a specific configuration and return a list of possible results. - * - * @param string $project The project in which to search for a configuration. - * @param string $needle The needle to look for in the haystack. - */ - public function search($project, $needle) { - $results = $this->configuration->search($project, $needle); - $this->output - ->set_content_type('application/json') - ->set_output(json_encode(array('count' => count($results), 'results' => $results))); - } -} \ No newline at end of file diff --git a/application/controllers/trials.php b/application/controllers/trials.php new file mode 100644 index 0000000..2ad5928 --- /dev/null +++ b/application/controllers/trials.php @@ -0,0 +1,21 @@ +load->model('trial'); + + // load language file + // $this->lang->load(strtolower($this->router->class)); + } + +} \ No newline at end of file diff --git a/application/models/configuration.php b/application/models/configuration.php deleted file mode 100644 index 3959ce5..0000000 --- a/application/models/configuration.php +++ /dev/null @@ -1,53 +0,0 @@ -db->insert('configurations', $data); - } - - /** - * Delete a configuration. - * @param string the configuration id to delete - * @return bool was the deletion successful - */ - public function delete($configuration_id) { - return $this->db->delete('configurations', array('id' => $configuration_id)); - } - - /** - * Get a configuration by id. - * - * @param type $configuration_id The configuration to get. - * @return array The configuration - */ - public function get($configuration_id) { - $query = $this->db->get_where('configurations', array('id' => $configuration_id)); - - return $query->row_array(); - } - - /** - * Search for a specific configuration and return a list of possible results. - * - * @param string $needle The needle to look for in the haystack. - */ - public function search($project, $needle) { - $query = $this->db->where('project_id', $project) - ->like('name', $needle)->get('configurations'); - $results = $query->result_array(); - - return $results; - } -} \ No newline at end of file diff --git a/application/models/trial.php b/application/models/trial.php new file mode 100644 index 0000000..15bcbe3 --- /dev/null +++ b/application/models/trial.php @@ -0,0 +1,65 @@ +db->insert('trials', $data); + } + + /** + * Delete a trial. + * @param string the trial id to delete + * @return bool was the deletion successful + */ + public function delete($trial_id) { + return $this->db->delete('trials', array('id' => $trial_id)); + } + + /** + * Get a trial by id. + * + * @param type $trial_id The trial to get. + * @return array The trial + */ + public function get($trial_id) { + $query = $this->db->get_where('trials', array('id' => $trial_id)); + + return $query->row_array(); + } + + /** + * Get a trial by its project id. + * + * @param type $trial_id The trials to get. + * @return array The trial + */ + public function getByProjectId($project_id) { + $query = $this->db->get_where('trials', array('project_id' => $project_id)); + + return $query->result_array(); + } + + /** + * Search for a specific trial and return a list of possible results. + * + * @param string $needle The needle to look for in the haystack. + */ + public function search($project, $needle) { + $query = $this->db->where('project_id', $project) + ->like('name', $needle)->get('trials'); + $results = $query->result_array(); + + return $results; + } +} \ No newline at end of file