3 * StatusNet - the distributed open-source microblogging tool
4 * Copyright (C) 2008, 2009, StatusNet, Inc.
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.
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.
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/>.
20 if (!defined('GNUSOCIAL')) { exit(1); }
24 define('AVATARS_PER_PAGE', 80);
26 // @todo FIXME: Class documentation missing.
27 class GalleryAction extends ProfileAction
29 protected function handle()
31 // Post from the tag dropdown; redirect to a GET
32 if ($this->isPost()) {
33 common_redirect($this->selfUrl(), 303);
39 function showContent()
41 $this->showTagsDropdown();
44 function showTagsDropdown()
46 $tag = $this->trimmed('tag');
48 $tags = $this->getAllTags();
52 foreach ($tags as $t) {
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'));
64 common_local_url($this->trimmed('action'),
66 $this->target->getNickname()))),
67 // TRANS: List element on gallery action page to show all tags.
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()),
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');
94 // Get list of tags we tagged other users with
95 function getTags($lst, $usr)
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');
105 while ($profile_tag->fetch()) {
106 $tags[] = $profile_tag->tag;
108 $profile_tag->free();
112 function getAllTags()
117 function showProfileBlock()
119 $block = new AccountProfileBlock($this, $this->target);