diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Controller/Action.php | 4 | ||||
-rw-r--r-- | app/Controller/App.php | 8 | ||||
-rw-r--r-- | app/Controller/Board.php | 10 | ||||
-rw-r--r-- | app/Controller/Project.php | 8 | ||||
-rw-r--r-- | app/Controller/Subtask.php | 8 | ||||
-rw-r--r-- | app/Controller/Task.php | 10 | ||||
-rw-r--r-- | app/Locale/da_DK/translations.php | 4 | ||||
-rw-r--r-- | app/Locale/de_DE/translations.php | 4 | ||||
-rw-r--r-- | app/Locale/es_ES/translations.php | 4 | ||||
-rw-r--r-- | app/Locale/fi_FI/translations.php | 4 | ||||
-rw-r--r-- | app/Locale/fr_FR/translations.php | 4 | ||||
-rw-r--r-- | app/Locale/it_IT/translations.php | 4 | ||||
-rw-r--r-- | app/Locale/ja_JP/translations.php | 4 | ||||
-rw-r--r-- | app/Locale/pl_PL/translations.php | 4 | ||||
-rw-r--r-- | app/Locale/pt_BR/translations.php | 4 | ||||
-rw-r--r-- | app/Locale/ru_RU/translations.php | 4 | ||||
-rw-r--r-- | app/Locale/sv_SE/translations.php | 4 | ||||
-rw-r--r-- | app/Locale/th_TH/translations.php | 4 | ||||
-rw-r--r-- | app/Locale/zh_CN/translations.php | 4 | ||||
-rw-r--r-- | app/Model/Project.php | 36 | ||||
-rw-r--r-- | app/Model/ProjectPermission.php | 52 | ||||
-rw-r--r-- | app/Template/app_forbidden.php | 4 | ||||
-rw-r--r-- | app/Template/app_index.php | 42 | ||||
-rw-r--r-- | app/helpers.php | 10 |
24 files changed, 194 insertions, 50 deletions
diff --git a/app/Controller/Action.php b/app/Controller/Action.php index 63f72e1f..bf72f36f 100644 --- a/app/Controller/Action.php +++ b/app/Controller/Action.php @@ -27,7 +27,7 @@ class Action extends Base 'available_events' => $this->action->getAvailableEvents(), 'available_params' => $this->action->getAllActionParameters(), 'columns_list' => $this->board->getColumnsList($project['id']), - 'users_list' => $this->projectPermission->getUsersList($project['id']), + 'users_list' => $this->projectPermission->getMemberList($project['id']), 'projects_list' => $this->project->getList(false), 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($project['id']), @@ -85,7 +85,7 @@ class Action extends Base 'values' => $values, 'action_params' => $action_params, 'columns_list' => $this->board->getColumnsList($project['id']), - 'users_list' => $this->projectPermission->getUsersList($project['id']), + 'users_list' => $this->projectPermission->getMemberList($project['id']), 'projects_list' => $projects_list, 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($project['id']), diff --git a/app/Controller/App.php b/app/Controller/App.php index 193c2583..7fa97d4f 100644 --- a/app/Controller/App.php +++ b/app/Controller/App.php @@ -20,12 +20,14 @@ class App extends Base public function index() { $user_id = $this->acl->getUserId(); - $projects = $this->projectPermission->getAllowedProjects($user_id); + $projects = $this->projectPermission->getMemberProjects($user_id); + $project_ids = array_keys($projects); $this->response->html($this->template->layout('app_index', array( - 'board_selector' => $projects, - 'events' => $this->projectActivity->getProjects(array_keys($projects), 10), + 'board_selector' => $this->projectPermission->getAllowedProjects($user_id), + 'events' => $this->projectActivity->getProjects($project_ids, 10), 'tasks' => $this->taskFinder->getAllTasksByUser($user_id), + 'projects' => $this->project->getSummary($project_ids), 'title' => t('Dashboard'), ))); } diff --git a/app/Controller/Board.php b/app/Controller/Board.php index 0cd8f169..a2d6628f 100644 --- a/app/Controller/Board.php +++ b/app/Controller/Board.php @@ -42,12 +42,11 @@ class Board extends Base { $task = $this->getTask(); $project = $this->project->getById($task['project_id']); - $projects = $this->projectPermission->getAllowedProjects($this->acl->getUserId()); + $params = array( 'errors' => array(), 'values' => $task, - 'users_list' => $this->projectPermission->getUsersList($project['id']), - 'projects' => $projects, + 'users_list' => $this->projectPermission->getMemberList($project['id']), 'current_project_id' => $project['id'], 'current_project_name' => $project['name'], ); @@ -95,12 +94,11 @@ class Board extends Base { $task = $this->getTask(); $project = $this->project->getById($task['project_id']); - $projects = $this->projectPermission->getAllowedProjects($this->acl->getUserId()); + $params = array( 'errors' => array(), 'values' => $task, 'categories_list' => $this->category->getList($project['id']), - 'projects' => $projects, 'current_project_id' => $project['id'], 'current_project_name' => $project['name'], ); @@ -213,7 +211,7 @@ class Board extends Base $this->user->storeLastSeenProjectId($project['id']); $this->response->html($this->template->layout('board_index', array( - 'users' => $this->projectPermission->getUsersList($project['id'], true, true), + 'users' => $this->projectPermission->getMemberList($project['id'], true, true), 'filters' => array('user_id' => UserModel::EVERYBODY_ID), 'projects' => $projects, 'current_project_id' => $project['id'], diff --git a/app/Controller/Project.php b/app/Controller/Project.php index bdc382f7..a479b1d6 100644 --- a/app/Controller/Project.php +++ b/app/Controller/Project.php @@ -146,7 +146,7 @@ class Project extends Base public function update() { $project = $this->getProjectManagement(); - $values = $this->request->getValues() + array('is_active' => 0); + $values = $this->request->getValues(); list($valid, $errors) = $this->project->validateModification($values); if ($valid) { @@ -527,9 +527,11 @@ class Project extends Base if ($valid) { - if ($this->project->create($values, $this->acl->getUserId())) { + $project_id = $this->project->create($values, $this->acl->getUserId()); + + if ($project_id) { $this->session->flash(t('Your project have been created successfully.')); - $this->response->redirect('?controller=project'); + $this->response->redirect('?controller=project&action=show&project_id='.$project_id); } else { $this->session->flashError(t('Unable to create your project.')); diff --git a/app/Controller/Subtask.php b/app/Controller/Subtask.php index 5db7471a..bc50b5e1 100644 --- a/app/Controller/Subtask.php +++ b/app/Controller/Subtask.php @@ -42,7 +42,7 @@ class Subtask extends Base 'another_subtask' => $this->request->getIntegerParam('another_subtask', 0) ), 'errors' => array(), - 'users_list' => $this->projectPermission->getUsersList($task['project_id']), + 'users_list' => $this->projectPermission->getMemberList($task['project_id']), 'task' => $task, ))); } @@ -78,7 +78,7 @@ class Subtask extends Base $this->response->html($this->taskLayout('subtask_create', array( 'values' => $values, 'errors' => $errors, - 'users_list' => $this->projectPermission->getUsersList($task['project_id']), + 'users_list' => $this->projectPermission->getMemberList($task['project_id']), 'task' => $task, ))); } @@ -96,7 +96,7 @@ class Subtask extends Base $this->response->html($this->taskLayout('subtask_edit', array( 'values' => $subtask, 'errors' => array(), - 'users_list' => $this->projectPermission->getUsersList($task['project_id']), + 'users_list' => $this->projectPermission->getMemberList($task['project_id']), 'status_list' => $this->subTask->getStatusList(), 'subtask' => $subtask, 'task' => $task, @@ -131,7 +131,7 @@ class Subtask extends Base $this->response->html($this->taskLayout('subtask_edit', array( 'values' => $values, 'errors' => $errors, - 'users_list' => $this->projectPermission->getUsersList($task['project_id']), + 'users_list' => $this->projectPermission->getMemberList($task['project_id']), 'status_list' => $this->subTask->getStatusList(), 'subtask' => $subtask, 'task' => $task, diff --git a/app/Controller/Task.php b/app/Controller/Task.php index 70fda556..d1be8e1e 100644 --- a/app/Controller/Task.php +++ b/app/Controller/Task.php @@ -101,7 +101,7 @@ class Task extends Base ), 'projects_list' => $this->project->getListByStatus(ProjectModel::ACTIVE), 'columns_list' => $this->board->getColumnsList($project['id']), - 'users_list' => $this->projectPermission->getUsersList($project['id']), + 'users_list' => $this->projectPermission->getMemberList($project['id']), 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($project['id']), 'date_format' => $this->config->get('application_date_format'), @@ -149,7 +149,7 @@ class Task extends Base 'values' => $values, 'projects_list' => $this->project->getListByStatus(ProjectModel::ACTIVE), 'columns_list' => $this->board->getColumnsList($project['id']), - 'users_list' => $this->projectPermission->getUsersList($project['id']), + 'users_list' => $this->projectPermission->getMemberList($project['id']), 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($project['id']), 'date_format' => $this->config->get('application_date_format'), @@ -174,7 +174,7 @@ class Task extends Base 'values' => $task, 'errors' => array(), 'task' => $task, - 'users_list' => $this->projectPermission->getUsersList($task['project_id']), + 'users_list' => $this->projectPermission->getMemberList($task['project_id']), 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($task['project_id']), 'date_format' => $this->config->get('application_date_format'), @@ -224,7 +224,7 @@ class Task extends Base 'errors' => $errors, 'task' => $task, 'columns_list' => $this->board->getColumnsList($values['project_id']), - 'users_list' => $this->projectPermission->getUsersList($values['project_id']), + 'users_list' => $this->projectPermission->getMemberList($values['project_id']), 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($values['project_id']), 'date_format' => $this->config->get('application_date_format'), @@ -451,7 +451,7 @@ class Task extends Base $task = $this->getTask(); $values = $task; $errors = array(); - $projects_list = $this->projectPermission->getAllowedProjects($this->acl->getUserId()); + $projects_list = $this->projectPermission->getMemberProjects($this->acl->getUserId()); unset($projects_list[$task['project_id']]); diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index 6a403bbe..8701cf3d 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -561,4 +561,8 @@ return array( // 'Github issue comment created' => '', // 'Configure' => '', // 'Project management' => '', + // 'My projects' => '', + // 'Columns' => '', + // 'Task' => '', + // 'Your are not member of any project.' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index 4afd7180..e47e55c1 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -561,4 +561,8 @@ return array( 'Github issue comment created' => 'Github Fehler Kommentar hinzugefügt', // 'Configure' => '', // 'Project management' => '', + // 'My projects' => '', + // 'Columns' => '', + // 'Task' => '', + // 'Your are not member of any project.' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index ed8ea5b1..72c2e32f 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -561,4 +561,8 @@ return array( // 'Github issue comment created' => '', // 'Configure' => '', // 'Project management' => '', + // 'My projects' => '', + // 'Columns' => '', + // 'Task' => '', + // 'Your are not member of any project.' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index 33f3629b..7711773b 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -561,4 +561,8 @@ return array( // 'Github issue comment created' => '', // 'Configure' => '', // 'Project management' => '', + // 'My projects' => '', + // 'Columns' => '', + // 'Task' => '', + // 'Your are not member of any project.' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index 42c03288..05756a93 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -561,4 +561,8 @@ return array( 'Github issue comment created' => 'Commentaire créé sur un ticket Github', 'Configure' => 'Configurer', 'Project management' => 'Gestion des projets', + 'My projects' => 'Mes projets', + 'Columns' => 'Colonnes', + 'Task' => 'Tâche', + 'Your are not member of any project.' => 'Vous n\'êtes membre d\'aucun projet.', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index c3613e81..64beacab 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -561,4 +561,8 @@ return array( // 'Github issue comment created' => '', // 'Configure' => '', // 'Project management' => '', + // 'My projects' => '', + // 'Columns' => '', + // 'Task' => '', + // 'Your are not member of any project.' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index 02ca8364..3d9c8440 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -561,4 +561,8 @@ return array( // 'Github issue comment created' => '', // 'Configure' => '', // 'Project management' => '', + // 'My projects' => '', + // 'Columns' => '', + // 'Task' => '', + // 'Your are not member of any project.' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index 2637a3a6..19befac7 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -561,4 +561,8 @@ return array( // 'Github issue comment created' => '', // 'Configure' => '', // 'Project management' => '', + // 'My projects' => '', + // 'Columns' => '', + // 'Task' => '', + // 'Your are not member of any project.' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index b3780815..62744783 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -561,4 +561,8 @@ return array( // 'Github issue comment created' => '', // 'Configure' => '', // 'Project management' => '', + // 'My projects' => '', + // 'Columns' => '', + // 'Task' => '', + // 'Your are not member of any project.' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index b6bf887b..b5c73a8f 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -561,4 +561,8 @@ return array( // 'Github issue comment created' => '', // 'Configure' => '', // 'Project management' => '', + // 'My projects' => '', + // 'Columns' => '', + // 'Task' => '', + // 'Your are not member of any project.' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index 8767e914..39cbff16 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -561,4 +561,8 @@ return array( // 'Github issue comment created' => '', // 'Configure' => '', // 'Project management' => '', + // 'My projects' => '', + // 'Columns' => '', + // 'Task' => '', + // 'Your are not member of any project.' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index d92a7af7..eefbdcf3 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -561,4 +561,8 @@ return array( // 'Github issue comment created' => '', // 'Configure' => '', // 'Project management' => '', + // 'My projects' => '', + // 'Columns' => '', + // 'Task' => '', + // 'Your are not member of any project.' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index 1464d050..7db09c59 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -561,4 +561,8 @@ return array( // 'Github issue comment created' => '', // 'Configure' => '', // 'Project management' => '', + // 'My projects' => '', + // 'Columns' => '', + // 'Task' => '', + // 'Your are not member of any project.' => '', ); diff --git a/app/Model/Project.php b/app/Model/Project.php index 32b7fcbe..ad64edcd 100644 --- a/app/Model/Project.php +++ b/app/Model/Project.php @@ -96,6 +96,40 @@ class Project extends Base } /** + * Get project summary for a list of project (number of tasks for each column) + * + * @access public + * @param array $project_ids List of project id + * @param integer $status Project status + * @param string $order Sort on this column + * @param string $direction Sorting direction + * @return array Project properties + */ + public function getSummary(array $project_ids, $status = self::ACTIVE, $order = 'last_modified', $direction = 'desc') + { + if (empty($project_ids)) { + return array(); + } + + $projects = $this->db->table(self::TABLE) + ->in('id', $project_ids) + ->eq('is_active', $status) + ->orderby($order, $direction) + ->findAll(); + + foreach ($projects as &$project) { + + $project['columns'] = $this->board->getColumns($project['id']); + + foreach ($project['columns'] as &$column) { + $column['nb_tasks'] = $this->taskFinder->countByColumnId($project['id'], $column['id']); + } + } + + return $projects; + } + + /** * Get all projects, optionaly fetch stats for each project and can check users permissions * * @access public @@ -192,7 +226,7 @@ class Project extends Base public function getStats($project_id) { $stats = array(); - $columns = $this->board->getcolumns($project_id); + $columns = $this->board->getColumns($project_id); $stats['nb_active_tasks'] = 0; foreach ($columns as &$column) { diff --git a/app/Model/ProjectPermission.php b/app/Model/ProjectPermission.php index fb9847b5..faa4ba29 100644 --- a/app/Model/ProjectPermission.php +++ b/app/Model/ProjectPermission.php @@ -29,9 +29,9 @@ class ProjectPermission extends Base * @param bool $prepend_everybody Prepend the 'Everbody' value * @return array */ - public function getUsersList($project_id, $prepend_unassigned = true, $prepend_everybody = false) + public function getMemberList($project_id, $prepend_unassigned = true, $prepend_everybody = false) { - $allowed_users = $this->getAllowedUsers($project_id); + $allowed_users = $this->getMembers($project_id); if ($prepend_unassigned) { $allowed_users = array(t('Unassigned')) + $allowed_users; @@ -51,7 +51,7 @@ class ProjectPermission extends Base * @param integer $project_id Project id * @return array */ - public function getAllowedUsers($project_id) + public function getMembers($project_id) { if ($this->isEverybodyAllowed($project_id)) { return $this->user->getList(); @@ -96,7 +96,7 @@ class ProjectPermission extends Base $all_users = $this->user->getList(); - $users['allowed'] = $this->getAllowedUsers($project_id); + $users['allowed'] = $this->getMembers($project_id); foreach ($all_users as $user_id => $username) { @@ -141,19 +141,15 @@ class ProjectPermission extends Base } /** - * Check if a specific user is allowed to access to a given project + * Check if a specific user is member of a project * * @access public * @param integer $project_id Project id * @param integer $user_id User id * @return bool */ - public function isUserAllowed($project_id, $user_id) + public function isMember($project_id, $user_id) { - if ($this->user->isAdmin($user_id)) { - return true; - } - if ($this->isEverybodyAllowed($project_id)) { return true; } @@ -166,6 +162,19 @@ class ProjectPermission extends Base } /** + * Check if a specific user is allowed to access to a given project + * + * @access public + * @param integer $project_id Project id + * @param integer $user_id User id + * @return bool + */ + public function isUserAllowed($project_id, $user_id) + { + return $this->user->isAdmin($user_id) || $this->isMember($project_id, $user_id); + } + + /** * Return true if everybody is allowed for the project * * @access public @@ -204,12 +213,13 @@ class ProjectPermission extends Base * @access public * @param array $projects Project list: ['project_id' => 'project_name'] * @param integer $user_id User id + * @param string $filter Method name to apply * @return array */ - public function filterProjects(array $projects, $user_id) + public function filterProjects(array $projects, $user_id, $filter = 'isUserAllowed') { foreach ($projects as $project_id => $project_name) { - if (! $this->isUserAllowed($project_id, $user_id)) { + if (! $this->$filter($project_id, $user_id)) { unset($projects[$project_id]); } } @@ -218,7 +228,7 @@ class ProjectPermission extends Base } /** - * Return a list of projects for a given user + * Return a list of allowed projects for a given user * * @access public * @param integer $user_id User id @@ -226,7 +236,19 @@ class ProjectPermission extends Base */ public function getAllowedProjects($user_id) { - return $this->filterProjects($this->project->getListByStatus(Project::ACTIVE), $user_id); + return $this->filterProjects($this->project->getListByStatus(Project::ACTIVE), $user_id, 'isUserAllowed'); + } + + /** + * Return a list of projects where the user is member + * + * @access public + * @param integer $user_id User id + * @return array + */ + public function getMemberProjects($user_id) + { + return $this->filterProjects($this->project->getListByStatus(Project::ACTIVE), $user_id, 'isMember'); } /** @@ -239,7 +261,7 @@ class ProjectPermission extends Base */ public function duplicate($project_from, $project_to) { - $users = $this->getAllowedUsers($project_from); + $users = $this->getMembers($project_from); foreach ($users as $user_id => $name) { if (! $this->allowUser($project_to, $user_id)) { diff --git a/app/Template/app_forbidden.php b/app/Template/app_forbidden.php index 0c035404..96e76115 100644 --- a/app/Template/app_forbidden.php +++ b/app/Template/app_forbidden.php @@ -1,8 +1,4 @@ <section id="main"> - <div class="page-header"> - <h2><?= t('Forbidden') ?></h2> - </div> - <p class="alert alert-error"> <?= t('Access Forbidden') ?> </p> diff --git a/app/Template/app_index.php b/app/Template/app_index.php index d60638d0..1aa5819a 100644 --- a/app/Template/app_index.php +++ b/app/Template/app_index.php @@ -14,17 +14,48 @@ </div> <section id="dashboard"> <div class="dashboard-left-column"> + <h2><?= t('My projects') ?></h2> + <?php if (empty($projects)): ?> + <p class="alert"><?= t('Your are not member of any project.') ?></p> + <?php else: ?> + <table> + <tr> + <th width="5%"> </th> + <th width="15%"><?= t('Project') ?></th> + <th width="75%"><?= t('Columns') ?></th> + </tr> + <?php foreach ($projects as $project): ?> + <tr> + <td> + <?= Helper\a('#'.$project['id'], 'board', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link') ?> + </td> + <td> + <?php if (Helper\is_project_admin($project)): ?> + <?= Helper\a('<i class="fa fa-cog"></i>', 'project', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Settings')) ?> + <?php endif ?> + <?= Helper\a(Helper\escape($project['name']), 'board', 'show', array('project_id' => $project['id'])) ?> + </td> + <td class="dashboard-project-stats"> + <?php foreach ($project['columns'] as $column): ?> + <strong title="<?= t('Task count') ?>"><?= $column['nb_tasks'] ?></strong> + <span><?= Helper\escape($column['title']) ?></span> + <?php endforeach ?> + </td> + </tr> + <?php endforeach ?> + </table> + <?php endif ?> + <h2><?= t('My tasks') ?></h2> <?php if (empty($tasks)): ?> <p class="alert"><?= t('There is nothing assigned to you.') ?></p> <?php else: ?> <table> <tr> - <th> </th> + <th width="5%"> </th> <th width="15%"><?= t('Project') ?></th> - <th width="40%"><?= t('Title') ?></th> - <th><?= t('Due date') ?></th> - <th><?= t('Date created') ?></th> + <th width="60%"><?= t('Task') ?></th> + <th width="20%"><?= t('Due date') ?></th> </tr> <?php foreach ($tasks as $task): ?> <tr> @@ -40,9 +71,6 @@ <td> <?= dt('%B %e, %Y', $task['date_due']) ?> </td> - <td> - <?= dt('%B %e, %Y', $task['date_creation']) ?> - </td> </tr> <?php endforeach ?> </table> diff --git a/app/helpers.php b/app/helpers.php index a2b91378..f25db0f0 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -78,6 +78,16 @@ function is_admin() } /** + * Return true if the user can configure the project (project are previously filtered) + * + * @return boolean + */ +function is_project_admin(array $project) +{ + return is_admin() || $project['is_private'] == 1; +} + +/** * Return the username * * @param array $user User properties (optional) |