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/
49 class PeopletagSection extends Section
51 function showContent()
53 $tags = $this->getPeopletags();
61 $this->out->elementStart('table', 'peopletag_section');
63 while ($tags->fetch() && ++$cnt <= PEOPLETAGS_PER_SECTION) {
64 $this->showPeopletag($tags);
67 $this->out->elementEnd('table');
69 return ($cnt > PEOPLETAGS_PER_SECTION);
72 function getPeopletags()
77 function showPeopletag($peopletag)
79 $tag = new PeopletagSectionItem($peopletag, null, $this->out);
84 class PeopletagSectionItem extends PeopletagListItem
94 function showPeopletag()
103 if (empty($this->peopletag)) {
104 common_log(LOG_WARNING, "Trying to show missing peopletag; skipping.");
107 $mode = ($this->peopletag->private) ? 'private' : 'public';
109 $this->out->elementStart('tr');
111 $this->out->elementStart('td', 'peopletag mode-' . $mode);
112 $this->showPeopletag();
113 $this->out->elementEnd('td');
115 if (isset($this->peopletag->value)) {
116 $this->out->element('td', 'value', $this->peopletag->value);
118 $this->out->elementEnd('tr');
123 // TRANS: List summary. %1$d is the number of users in the list,
124 // TRANS: %2$d is the number of subscribers to the list.
125 $title = sprintf(_('Listed: %1$d Subscribers: %2$d'),
126 $this->peopletag->taggedCount(),
127 $this->peopletag->subscriberCount());
129 $this->out->elementStart('span', 'entry-title tag');
131 $this->out->element('a',
132 array('rel' => 'bookmark',
133 'href' => $this->url(),
135 htmlspecialchars($this->peopletag->tag));
136 $this->out->elementEnd('span');
139 function showAvatar()
141 parent::showAvatar(AVATAR_MINI_SIZE);