![]() |
Izartu
0.0 Initial release
Web bookmark manager based on tags.
|
00001 <?php 00002 # Izartu 00003 # 00004 # Copyright © 2011-2012 Javier Beaumont <contact@javierbeaumont.org> 00005 # 00006 # This file is part of Izartu. 00007 # 00008 # Izartu is free software: you can redistribute it and/or modify 00009 # it under the terms of the GNU Affero General Public License as 00010 # published by the Free Software Foundation, either version 3 of the 00011 # License, or (at your option) any later version. 00012 # 00013 # Izartu is distributed in the hope that it will be useful, 00014 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 # GNU Affero General Public License for more details. 00017 # 00018 # You should have received a copy of the GNU Affero General Public License 00019 # along with Izartu. If not, see <http://www.gnu.org/licenses/>. 00020 00031 trait Tag { 00032 00038 final private function getTags($id) { 00039 $param[0] = array(':data', $id, PDO::PARAM_INT, 255); 00040 return $this->read(' 00041 SELECT `id`, `name` 00042 FROM `'.PREFIX.'tag` 00043 WHERE `id` IN ( 00044 SELECT `tag` 00045 FROM `'.PREFIX.'data_tag` 00046 WHERE `data` = :data 00047 )', $param); 00048 } 00049 00055 final private function getCloud($cond = FALSE, $param = FALSE) { 00056 return $this->read(' 00057 SELECT `tag`.`id`, `tag`.`name`, 00058 COUNT(`data_tag`.`tag`) AS `value` 00059 FROM `tag` 00060 LEFT JOIN `data_tag` ON ( 00061 `data_tag`.`tag` = `tag`.`id` 00062 )'. 00063 $cond.' 00064 GROUP BY `tag`.`name`', 00065 $param); 00066 } 00067 00068 }
1.7.6.1