X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fusergroups.php;h=6606e76cdb907c641bf8594dbf4fb34c66111e17;hb=e05415f621890bbaf42752577249ecdc22c161fc;hp=06b2334bf5b636801e99b32f87e7ecfc830eea2e;hpb=58dfad57576d5529b7f6538a460fa9f4bd90b40f;p=quix0rs-gnu-social.git diff --git a/actions/usergroups.php b/actions/usergroups.php index 06b2334bf5..6606e76cdb 100644 --- a/actions/usergroups.php +++ b/actions/usergroups.php @@ -1,6 +1,6 @@ . * * @category Personal - * @package Laconica - * @author Evan Prodromou - * @author Sarven Capadisli - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou + * @author Sarven Capadisli + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -40,19 +40,18 @@ require_once INSTALLDIR.'/lib/grouplist.php'; * Show the groups a user belongs to * * @category Personal - * @package Laconica - * @author Evan Prodromou + * @package StatusNet + * @author Evan Prodromou * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -class UsergroupsAction extends Action +class UsergroupsAction extends OwnerDesignAction { - var $user = null; var $page = null; var $profile = null; - function isReadOnly() + function isReadOnly($args) { return true; } @@ -60,9 +59,11 @@ class UsergroupsAction extends Action function title() { if ($this->page == 1) { - return sprintf(_("%s groups"), $this->user->nickname); + // TRANS: Message is used as a page title. %s is a nick name. + return sprintf(_('%s groups'), $this->user->nickname); } else { - return sprintf(_("%s groups, page %d"), + // TRANS: Message is used as a page title. %1$s is a nick name, %2$d is a page number. + return sprintf(_('%1$s groups, page %2$d'), $this->user->nickname, $this->page); } @@ -131,22 +132,26 @@ class UsergroupsAction extends Action _('Search for more groups')); $this->elementEnd('p'); - $offset = ($this->page-1) * GROUPS_PER_PAGE; - $limit = GROUPS_PER_PAGE + 1; + if (Event::handle('StartShowUserGroupsContent', array($this))) { + $offset = ($this->page-1) * GROUPS_PER_PAGE; + $limit = GROUPS_PER_PAGE + 1; - $groups = $this->user->getGroups($offset, $limit); + $groups = $this->user->getGroups($offset, $limit); - if ($groups) { - $gl = new GroupList($groups, $this->user, $this); - $cnt = $gl->show(); - if (0 == $cnt) { - $this->showEmptyListMessage(); + if ($groups) { + $gl = new GroupList($groups, $this->user, $this); + $cnt = $gl->show(); + if (0 == $cnt) { + $this->showEmptyListMessage(); + } } - } - $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE, - $this->page, 'usergroups', - array('nickname' => $this->user->nickname)); + $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE, + $this->page, 'usergroups', + array('nickname' => $this->user->nickname)); + + Event::handle('EndShowUserGroupsContent', array($this)); + } } function showEmptyListMessage()