Merge branch 'master' of disposed.de:scattport

This commit is contained in:
Karsten Heiken
2011-08-25 21:36:55 +02:00
6 changed files with 97 additions and 6 deletions

View File

@@ -82,10 +82,26 @@ class Trial extends CI_Model {
return $this->db->affected_rows() == 1 ? $trialId : false;
}
/**
* Gets all parameters for the specified trial.
*
* @param string $trialId
* @return array
*/
public function getParameters($trialId) {
$this->db->select('trials_parameters.*, parameters.name AS `name`, parameters.type AS `type`');
$this->db->join('parameters', 'trials_parameters.parameter_id = parameters.id', 'left');
$this->db->where('trial_id', $trialId);
$query = $this->db->get('trials_parameters');
return $query->num_rows() > 0 ? $query->result_array() : false;
}
/**
* Get a trial by id.
*
* @param type $trial_id The trial to get.
* @param string $trial_id The trial to get.
* @return array The trial
*/
public function get($trial_id) {
@@ -94,6 +110,16 @@ class Trial extends CI_Model {
return $query->row_array();
}
/**
* Gets a trial by ID.
*
* @param string $trialId The trial to get
* @return array The trial
*/
public function getById($trialId) {
return $this->db->get_where('trials', array('id' => $trialId))->row_array();
}
/**
* Get a trial by its project id.
*