3 * Laconica, the distributed open-source microblogging tool
5 * Latest groups information
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 Evan Prodromou <evan@controlyourself.ca>
25 * @author Sarven Capadisli <csarven@controlyourself.ca>
26 * @copyright 2008-2009 Control Yourself, Inc.
27 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
28 * @link http://laconi.ca/
31 if (!defined('LACONICA')) {
35 require_once INSTALLDIR.'/lib/grouplist.php';
40 * Show the latest groups on the site
44 * @author Evan Prodromou <evan@controlyourself.ca>
45 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
46 * @link http://laconi.ca/
49 class GroupsAction extends Action
54 function isReadOnly($args)
61 if ($this->page == 1) {
64 return sprintf(_("Groups, page %d"), $this->page);
68 function prepare($args)
70 parent::prepare($args);
71 $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
75 function handle($args)
77 parent::handle($args);
81 function showLocalNav()
83 $nav = new PublicGroupNav($this);
87 function showPageNotice()
90 sprintf(_('%%%%site.name%%%% groups let you find and talk with ' .
91 'people of similar interests. After you join a group ' .
92 'you can send messages to all other members using the ' .
93 'syntax "!groupname". Don\'t see a group you like? Try ' .
94 '[searching for one](%%%%action.groupsearch%%%%) or ' .
95 '[start your own!](%%%%action.newgroup%%%%)'));
96 $this->elementStart('div', 'instructions');
97 $this->raw(common_markup_to_html($notice));
98 $this->elementEnd('div');
101 function showContent()
103 $this->elementStart('p', array('id' => 'new_group'));
104 $this->element('a', array('href' => common_local_url('newgroup'),
106 _('Create a new group'));
107 $this->elementEnd('p');
109 $offset = ($this->page-1) * GROUPS_PER_PAGE;
110 $limit = GROUPS_PER_PAGE + 1;
112 $groups = new User_group();
113 $groups->orderBy('created DESC');
114 $groups->limit($offset, $limit);
116 if ($groups->find()) {
117 $gl = new GroupList($groups, null, $this);
121 $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE,
122 $this->page, 'groups');
125 function showSections()
127 $gbp = new GroupsByPostsSection($this);
129 $gbm = new GroupsByMembersSection($this);
134 * Output document relationship links
138 function showRelationshipLinks()
140 $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME
141 $this->page, 'groups', array('nickname' => $this->group->nickname));