summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/Project.php29
1 files changed, 15 insertions, 14 deletions
diff --git a/app/Controller/Project.php b/app/Controller/Project.php
index 4beb19ce..8178ab5f 100644
--- a/app/Controller/Project.php
+++ b/app/Controller/Project.php
@@ -17,24 +17,25 @@ class Project extends Base
*/
public function index()
{
- $projects = $this->project->getAll(! $this->userSession->isAdmin());
- $nb_projects = count($projects);
- $active_projects = array();
- $inactive_projects = array();
-
- foreach ($projects as $project) {
- if ($project['is_active'] == 1) {
- $active_projects[] = $project;
- }
- else {
- $inactive_projects[] = $project;
- }
+ if ($this->userSession->isAdmin()) {
+ $project_ids = $this->project->getAllIds();
+ }
+ else {
+ $project_ids = $this->projectPermission->getMemberProjectIds($this->userSession->getId());
}
+
+ $nb_projects = count($project_ids);
+
+ $paginator = $this->paginator
+ ->setUrl('project', 'index')
+ ->setMax(20)
+ ->setOrder('name')
+ ->setQuery($this->project->getQueryColumnStats($project_ids))
+ ->calculate();
$this->response->html($this->template->layout('project/index', array(
'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()),
- 'active_projects' => $active_projects,
- 'inactive_projects' => $inactive_projects,
+ 'paginator' => $paginator,
'nb_projects' => $nb_projects,
'title' => t('Projects').' ('.$nb_projects.')'
)));