From c3ae2eb71665fbb9ccd40b5985b15c6bdedf39bf Mon Sep 17 00:00:00 2001 From: Karsten Heiken Date: Fri, 22 Apr 2011 00:31:07 +0200 Subject: [PATCH] Add documentation --- application/models/project.php | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/application/models/project.php b/application/models/project.php index e25a2ef..c758780 100644 --- a/application/models/project.php +++ b/application/models/project.php @@ -1,7 +1,18 @@ db->where(array('owner' => '215cd70f310ae6ae')) ->order_by('lastaccess', 'desc') @@ -21,6 +32,11 @@ class Project extends CI_Model { return $ownProjects; } + /** + * Get projects the user was invited to use. + * + * @return array The shared projects. + */ public function getShared() { $this->db->select('*')->from('shares')->order_by('lastaccess', 'desc')->where(array('user_id' => '215cd70f310ae6ae')); $this->db->join('projects', 'projects.id = shares.project_id'); @@ -41,6 +57,11 @@ class Project extends CI_Model { return $sharedProjects; } + /** + * Get all publicly available projects. + * + * @return array All public projects. + */ public function getPublic() { $query = $this->db->where(array('public' => '1')) ->order_by('name', 'asc') @@ -59,4 +80,18 @@ class Project extends CI_Model { return $publicProjects; } + + /** + * Get all available configurations from a specific project. + * + * @param array $project_id The project to get the configuration from. + */ + public function get_configurations($project_id) { + $query = $this->db->get_where('configurations', array('project_id' => $project_id)); + + $configurations = $query->result_array(); + $configuration_count = $query->num_rows(); + + return array('count' => $configuration_count, 'configs' => $configurations); + } } \ No newline at end of file