X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fgroups.php;h=1bbce26f20cf2f6ba3ca71fb9462175004f06ffc;hb=b15f5f0cafc08c9b63090c5b4f7494fca0634238;hp=3d62843ed678d54d08c9fd3ccb5ca897568a5c75;hpb=bb1548451ae39cda7a4c6212bee204a9d38e6ba7;p=quix0rs-gnu-social.git diff --git a/actions/groups.php b/actions/groups.php index 3d62843ed6..1bbce26f20 100644 --- a/actions/groups.php +++ b/actions/groups.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,18 +40,17 @@ require_once INSTALLDIR.'/lib/grouplist.php'; * Show the latest groups on the site * * @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 GroupsAction extends Action { var $page = null; var $profile = null; - function isReadOnly($args) + function isReadOnly(array $args=array()) { return true; } @@ -59,40 +58,40 @@ class GroupsAction extends Action function title() { if ($this->page == 1) { - return _("Groups"); + // TRANS: Title for first page of the groups list. + return _m('TITLE',"Groups"); } else { - return sprintf(_("Groups, page %d"), $this->page); + // TRANS: Title for all but the first page of the groups list. + // TRANS: %d is the page number. + return sprintf(_m('TITLE',"Groups, page %d"), $this->page); } } - function prepare($args) + function prepare(array $args=array()) { parent::prepare($args); $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; return true; } - function handle($args) + function handle(array $args=array()) { parent::handle($args); $this->showPage(); } - function showLocalNav() - { - $nav = new PublicGroupNav($this); - $nav->show(); - } - function showPageNotice() { $notice = + // TRANS: Page notice of group list. %%%%site.name%%%% is the StatusNet site name, + // TRANS: %%%%action.groupsearch%%%% and %%%%action.newgroup%%%% are URLs. Do not change them. + // TRANS: This message contains Markdown links in the form [link text](link). sprintf(_('%%%%site.name%%%% groups let you find and talk with ' . 'people of similar interests. After you join a group ' . 'you can send messages to all other members using the ' . 'syntax "!groupname". Don\'t see a group you like? Try ' . '[searching for one](%%%%action.groupsearch%%%%) or ' . - '[start your own!](%%%%action.newgroup%%%%)')); + '[start your own](%%%%action.newgroup%%%%)!')); $this->elementStart('div', 'instructions'); $this->raw(common_markup_to_html($notice)); $this->elementEnd('div'); @@ -104,22 +103,27 @@ class GroupsAction extends Action $this->elementStart('p', array('id' => 'new_group')); $this->element('a', array('href' => common_local_url('newgroup'), 'class' => 'more'), + // TRANS: Link to create a new group on the group list page. _('Create a new group')); $this->elementEnd('p'); } $offset = ($this->page-1) * GROUPS_PER_PAGE; - $limit = GROUPS_PER_PAGE + 1; + $limit = GROUPS_PER_PAGE + 1; + + $qry = 'SELECT user_group.* '. + 'from user_group join local_group on user_group.id = local_group.group_id '. + 'order by user_group.created desc '. + 'limit ' . $limit . ' offset ' . $offset; $groups = new User_group(); - $groups->orderBy('created DESC'); - $groups->limit($offset, $limit); $cnt = 0; - if ($groups->find()) { - $gl = new GroupList($groups, null, $this); - $cnt = $gl->show(); - } + + $groups->query($qry); + + $gl = new GroupList($groups, null, $this); + $cnt = $gl->show(); $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE, $this->page, 'groups');