| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | ############################################################################### |
|---|
| 4 | # Gregarius - A PHP based RSS aggregator. |
|---|
| 5 | # Copyright (C) 2003 - 2006 Marco Bonetti |
|---|
| 6 | # |
|---|
| 7 | ############################################################################### |
|---|
| 8 | # This program is free software and open source software; you can redistribute |
|---|
| 9 | # it and/or modify it under the terms of the GNU General Public License as |
|---|
| 10 | # published by the Free Software Foundation; either version 2 of the License, |
|---|
| 11 | # or (at your option) any later version. |
|---|
| 12 | # |
|---|
| 13 | # This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 14 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 15 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 16 | # more details. |
|---|
| 17 | # |
|---|
| 18 | # You should have received a copy of the GNU General Public License along |
|---|
| 19 | # with this program; if not, write to the Free Software Foundation, Inc., |
|---|
| 20 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit |
|---|
| 21 | # http://www.gnu.org/licenses/gpl.html |
|---|
| 22 | # |
|---|
| 23 | ############################################################################### |
|---|
| 24 | # E-mail: mbonetti at gmail dot com |
|---|
| 25 | # Web page: http://gregarius.net/ |
|---|
| 26 | # |
|---|
| 27 | ############################################################################### |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | rss_require('cls/alltags.php'); |
|---|
| 31 | rss_require('cls/channels.php'); |
|---|
| 32 | |
|---|
| 33 | /** |
|---|
| 34 | * A TagListItem represents a single tag in the tags sidecolumn |
|---|
| 35 | */ |
|---|
| 36 | class TagListItem extends FeedListItem { |
|---|
| 37 | var $title; |
|---|
| 38 | var $cnt; |
|---|
| 39 | var $rlink; |
|---|
| 40 | var $rdLbl = ""; |
|---|
| 41 | var $class_ = ""; |
|---|
| 42 | var $icon; |
|---|
| 43 | function TagListItem($title,$cnt, $url) { |
|---|
| 44 | $this -> title = $title; |
|---|
| 45 | $this -> cnt = $cnt; |
|---|
| 46 | $this -> rlink = $url; |
|---|
| 47 | $this -> rdLbl = "($cnt)"; |
|---|
| 48 | $this->icon = getExternalThemeFile("media/noicon.png"); |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | function render() { |
|---|
| 52 | $GLOBALS['rss']->currentFeedsFeed = $this; |
|---|
| 53 | include($GLOBALS['rss'] ->getTemplateFile("feedsfeed.php")); |
|---|
| 54 | } |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | /** |
|---|
| 58 | * A TagList renders a list of all the tags |
|---|
| 59 | */ |
|---|
| 60 | class TagList extends FeedList{ |
|---|
| 61 | |
|---|
| 62 | var $tags; |
|---|
| 63 | var $folders = array(); |
|---|
| 64 | var $countTaggedItems = 0; |
|---|
| 65 | var $tagCount = 0; |
|---|
| 66 | |
|---|
| 67 | function TagList() { |
|---|
| 68 | $this -> populate(); |
|---|
| 69 | $this -> columnTitle = __('Tags'); |
|---|
| 70 | $GLOBALS['rss']-> feedList = $this; |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | function populate() { |
|---|
| 74 | $t = new Tags(); |
|---|
| 75 | $this -> tags = $t -> allTags; |
|---|
| 76 | $this -> folders[0] = new FeedFolder(null , null ,$this); |
|---|
| 77 | foreach ($this -> tags as $tag => $count) { |
|---|
| 78 | $this -> tagCount++; |
|---|
| 79 | $this -> countTaggedItems += $count; |
|---|
| 80 | $tt = new TagListItem($tag,$count, $t -> makeTagLink($tag) ); |
|---|
| 81 | $this->folders[0]->feeds[] = $tt; |
|---|
| 82 | } |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | function getStats() { |
|---|
| 86 | return sprintf(__('<strong>%d</strong> tagged items, in <strong>%d</strong> tags'), $this -> countTaggedItems, $this->tagCount); |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | } |
|---|
| 90 | ?> |
|---|