diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-06-24 22:10:14 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-06-24 22:10:14 -0400 |
commit | ce367a24fca09bb1fa05da167f36db54712c8fa1 (patch) | |
tree | 204814ef3e71256ef77716d7f233ff194772c5a0 /app/Model/TagModel.php | |
parent | cead21691e449707e17dba4ef0be3f8ce0ee42f5 (diff) |
Added tag modification from the user interface
Diffstat (limited to 'app/Model/TagModel.php')
-rw-r--r-- | app/Model/TagModel.php | 23 |
1 files changed, 23 insertions, 0 deletions
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 @@ -94,6 +94,29 @@ class TagModel extends Base } /** + * 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 * * @access public |