diff options
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/TagModel.php | 18 | ||||
-rw-r--r-- | app/Model/TaskCreationModel.php | 14 | ||||
-rw-r--r-- | app/Model/TaskModificationModel.php | 5 |
3 files changed, 33 insertions, 4 deletions
diff --git a/app/Model/TagModel.php b/app/Model/TagModel.php index 1be05a66..8eb5e5ba 100644 --- a/app/Model/TagModel.php +++ b/app/Model/TagModel.php @@ -43,6 +43,24 @@ class TagModel extends Base } /** + * Get assignable tags for a project + * + * @access public + * @param integer $project_id + * @return array + */ + public function getAssignableList($project_id) + { + return $this->db->hashtable(self::TABLE) + ->beginOr() + ->eq('project_id', $project_id) + ->eq('project_id', 0) + ->closeOr() + ->asc('name') + ->getAll('id', 'name'); + } + + /** * Get one tag * * @access public diff --git a/app/Model/TaskCreationModel.php b/app/Model/TaskCreationModel.php index 3800f831..fa2d32c6 100644 --- a/app/Model/TaskCreationModel.php +++ b/app/Model/TaskCreationModel.php @@ -22,11 +22,13 @@ class TaskCreationModel extends Base */ public function create(array $values) { - if (! $this->projectModel->exists($values['project_id'])) { - return 0; - } - $position = empty($values['position']) ? 0 : $values['position']; + $tags = array(); + + if (isset($values['tags'])) { + $tags = $values['tags']; + unset($values['tags']); + } $this->prepare($values); $task_id = $this->db->table(TaskModel::TABLE)->persist($values); @@ -36,6 +38,10 @@ class TaskCreationModel extends Base $this->taskPositionModel->movePosition($values['project_id'], $task_id, $values['column_id'], $position, $values['swimlane_id'], false); } + if (! empty($tags)) { + $this->taskTagModel->save($values['project_id'], $task_id, $tags); + } + $this->fireEvents($task_id, $values); } diff --git a/app/Model/TaskModificationModel.php b/app/Model/TaskModificationModel.php index 762af2c5..0fc3617e 100644 --- a/app/Model/TaskModificationModel.php +++ b/app/Model/TaskModificationModel.php @@ -85,6 +85,11 @@ class TaskModificationModel extends Base */ public function prepare(array &$values) { + if (isset($values['tags'])) { + $this->taskTagModel->save($values['project_id'], $values['id'], $values['tags']); + unset($values['tags']); + } + $values = $this->dateParser->convert($values, array('date_due')); $values = $this->dateParser->convert($values, array('date_started'), true); |