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('STATUSNET') && !defined('LACONICA')) {
24 require_once INSTALLDIR.'/lib/profilelist.php';
28 define('AVATARS_PER_PAGE', 80);
30 // @todo FIXME: Class documentation missing.
31 class GalleryAction extends ProfileAction
33 protected function handle()
35 // Post from the tag dropdown; redirect to a GET
36 if ($this->isPost()) {
37 common_redirect($this->selfUrl(), 303);
43 function showContent()
45 $this->showTagsDropdown();
48 function showTagsDropdown()
50 $tag = $this->trimmed('tag');
52 $tags = $this->getAllTags();
56 foreach ($tags as $t) {
60 $this->elementStart('dl', array('id' => 'filter_tags'));
61 $this->element('dt', null, _('Tags'));
62 $this->elementStart('dd');
63 $this->elementStart('ul');
64 $this->elementStart('li', array('id' => 'filter_tags_all',
65 'class' => 'child_1'));
68 common_local_url($this->trimmed('action'),
70 $this->target->getNickname()))),
71 // TRANS: List element on gallery action page to show all tags.
73 $this->elementEnd('li');
74 $this->elementStart('li', array('id'=>'filter_tags_item'));
75 $this->elementStart('form', array('name' => 'bytag',
76 'id' => 'form_filter_bytag',
77 'action' => common_path('?action=' . $this->getActionName()),
79 $this->elementStart('fieldset');
80 // TRANS: Fieldset legend on gallery action page.
81 $this->element('legend', null, _('Select tag to filter'));
82 // TRANS: Dropdown field label on gallery action page for a list containing tags.
83 $this->dropdown('tag', _('Tag'), $content,
84 // TRANS: Dropdown field title on gallery action page for a list containing tags.
85 _('Choose a tag to narrow list.'), false, $tag);
86 $this->hidden('nickname', $this->target->getNickname());
87 // TRANS: Submit button text on gallery action page.
88 $this->submit('submit', _m('BUTTON','Go'));
89 $this->elementEnd('fieldset');
90 $this->elementEnd('form');
91 $this->elementEnd('li');
92 $this->elementEnd('ul');
93 $this->elementEnd('dd');
94 $this->elementEnd('dl');
98 // Get list of tags we tagged other users with
99 function getTags($lst, $usr)
101 $profile_tag = new Notice_tag();
102 $profile_tag->query('SELECT DISTINCT(tag) ' .
103 'FROM profile_tag, subscription ' .
104 'WHERE tagger = ' . $this->target->id . ' ' .
105 'AND ' . $usr . ' = ' . $this->target->id . ' ' .
106 'AND ' . $lst . ' = tagged ' .
107 'AND tagger != tagged');
109 while ($profile_tag->fetch()) {
110 $tags[] = $profile_tag->tag;
112 $profile_tag->free();
116 function getAllTags()
121 function showProfileBlock()
123 $block = new AccountProfileBlock($this, $this->target);