From ce367a24fca09bb1fa05da167f36db54712c8fa1 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Fri, 24 Jun 2016 22:10:14 -0400 Subject: Added tag modification from the user interface --- app/Model/TagModel.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'app/Model') diff --git a/app/Model/TagModel.php b/app/Model/TagModel.php index 8eb5e5ba..e85c5a87 100644 --- a/app/Model/TagModel.php +++ b/app/Model/TagModel.php @@ -93,6 +93,29 @@ class TagModel extends Base ->findOneColumn('id'); } + /** + * Return true if the tag exists + * + * @access public + * @param integer $project_id + * @param string $tag + * @param integer $tag_id + * @return boolean + */ + public function exists($project_id, $tag, $tag_id = 0) + { + return $this->db + ->table(self::TABLE) + ->neq('id', $tag_id) + ->beginOr() + ->eq('project_id', 0) + ->eq('project_id', $project_id) + ->closeOr() + ->ilike('name', $tag) + ->asc('project_id') + ->exists(); + } + /** * Return tag id and create a new tag if necessary * -- cgit v1.2.3