diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-09-10 16:21:47 +0200 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-09-10 16:21:47 +0200 |
commit | 28ff8dad91c9e3c25f6a3b5398ae15f2a1ef95cd (patch) | |
tree | 0cecc5cbb6e7e6795dd032cc6a5703cd88b8770e /app/Model/TaskHistory.php | |
parent | 9bde377bbe85617dde280af985e033cf7de61803 (diff) |
Add subtasks and comments history
Diffstat (limited to 'app/Model/TaskHistory.php')
-rw-r--r-- | app/Model/TaskHistory.php | 64 |
1 files changed, 15 insertions, 49 deletions
diff --git a/app/Model/TaskHistory.php b/app/Model/TaskHistory.php index 181e4181..35b7cb27 100644 --- a/app/Model/TaskHistory.php +++ b/app/Model/TaskHistory.php @@ -3,7 +3,7 @@ namespace Model; use PDO; -use Core\Template; +use Core\Registry; use Event\TaskHistoryListener; /** @@ -12,7 +12,7 @@ use Event\TaskHistoryListener; * @package model * @author Frederic Guillot */ -class TaskHistory extends Base +class TaskHistory extends BaseHistory { /** * SQL table name @@ -29,6 +29,18 @@ class TaskHistory extends Base const MAX_EVENTS = 5000; /** + * Constructor + * + * @access public + * @param \Core\Registry $registry Registry instance + */ + public function __construct(Registry $registry) + { + parent::__construct($registry); + $this->table = self::TABLE; + } + + /** * Create a new event * * @access public @@ -59,40 +71,6 @@ class TaskHistory extends Base } /** - * Remove old event entries to avoid a large table - * - * @access public - * @param integer $max Maximum number of items to keep in the table - */ - public function cleanup($max) - { - if ($this->db->table(self::TABLE)->count() > $max) { - - $this->db->execute(' - DELETE FROM '.self::TABLE.' - WHERE id <= ( - SELECT id FROM ( - SELECT id FROM '.self::TABLE.' ORDER BY id DESC LIMIT 1 OFFSET '.$max.' - ) foo - )'); - } - } - - /** - * Get all events for a given project - * - * @access public - * @return array - */ - public function getAllByProjectId($project_id) - { - return $this->db->table(self::TABLE) - ->eq('project_id', $project_id) - ->desc('id') - ->findAll(); - } - - /** * Get all necessary content to display activity feed * * $author_name @@ -103,6 +81,7 @@ class TaskHistory extends Base { $sql = ' SELECT + task_has_events.id, task_has_events.date_creation, task_has_events.event_name, task_has_events.task_id, @@ -155,19 +134,6 @@ class TaskHistory extends Base } /** - * Get the event html content - * - * @access public - * @param array $params Event properties - * @return string - */ - public function getContent(array $params) - { - $tpl = new Template; - return $tpl->load('event_'.str_replace('.', '_', $params['event_name']), $params); - } - - /** * Attach events to be able to record the history * * @access public |