3 * StatusNet, the distributed open-source microblogging tool
5 * Base class for sections showing lists of peopletags
9 * LICENCE: This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * @author Shashi Gowda <connect2shashi@gmail.com>
25 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
26 * @link http://status.net/
29 if (!defined('STATUSNET') && !defined('LACONICA')) {
33 require_once INSTALLDIR . '/lib/peopletaglist.php';
35 define('PEOPLETAGS_PER_SECTION', 6);
38 * Base class for sections
40 * These are the widgets that show interesting data about a person
45 * @author Shashi Gowda <connect2shashi@gmail.com>
46 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
47 * @link http://status.net/
50 class PeopletagSection extends Section
52 function showContent()
54 $tags = $this->getPeopletags();
62 $this->out->elementStart('table', 'peopletag_section');
64 while ($tags->fetch() && ++$cnt <= PEOPLETAGS_PER_SECTION) {
65 $this->showPeopletag($tags);
68 $this->out->elementEnd('table');
70 return ($cnt > PEOPLETAGS_PER_SECTION);
73 function getPeopletags()
78 function showPeopletag($peopletag)
80 $tag = new PeopletagSectionItem($peopletag, null, $this->out);
85 class PeopletagSectionItem extends PeopletagListItem
95 function showPeopletag()
104 if (empty($this->peopletag)) {
105 common_log(LOG_WARNING, "Trying to show missing peopletag; skipping.");
109 $this->out->elementStart('tr');
111 $this->out->elementStart('td', 'peopletag');
112 $this->showPeopletag();
113 $this->out->elementEnd('td');
115 if ($this->peopletag->value) {
116 $this->out->element('td', 'value', $this->peopletag->value);
118 $this->out->elementEnd('tr');
123 $title = _('Tagged: ') . $this->peopletag->taggedCount() .
124 ' ' . _('Subscribers: ') . $this->peopletag->subscriberCount();
126 $this->out->elementStart('span', 'entry-title tag');
127 $this->out->element('a',
128 array('rel' => 'bookmark',
129 'href' => $this->url(),
131 htmlspecialchars($this->peopletag->tag));
132 $this->out->elementEnd('span');
135 function showAvatar()
137 parent::showAvatar(AVATAR_MINI_SIZE);