summaryrefslogtreecommitdiff
path: root/app/Model/TaskExternalLink.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-28 19:48:22 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-28 19:48:22 -0400
commit14713b0ec7ed93ca45578da069ad4e19a7d8addf (patch)
tree79972d53f6091a1ddb17f64a6a05a5523f5d5168 /app/Model/TaskExternalLink.php
parent936376ffe74c583d3cb819e98f53a85137fdf8bc (diff)
Rename all models
Diffstat (limited to 'app/Model/TaskExternalLink.php')
-rw-r--r--app/Model/TaskExternalLink.php101
1 files changed, 0 insertions, 101 deletions
diff --git a/app/Model/TaskExternalLink.php b/app/Model/TaskExternalLink.php
deleted file mode 100644
index f77a72bf..00000000
--- a/app/Model/TaskExternalLink.php
+++ /dev/null
@@ -1,101 +0,0 @@
-<?php
-
-namespace Kanboard\Model;
-
-use Kanboard\Core\Base;
-
-/**
- * Task External Link Model
- *
- * @package model
- * @author Frederic Guillot
- */
-class TaskExternalLink extends Base
-{
- /**
- * SQL table name
- *
- * @var string
- */
- const TABLE = 'task_has_external_links';
-
- /**
- * Get all links
- *
- * @access public
- * @param integer $task_id
- * @return array
- */
- public function getAll($task_id)
- {
- $types = $this->externalLinkManager->getTypes();
-
- $links = $this->db->table(self::TABLE)
- ->columns(self::TABLE.'.*', User::TABLE.'.name AS creator_name', User::TABLE.'.username AS creator_username')
- ->eq('task_id', $task_id)
- ->asc('title')
- ->join(User::TABLE, 'id', 'creator_id')
- ->findAll();
-
- foreach ($links as &$link) {
- $link['dependency_label'] = $this->externalLinkManager->getDependencyLabel($link['link_type'], $link['dependency']);
- $link['type'] = isset($types[$link['link_type']]) ? $types[$link['link_type']] : t('Unknown');
- }
-
- return $links;
- }
-
- /**
- * Get link
- *
- * @access public
- * @param integer $link_id
- * @return array
- */
- public function getById($link_id)
- {
- return $this->db->table(self::TABLE)->eq('id', $link_id)->findOne();
- }
-
- /**
- * Add a new link in the database
- *
- * @access public
- * @param array $values Form values
- * @return boolean|integer
- */
- public function create(array $values)
- {
- unset($values['id']);
- $values['creator_id'] = $this->userSession->getId();
- $values['date_creation'] = time();
- $values['date_modification'] = $values['date_creation'];
-
- return $this->db->table(self::TABLE)->persist($values);
- }
-
- /**
- * Modify external link
- *
- * @access public
- * @param array $values Form values
- * @return boolean
- */
- public function update(array $values)
- {
- $values['date_modification'] = time();
- return $this->db->table(self::TABLE)->eq('id', $values['id'])->update($values);
- }
-
- /**
- * Remove a link
- *
- * @access public
- * @param integer $link_id
- * @return boolean
- */
- public function remove($link_id)
- {
- return $this->db->table(self::TABLE)->eq('id', $link_id)->remove();
- }
-}