Move getting of a project to the model
This commit is contained in:
@@ -65,10 +65,10 @@ class Projects extends CI_Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function detail($projects, $area, $id) {
|
public function detail($projects, $area, $id) {
|
||||||
$result = $this->db->get_where('projects', array('id' => $id))->row_array();
|
$project = $this->project->get($id);
|
||||||
$this->output
|
$this->output
|
||||||
->set_content_type('application/json')
|
->set_content_type('application/json')
|
||||||
->set_output(json_encode(array('result' => $result)));
|
->set_output(json_encode($project));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -80,6 +80,18 @@ class Project extends CI_Model {
|
|||||||
|
|
||||||
return $publicProjects;
|
return $publicProjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a specific project from the database.
|
||||||
|
*
|
||||||
|
* @param type $project_id The project to get.
|
||||||
|
*/
|
||||||
|
public function get($project_id) {
|
||||||
|
$result = $this->db->get_where('projects', array('id' => $project_id))->row_array();
|
||||||
|
|
||||||
|
$this->db->query('UPDATE `projects` SET `lastaccess` = NOW() WHERE `id`='.$this->db->escape($project_id).';');
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all available configurations from a specific project.
|
* Get all available configurations from a specific project.
|
||||||
|
|||||||
Reference in New Issue
Block a user