summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-08-22 16:20:53 -0400
committerFrederic Guillot <fred@kanboard.net>2015-08-22 16:20:53 -0400
commitfd60964c239627d2d55c6eca0888be84a8f6653f (patch)
tree062836c4a49857625a25b2cfdd3bbb93732f915d /app
parent18fd39e6d648a58be0782d514604877504833832 (diff)
Add global Gantt chart for all projects
Diffstat (limited to 'app')
-rw-r--r--app/Controller/Gantt.php43
-rw-r--r--app/Locale/cs_CZ/translations.php9
-rw-r--r--app/Locale/da_DK/translations.php9
-rw-r--r--app/Locale/de_DE/translations.php9
-rw-r--r--app/Locale/es_ES/translations.php9
-rw-r--r--app/Locale/fi_FI/translations.php9
-rw-r--r--app/Locale/fr_FR/translations.php9
-rw-r--r--app/Locale/hu_HU/translations.php9
-rw-r--r--app/Locale/it_IT/translations.php9
-rw-r--r--app/Locale/ja_JP/translations.php9
-rw-r--r--app/Locale/nb_NO/translations.php9
-rw-r--r--app/Locale/nl_NL/translations.php9
-rw-r--r--app/Locale/pl_PL/translations.php9
-rw-r--r--app/Locale/pt_BR/translations.php9
-rw-r--r--app/Locale/pt_PT/translations.php9
-rw-r--r--app/Locale/ru_RU/translations.php9
-rw-r--r--app/Locale/sr_Latn_RS/translations.php9
-rw-r--r--app/Locale/sv_SE/translations.php9
-rw-r--r--app/Locale/th_TH/translations.php9
-rw-r--r--app/Locale/tr_TR/translations.php9
-rw-r--r--app/Locale/zh_CN/translations.php9
-rw-r--r--app/Model/Acl.php3
-rw-r--r--app/Model/DateParser.php14
-rw-r--r--app/Model/Project.php51
-rw-r--r--app/Model/ProjectPermission.php41
-rw-r--r--app/Model/TaskFilter.php1
-rw-r--r--app/Template/gantt/project.php4
-rw-r--r--app/Template/gantt/projects.php36
-rw-r--r--app/Template/project/index.php3
-rw-r--r--app/Template/project/show.php8
-rw-r--r--app/Template/project_user/layout.php8
31 files changed, 366 insertions, 26 deletions
diff --git a/app/Controller/Gantt.php b/app/Controller/Gantt.php
index f450bca3..f73501c3 100644
--- a/app/Controller/Gantt.php
+++ b/app/Controller/Gantt.php
@@ -13,7 +13,46 @@ use Model\Task as TaskModel;
class Gantt extends Base
{
/**
- * Show Gantt chart for projects
+ * Show Gantt chart for all projects
+ */
+ public function projects()
+ {
+ if ($this->userSession->isAdmin()) {
+ $project_ids = $this->project->getAllIds();
+ }
+ else {
+ $project_ids = $this->projectPermission->getMemberProjectIds($this->userSession->getId());
+ }
+
+ $this->response->html($this->template->layout('gantt/projects', array(
+ 'projects' => $this->project->getGanttBars($project_ids),
+ 'title' => t('Gantt chart for all projects'),
+ 'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()),
+ )));
+ }
+
+ /**
+ * Save new project start date and end date
+ */
+ public function saveProjectDate()
+ {
+ $values = $this->request->getJson();
+
+ $result = $this->project->update(array(
+ 'id' => $values['id'],
+ 'start_date' => $this->dateParser->getIsoDate(strtotime($values['start'])),
+ 'end_date' => $this->dateParser->getIsoDate(strtotime($values['end'])),
+ ));
+
+ if (! $result) {
+ $this->response->json(array('message' => 'Unable to save project'), 400);
+ }
+
+ $this->response->json(array('message' => 'OK'), 201);
+ }
+
+ /**
+ * Show Gantt chart for one project
*/
public function project()
{
@@ -40,7 +79,7 @@ class Gantt extends Base
/**
* Save new task start date and due date
*/
- public function saveDate()
+ public function saveTaskDate()
{
$this->getProject();
$values = $this->request->getJson();
diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php
index 3bc98419..ed20a607 100644
--- a/app/Locale/cs_CZ/translations.php
+++ b/app/Locale/cs_CZ/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php
index c889c90c..15ac90e8 100644
--- a/app/Locale/da_DK/translations.php
+++ b/app/Locale/da_DK/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php
index 913e8d06..245d974d 100644
--- a/app/Locale/de_DE/translations.php
+++ b/app/Locale/de_DE/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php
index 968bf55b..eaef0bce 100644
--- a/app/Locale/es_ES/translations.php
+++ b/app/Locale/es_ES/translations.php
@@ -1040,4 +1040,13 @@ return array(
'Shared project' => 'Proyecto compartido',
'Project managers' => 'Administradores de proyecto',
'Project members' => 'Miembros de proyecto',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php
index aa490d3f..ecc70961 100644
--- a/app/Locale/fi_FI/translations.php
+++ b/app/Locale/fi_FI/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index 153c4476..f1594004 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -1042,4 +1042,13 @@ return array(
'Shared project' => 'Projet partagé',
'Project managers' => 'Gestionnaires de projet',
'Project members' => 'Membres de projet',
+ 'Gantt chart for all projects' => 'Diagramme de Gantt pour tous les projets',
+ 'Projects list' => 'List des projets',
+ 'Gantt chart for this project' => 'Diagramme de Gantt pour ce projet',
+ 'Project board' => 'Tableau du projet',
+ 'End date:' => 'Date de fin :',
+ 'There is no start date or end date for this project.' => 'Il n\'y a pas de date de début ou de date de fin pour ce projet.',
+ 'Projects Gantt chart' => 'Diagramme de Gantt des projets',
+ 'Start date: %s' => 'Date de début : %s',
+ 'End date: %s' => 'Date de fin : %s',
);
diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php
index 7b7d61fd..65ff8a18 100644
--- a/app/Locale/hu_HU/translations.php
+++ b/app/Locale/hu_HU/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php
index 6a617395..f63dfbec 100644
--- a/app/Locale/it_IT/translations.php
+++ b/app/Locale/it_IT/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php
index 42fb293f..5984bc11 100644
--- a/app/Locale/ja_JP/translations.php
+++ b/app/Locale/ja_JP/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php
index 69c79251..523d6101 100644
--- a/app/Locale/nb_NO/translations.php
+++ b/app/Locale/nb_NO/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php
index a2f7099d..b4e67e6b 100644
--- a/app/Locale/nl_NL/translations.php
+++ b/app/Locale/nl_NL/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php
index f937aa7b..ecf00553 100644
--- a/app/Locale/pl_PL/translations.php
+++ b/app/Locale/pl_PL/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php
index 7b33333c..348886b3 100644
--- a/app/Locale/pt_BR/translations.php
+++ b/app/Locale/pt_BR/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php
index 58f32772..79c09f74 100644
--- a/app/Locale/pt_PT/translations.php
+++ b/app/Locale/pt_PT/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php
index c90ba162..6f891d1c 100644
--- a/app/Locale/ru_RU/translations.php
+++ b/app/Locale/ru_RU/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php
index dbc5d9aa..ca1f786b 100644
--- a/app/Locale/sr_Latn_RS/translations.php
+++ b/app/Locale/sr_Latn_RS/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php
index 7a38ee78..0f3b18fe 100644
--- a/app/Locale/sv_SE/translations.php
+++ b/app/Locale/sv_SE/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php
index 7d301973..0d68fd4c 100644
--- a/app/Locale/th_TH/translations.php
+++ b/app/Locale/th_TH/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php
index c51be0bd..4b91c822 100644
--- a/app/Locale/tr_TR/translations.php
+++ b/app/Locale/tr_TR/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php
index c9122bfd..12978c9c 100644
--- a/app/Locale/zh_CN/translations.php
+++ b/app/Locale/zh_CN/translations.php
@@ -1040,4 +1040,13 @@ return array(
// 'Shared project' => '',
// 'Project managers' => '',
// 'Project members' => '',
+ // 'Gantt chart for all projects' => '',
+ // 'Projects list' => '',
+ // 'Gantt chart for this project' => '',
+ // 'Project board' => '',
+ // 'End date:' => '',
+ // 'There is no start date or end date for this project.' => '',
+ // 'Projects Gantt chart' => '',
+ // 'Start date: %s' => '',
+ // 'End date: %s' => '',
);
diff --git a/app/Model/Acl.php b/app/Model/Acl.php
index b1e9eb07..e93bf1d9 100644
--- a/app/Model/Acl.php
+++ b/app/Model/Acl.php
@@ -65,7 +65,7 @@ class Acl extends Base
'project' => array('edit', 'update', 'share', 'integration', 'users', 'alloweverybody', 'allow', 'setowner', 'revoke', 'duplicate', 'disable', 'enable'),
'swimlane' => '*',
'budget' => '*',
- 'gantt' => '*',
+ 'gantt' => array('project', 'savetaskdate', 'task', 'savetask'),
);
/**
@@ -77,6 +77,7 @@ class Acl extends Base
private $project_admin_acl = array(
'project' => array('remove'),
'projectuser' => '*',
+ 'gantt' => array('projects', 'saveprojectdate'),
);
/**
diff --git a/app/Model/DateParser.php b/app/Model/DateParser.php
index 036725e3..6e833061 100644
--- a/app/Model/DateParser.php
+++ b/app/Model/DateParser.php
@@ -77,7 +77,7 @@ class DateParser extends Base
}
/**
- * Parse a date ad return a unix timestamp, try different date formats
+ * Parse a date and return a unix timestamp, try different date formats
*
* @access public
* @param string $value Date to parse
@@ -97,6 +97,18 @@ class DateParser extends Base
}
/**
+ * Get ISO8601 date from user input
+ *
+ * @access public
+ * @param string $value Date to parse
+ * @return string
+ */
+ public function getIsoDate($value)
+ {
+ return date('Y-m-d', ctype_digit($value) ? $value : $this->getTimestamp($value));
+ }
+
+ /**
* Get all combinations of date/time formats
*
* @access public
diff --git a/app/Model/Project.php b/app/Model/Project.php
index 161a0cae..52500820 100644
--- a/app/Model/Project.php
+++ b/app/Model/Project.php
@@ -115,6 +115,54 @@ class Project extends Base
}
/**
+ * Get all projects to generate the Gantt chart
+ *
+ * @access public
+ * @param array $project_ids
+ * @return array
+ */
+ public function getGanttBars(array $project_ids)
+ {
+ if (empty($project_ids)) {
+ return array();
+ }
+
+ $colors = $this->color->getDefaultColors();
+ $projects = $this->db->table(self::TABLE)->asc('start_date')->in('id', $project_ids)->eq('is_active', self::ACTIVE)->eq('is_private', 0)->findAll();
+ $bars = array();
+
+ foreach ($projects as $project) {
+ $start = empty($project['start_date']) ? time() : strtotime($project['start_date']);
+ $end = empty($project['end_date']) ? $start : strtotime($project['end_date']);
+ $color = next($colors) ?: reset($colors);
+
+ $bars[] = array(
+ 'type' => 'project',
+ 'id' => $project['id'],
+ 'title' => $project['name'],
+ 'start' => array(
+ (int) date('Y', $start),
+ (int) date('n', $start),
+ (int) date('j', $start),
+ ),
+ 'end' => array(
+ (int) date('Y', $end),
+ (int) date('n', $end),
+ (int) date('j', $end),
+ ),
+ 'link' => $this->helper->url->href('project', 'show', array('project_id' => $project['id'])),
+ 'board_link' => $this->helper->url->href('board', 'show', array('project_id' => $project['id'])),
+ 'gantt_link' => $this->helper->url->href('gantt', 'project', array('project_id' => $project['id'])),
+ 'color' => $color,
+ 'not_defined' => empty($project['start_date']) || empty($project['end_date']),
+ 'users' => $this->projectPermission->getProjectUsers($project['id']),
+ );
+ }
+
+ return $bars;
+ }
+
+ /**
* Get all projects
*
* @access public
@@ -271,8 +319,7 @@ class Project extends Base
{
foreach ($projects as &$project) {
$this->getColumnStats($project);
- $project['managers'] = $this->projectPermission->getManagers($project['id']);
- $project['members'] = $this->projectPermission->getOnlyMembers($project['id']);
+ $project = array_merge($project, $this->projectPermission->getProjectUsers($project['id']));
}
return $projects;
diff --git a/app/Model/ProjectPermission.php b/app/Model/ProjectPermission.php
index 03e9bea6..c412b7a9 100644
--- a/app/Model/ProjectPermission.php
+++ b/app/Model/ProjectPermission.php
@@ -50,40 +50,49 @@ class ProjectPermission extends Base
}
/**
- * Get a list of allowed people for a project
+ * Get a list of members and managers with a single SQL query
*
* @access public
* @param integer $project_id Project id
* @return array
*/
- public function getMembers($project_id)
+ public function getProjectUsers($project_id)
{
- if ($this->isEverybodyAllowed($project_id)) {
- return $this->user->getList();
+ $result = array(
+ 'managers' => array(),
+ 'members' => array(),
+ );
+
+ $users = $this->db
+ ->table(self::TABLE)
+ ->join(User::TABLE, 'id', 'user_id')
+ ->eq('project_id', $project_id)
+ ->asc('username')
+ ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name', self::TABLE.'.is_owner')
+ ->findAll();
+
+ foreach ($users as $user) {
+ $key = $user['is_owner'] == 1 ? 'managers' : 'members';
+ $result[$key][$user['id']] = $user['name'] ?: $user['username'];
}
- return $this->getAssociatedUsers($project_id);
+ return $result;
}
/**
- * Get a list of standard user members for a project
+ * Get a list of allowed people for a project
*
* @access public
* @param integer $project_id Project id
* @return array
*/
- public function getOnlyMembers($project_id)
+ public function getMembers($project_id)
{
- $users = $this->db
- ->table(self::TABLE)
- ->join(User::TABLE, 'id', 'user_id')
- ->eq('project_id', $project_id)
- ->eq('is_owner', 0)
- ->asc('username')
- ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name')
- ->findAll();
+ if ($this->isEverybodyAllowed($project_id)) {
+ return $this->user->getList();
+ }
- return $this->user->prepareList($users);
+ return $this->getAssociatedUsers($project_id);
}
/**
diff --git a/app/Model/TaskFilter.php b/app/Model/TaskFilter.php
index cede59e3..d72af68c 100644
--- a/app/Model/TaskFilter.php
+++ b/app/Model/TaskFilter.php
@@ -726,6 +726,7 @@ class TaskFilter extends Base
$end = $task['date_due'] ?: $start;
$bars[] = array(
+ 'type' => 'task',
'id' => $task['id'],
'title' => $task['title'],
'start' => array(
diff --git a/app/Template/gantt/project.php b/app/Template/gantt/project.php
index ec45f7f6..7ad859c7 100644
--- a/app/Template/gantt/project.php
+++ b/app/Template/gantt/project.php
@@ -35,8 +35,8 @@
<?php if (! empty($tasks)): ?>
<div
id="gantt-chart"
- data-tasks='<?= json_encode($tasks, JSON_HEX_APOS) ?>'
- data-save-url="<?= $this->url->href('gantt', 'saveDate', array('project_id' => $project['id'])) ?>"
+ data-records='<?= json_encode($tasks, JSON_HEX_APOS) ?>'
+ data-save-url="<?= $this->url->href('gantt', 'saveTaskDate', array('project_id' => $project['id'])) ?>"
data-label-start-date="<?= t('Start date:') ?>"
data-label-end-date="<?= t('Due date:') ?>"
data-label-assignee="<?= t('Assignee:') ?>"
diff --git a/app/Template/gantt/projects.php b/app/Template/gantt/projects.php
new file mode 100644
index 00000000..50e244a5
--- /dev/null
+++ b/app/Template/gantt/projects.php
@@ -0,0 +1,36 @@
+<section id="main">
+ <div class="page-header">
+ <ul>
+ <?php if ($this->user->isProjectAdmin() || $this->user->isAdmin()): ?>
+ <li><i class="fa fa-plus fa-fw"></i><?= $this->url->link(t('New project'), 'project', 'create') ?></li>
+ <?php endif ?>
+ <li>
+ <i class="fa fa-lock fa-fw"></i><?= $this->url->link(t('New private project'), 'project', 'create', array('private' => 1)) ?>
+ </li>
+ <li>
+ <i class="fa fa-folder fa-fw"></i><?= $this->url->link(t('Projects list'), 'project', 'index') ?>
+ </li>
+ <?php if ($this->user->isProjectAdmin() || $this->user->isAdmin()): ?>
+ <li><i class="fa fa-user fa-fw"></i><?= $this->url->link(t('Users overview'), 'projectuser', 'managers') ?></li>
+ <?php endif ?>
+ </ul>
+ </div>
+ <section>
+ <?php if (empty($projects)): ?>
+ <p class="alert"><?= t('No project') ?></p>
+ <?php else: ?>
+ <div
+ id="gantt-chart"
+ data-records='<?= json_encode($projects, JSON_HEX_APOS) ?>'
+ data-save-url="<?= $this->url->href('gantt', 'saveProjectDate') ?>"
+ data-label-managers="<?= t('Project managers') ?>"
+ data-label-members="<?= t('Project members') ?>"
+ data-label-gantt-link="<?= t('Gantt chart for this project') ?>"
+ data-label-board-link="<?= t('Project board') ?>"
+ data-label-start-date="<?= t('Start date:') ?>"
+ data-label-end-date="<?= t('End date:') ?>"
+ data-label-not-defined="<?= t('There is no start date or end date for this project.') ?>"
+ ></div>
+ <?php endif ?>
+ </section>
+</section>
diff --git a/app/Template/project/index.php b/app/Template/project/index.php
index f24a8c4a..5ca6e6b5 100644
--- a/app/Template/project/index.php
+++ b/app/Template/project/index.php
@@ -6,7 +6,8 @@
<?php endif ?>
<li><i class="fa fa-lock fa-fw"></i><?= $this->url->link(t('New private project'), 'project', 'create', array('private' => 1)) ?></li>
<?php if ($this->user->isProjectAdmin() || $this->user->isAdmin()): ?>
- <li><i class="fa fa-users fa-fw"></i><?= $this->url->link(t('Users overview'), 'projectuser', 'managers') ?></li>
+ <li><i class="fa fa-user fa-fw"></i><?= $this->url->link(t('Users overview'), 'projectuser', 'managers') ?></li>
+ <li><i class="fa fa-sliders fa-fw"></i><?= $this->url->link(t('Projects Gantt chart'), 'gantt', 'projects') ?></li>
<?php endif ?>
</ul>
</div>
diff --git a/app/Template/project/show.php b/app/Template/project/show.php
index d8d6de8d..5a65a26e 100644
--- a/app/Template/project/show.php
+++ b/app/Template/project/show.php
@@ -20,6 +20,14 @@
<li><?= dt('Last modified on %B %e, %Y at %k:%M %p', $project['last_modified']) ?></li>
<?php endif ?>
+ <?php if ($project['start_date']): ?>
+ <li><?= t('Start date: %s', $project['start_date']) ?></li>
+ <?php endif ?>
+
+ <?php if ($project['end_date']): ?>
+ <li><?= t('End date: %s', $project['end_date']) ?></li>
+ <?php endif ?>
+
<?php if ($stats['nb_tasks'] > 0): ?>
<?php if ($stats['nb_active_tasks'] > 0): ?>
diff --git a/app/Template/project_user/layout.php b/app/Template/project_user/layout.php
index a68fc579..4cf732d6 100644
--- a/app/Template/project_user/layout.php
+++ b/app/Template/project_user/layout.php
@@ -10,8 +10,14 @@
</li>
<li>
<i class="fa fa-folder fa-fw"></i>
- <?= $this->url->link(t('All projects'), 'project', 'index') ?>
+ <?= $this->url->link(t('Projects list'), 'project', 'index') ?>
</li>
+ <?php if ($this->user->isProjectAdmin() || $this->user->isAdmin()): ?>
+ <li>
+ <i class="fa fa-sliders fa-fw"></i>
+ <?= $this->url->link(t('Projects Gantt chart'), 'gantt', 'projects') ?>
+ </li>
+ <?php endif ?>
</ul>
</div>
<section class="sidebar-container">