]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/galleryaction.php
Removed plugin Google-Analytics as this is free/libre and decentralized
[quix0rs-gnu-social.git] / lib / galleryaction.php
1 <?php
2 /**
3  * StatusNet - the distributed open-source microblogging tool
4  * Copyright (C) 2008, 2009, StatusNet, Inc.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Affero General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Affero General Public License for more details.
15  *
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 if (!defined('GNUSOCIAL')) { exit(1); }
21
22 // 10x8
23
24 define('AVATARS_PER_PAGE', 80);
25
26 // @todo FIXME: Class documentation missing.
27 class GalleryAction extends ProfileAction
28 {
29     protected function handle()
30     {
31         // Post from the tag dropdown; redirect to a GET
32         if ($this->isPost()) {
33             common_redirect($this->selfUrl(), 303);
34         }
35
36         parent::handle();
37     }
38
39     function showContent()
40     {
41         $this->showTagsDropdown();
42     }
43
44     function showTagsDropdown()
45     {
46         $tag = $this->trimmed('tag');
47
48         $tags = $this->getAllTags();
49
50         $content = array();
51
52         foreach ($tags as $t) {
53             $content[$t] = $t;
54         }
55         if ($tags) {
56             $this->elementStart('dl', array('id' => 'filter_tags'));
57             $this->element('dt', null, _('Tags'));
58             $this->elementStart('dd');
59             $this->elementStart('ul');
60             $this->elementStart('li', array('id' => 'filter_tags_all',
61                                              'class' => 'child_1'));
62             $this->element('a',
63                            array('href' =>
64                                  common_local_url($this->trimmed('action'),
65                                                   array('nickname' =>
66                                                         $this->target->getNickname()))),
67                            // TRANS: List element on gallery action page to show all tags.
68                            _m('TAGS','All'));
69             $this->elementEnd('li');
70             $this->elementStart('li', array('id'=>'filter_tags_item'));
71             $this->elementStart('form', array('name' => 'bytag',
72                                                'id' => 'form_filter_bytag',
73                                               'action' => common_path('?action=' . $this->getActionName()),
74                                                'method' => 'post'));
75             $this->elementStart('fieldset');
76             // TRANS: Fieldset legend on gallery action page.
77             $this->element('legend', null, _('Select tag to filter'));
78             // TRANS: Dropdown field label on gallery action page for a list containing tags.
79             $this->dropdown('tag', _('Tag'), $content,
80                             // TRANS: Dropdown field title on gallery action page for a list containing tags.
81                             _('Choose a tag to narrow list.'), false, $tag);
82             $this->hidden('nickname', $this->target->getNickname());
83             // TRANS: Submit button text on gallery action page.
84             $this->submit('submit', _m('BUTTON','Go'));
85             $this->elementEnd('fieldset');
86             $this->elementEnd('form');
87             $this->elementEnd('li');
88             $this->elementEnd('ul');
89             $this->elementEnd('dd');
90             $this->elementEnd('dl');
91         }
92     }
93
94     // Get list of tags we tagged other users with
95     function getTags($lst, $usr)
96     {
97         $profile_tag = new Notice_tag();
98         $profile_tag->query('SELECT DISTINCT(tag) ' .
99                             'FROM profile_tag, subscription ' .
100                             'WHERE tagger = ' . $this->target->id . ' ' .
101                             'AND ' . $usr . ' = ' . $this->target->id . ' ' .
102                             'AND ' . $lst . ' = tagged ' .
103                             'AND tagger != tagged');
104         $tags = array();
105         while ($profile_tag->fetch()) {
106             $tags[] = $profile_tag->tag;
107         }
108         $profile_tag->free();
109         return $tags;
110     }
111
112     function getAllTags()
113     {
114         return array();
115     }
116
117     function showProfileBlock()
118     {
119         $block = new AccountProfileBlock($this, $this->target);
120         $block->show();
121     }
122 }