diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Api/Base.php | 1 | ||||
-rw-r--r-- | app/Api/Me.php | 5 | ||||
-rw-r--r-- | app/Model/Project.php | 12 |
3 files changed, 18 insertions, 0 deletions
diff --git a/app/Api/Base.php b/app/Api/Base.php index fe78d99d..c1be1878 100644 --- a/app/Api/Base.php +++ b/app/Api/Base.php @@ -20,6 +20,7 @@ abstract class Base extends \Core\Base 'createMyPrivateProject', 'getMyProjectsList', 'getMyOverdueTasks', + 'getMyProjects', ); private $both_allowed_procedures = array( diff --git a/app/Api/Me.php b/app/Api/Me.php index bc721c09..ff317557 100644 --- a/app/Api/Me.php +++ b/app/Api/Me.php @@ -57,4 +57,9 @@ class Me extends Base { return $this->taskFinder->getOverdueTasksByUser($this->userSession->getId()); } + + public function getMyProjects() + { + return $this->formatProjects($this->project->getAllByIds($this->projectPermission->getActiveMemberProjectIds($this->userSession->getId()))); + } } diff --git a/app/Model/Project.php b/app/Model/Project.php index 52500820..6e4cfcfd 100644 --- a/app/Model/Project.php +++ b/app/Model/Project.php @@ -172,6 +172,18 @@ class Project extends Base { return $this->db->table(self::TABLE)->asc('name')->findAll(); } + + /** + * Get all projects with given Ids + * + * @access public + * @param integer[] $project_ids Projects id + * @return array + */ + public function getAllByIds($project_ids) + { + return $this->db->table(self::TABLE)->in('id', $project_ids)->asc('name')->findAll(); + } /** * Get all project ids |