123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- <?php
- if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
- }
- require_once INSTALLDIR . '/lib/groups/grouplist.php';
- class GroupsAction extends Action
- {
- var $page = null;
- var $profile = null;
- function isReadOnly($args)
- {
- return true;
- }
- function title()
- {
- if ($this->page == 1) {
-
- return _m('TITLE',"Groups");
- } else {
-
-
- return sprintf(_m('TITLE',"Groups, page %d"), $this->page);
- }
- }
- function prepare(array $args = array())
- {
- parent::prepare($args);
- $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
- return true;
- }
- function handle()
- {
- parent::handle();
- $this->showPage();
- }
- function showPageNotice()
- {
- $notice =
-
-
-
- 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%%%%)!'));
- $this->elementStart('div', 'instructions');
- $this->raw(common_markup_to_html($notice));
- $this->elementEnd('div');
- }
- function showContent()
- {
- if (common_logged_in()) {
- $this->elementStart('p', array('id' => 'new_group'));
- $this->element('a', array('href' => common_local_url('newgroup'),
- 'class' => 'more'),
-
- _('Create a new group'));
- $this->elementEnd('p');
- }
- $offset = ($this->page-1) * GROUPS_PER_PAGE;
- $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();
- $cnt = 0;
- $groups->query($qry);
- $gl = new GroupList($groups, null, $this);
- $cnt = $gl->show();
- $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE,
- $this->page, 'groups');
- }
- function showSections()
- {
- $gbp = new GroupsByPostsSection($this);
- $gbp->show();
- $gbm = new GroupsByMembersSection($this);
- $gbm->show();
- }
- }
|