diff options
-rw-r--r-- | actions/task_assign_color_user.php | 47 | ||||
-rw-r--r-- | controllers/action.php | 2 | ||||
-rw-r--r-- | locales/fr_FR/translations.php | 3 | ||||
-rw-r--r-- | locales/pl_PL/translations.php | 1 | ||||
-rw-r--r-- | models/action.php | 5 | ||||
-rw-r--r-- | templates/action_index.php | 2 | ||||
-rw-r--r-- | templates/action_params.php | 4 |
7 files changed, 62 insertions, 2 deletions
diff --git a/actions/task_assign_color_user.php b/actions/task_assign_color_user.php new file mode 100644 index 00000000..a9f08e30 --- /dev/null +++ b/actions/task_assign_color_user.php @@ -0,0 +1,47 @@ +<?php + +namespace Action; + +require_once __DIR__.'/base.php'; + +class TaskAssignColorUser extends Base +{ + public function __construct($project_id, \Model\Task $task) + { + parent::__construct($project_id); + $this->task = $task; + } + + public function getActionRequiredParameters() + { + return array( + 'column_id' => t('Column'), + 'color_id' => t('Color'), + 'user_id' => t('Assignee'), + ); + } + + public function getEventRequiredParameters() + { + return array( + 'task_id', + 'owner_id', + 'column_id', + ); + } + + public function doAction(array $data) + { + if ($data['column_id'] == $this->getParam('column_id') && $data['owner_id'] == $this->getParam('user_id')) { + + $this->task->update(array( + 'id' => $data['task_id'], + 'color_id' => $this->getParam('color_id'), + )); + + return true; + } + + return false; + } +} diff --git a/controllers/action.php b/controllers/action.php index 270e4e75..32ec737d 100644 --- a/controllers/action.php +++ b/controllers/action.php @@ -37,6 +37,7 @@ class Action extends Base 'columns_list' => $this->board->getColumnsList($project['id']), 'users_list' => $this->project->getUsersList($project['id'], false), 'projects_list' => $this->project->getList(false), + 'colors_list' => $this->task->getColors(), 'menu' => 'projects', 'title' => t('Automatic actions') ))); @@ -66,6 +67,7 @@ class Action extends Base 'columns_list' => $this->board->getColumnsList($project['id']), 'users_list' => $this->project->getUsersList($project['id'], false), 'projects_list' => $this->project->getList(false), + 'colors_list' => $this->task->getColors(), 'project' => $project, 'menu' => 'projects', 'title' => t('Automatic actions') diff --git a/locales/fr_FR/translations.php b/locales/fr_FR/translations.php index b85d05d9..690ce3fa 100644 --- a/locales/fr_FR/translations.php +++ b/locales/fr_FR/translations.php @@ -99,7 +99,7 @@ return array( 'Edit a task' => 'Modifier une tâche', 'Column' => 'Colonne', 'Color' => 'Couleur', - 'Assignee' => 'Personne assigné', + 'Assignee' => 'Personne assignée', 'Create another task' => 'Créer une autre tâche', 'New task' => 'Nouvelle tâche', 'Open a task' => 'Ouvrir une tâche', @@ -247,4 +247,5 @@ return array( 'Task creation' => 'Création d\'une tâche', 'Open a closed task' => 'Ouverture d\'une tâche fermée', 'Closing a task' => 'Fermeture d\'une tâche', + 'Assign a color to a specific user' => 'Assigner une couleur à un utilisateur', ); diff --git a/locales/pl_PL/translations.php b/locales/pl_PL/translations.php index 7da7c330..530e5a22 100644 --- a/locales/pl_PL/translations.php +++ b/locales/pl_PL/translations.php @@ -250,4 +250,5 @@ return array( // 'Task creation' => '', // 'Open a closed task' => '', // 'Closing a task' => '', + // 'Assign a color to a specific user' => '', ); diff --git a/models/action.php b/models/action.php index 9b18d461..f3e2094d 100644 --- a/models/action.php +++ b/models/action.php @@ -26,6 +26,7 @@ class Action extends Base 'TaskAssignSpecificUser' => t('Assign the task to a specific user'), 'TaskAssignCurrentUser' => t('Assign the task to the person who does the action'), 'TaskDuplicateAnotherProject' => t('Duplicate the task to another project'), + 'TaskAssignColorUser' => t('Assign a color to a specific user'), ); } @@ -217,6 +218,10 @@ class Action extends Base require_once __DIR__.'/../actions/task_duplicate_another_project.php'; $className = '\Action\TaskDuplicateAnotherProject'; return new $className($project_id, new Task($this->db, $this->event)); + case 'TaskAssignColorUser': + require_once __DIR__.'/../actions/task_assign_color_user.php'; + $className = '\Action\TaskAssignColorUser'; + return new $className($project_id, new Task($this->db, $this->event)); default: throw new \LogicException('Action not found: '.$name); } diff --git a/templates/action_index.php b/templates/action_index.php index 6e62949e..eccc0ec4 100644 --- a/templates/action_index.php +++ b/templates/action_index.php @@ -34,6 +34,8 @@ <?= Helper\in_list($param['value'], $users_list) ?> <?php elseif (Helper\contains($param['name'], 'project_id')): ?> <?= Helper\in_list($param['value'], $projects_list) ?> + <?php elseif (Helper\contains($param['name'], 'color_id')): ?> + <?= Helper\in_list($param['value'], $colors_list) ?> <?php endif ?> </strong> </li> diff --git a/templates/action_params.php b/templates/action_params.php index e7efcda5..ed9d8b8f 100644 --- a/templates/action_params.php +++ b/templates/action_params.php @@ -25,8 +25,10 @@ <?php elseif (Helper\contains($param_name, 'project_id')): ?> <?= Helper\form_label($param_desc, $param_name) ?> <?= Helper\form_select('params['.$param_name.']', $projects_list, $values) ?><br/> + <?php elseif (Helper\contains($param_name, 'color_id')): ?> + <?= Helper\form_label($param_desc, $param_name) ?> + <?= Helper\form_select('params['.$param_name.']', $colors_list, $values) ?><br/> <?php endif ?> - <?php endforeach ?> <div class="form-actions"> |