From 88ba0c0953395e18dbdd871e96831d885f59740c Mon Sep 17 00:00:00 2001 From: BlueTeck Date: Mon, 2 Mar 2015 22:40:09 +0100 Subject: preview images in taskview --- app/Model/File.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'app/Model') diff --git a/app/Model/File.php b/app/Model/File.php index f069c8cf..46710658 100644 --- a/app/Model/File.php +++ b/app/Model/File.php @@ -111,6 +111,38 @@ class File extends Base ->asc('name') ->findAll(); } + + /** + * Get all images for a given task + * + * @access public + * @param integer $task_id Task id + * @return array + */ + public function getAllImages($task_id) + { + return $this->db->table(self::TABLE) + ->eq('task_id', $task_id) + ->eq('is_image', 1) + ->asc('name') + ->findAll(); + } + + /** + * Get all files without images for a given task + * + * @access public + * @param integer $task_id Task id + * @return array + */ + public function getAllDocuments($task_id) + { + return $this->db->table(self::TABLE) + ->eq('task_id', $task_id) + ->eq('is_image', 0) + ->asc('name') + ->findAll(); + } /** * Check if a filename is an image -- cgit v1.2.3