Add documentation
This commit is contained in:
@@ -1,7 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configurations are used to store different variations of the same project.
|
||||||
|
*
|
||||||
|
* @property CI_DB_active_record $db
|
||||||
|
* @author Karsten Heiken, karsten@disposed.de
|
||||||
|
*/
|
||||||
class Project extends CI_Model {
|
class Project extends CI_Model {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the user's own projects.
|
||||||
|
*
|
||||||
|
* @return array The user's projects.
|
||||||
|
*/
|
||||||
public function getOwn() {
|
public function getOwn() {
|
||||||
$query = $this->db->where(array('owner' => '215cd70f310ae6ae'))
|
$query = $this->db->where(array('owner' => '215cd70f310ae6ae'))
|
||||||
->order_by('lastaccess', 'desc')
|
->order_by('lastaccess', 'desc')
|
||||||
@@ -21,6 +32,11 @@ class Project extends CI_Model {
|
|||||||
return $ownProjects;
|
return $ownProjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get projects the user was invited to use.
|
||||||
|
*
|
||||||
|
* @return array The shared projects.
|
||||||
|
*/
|
||||||
public function getShared() {
|
public function getShared() {
|
||||||
$this->db->select('*')->from('shares')->order_by('lastaccess', 'desc')->where(array('user_id' => '215cd70f310ae6ae'));
|
$this->db->select('*')->from('shares')->order_by('lastaccess', 'desc')->where(array('user_id' => '215cd70f310ae6ae'));
|
||||||
$this->db->join('projects', 'projects.id = shares.project_id');
|
$this->db->join('projects', 'projects.id = shares.project_id');
|
||||||
@@ -41,6 +57,11 @@ class Project extends CI_Model {
|
|||||||
return $sharedProjects;
|
return $sharedProjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all publicly available projects.
|
||||||
|
*
|
||||||
|
* @return array All public projects.
|
||||||
|
*/
|
||||||
public function getPublic() {
|
public function getPublic() {
|
||||||
$query = $this->db->where(array('public' => '1'))
|
$query = $this->db->where(array('public' => '1'))
|
||||||
->order_by('name', 'asc')
|
->order_by('name', 'asc')
|
||||||
@@ -59,4 +80,18 @@ class Project extends CI_Model {
|
|||||||
|
|
||||||
return $publicProjects;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user