2009-01-23 05:17:05 +09:00
|
|
|
<?php
|
2020-08-11 01:29:04 +09:00
|
|
|
// This file is part of GNU social - https://www.gnu.org/software/social
|
|
|
|
//
|
|
|
|
// GNU social is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// GNU social is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2009-01-23 05:17:05 +09:00
|
|
|
/**
|
|
|
|
* Groups with the most posts section
|
|
|
|
*
|
|
|
|
* @category Widget
|
2020-08-11 01:29:04 +09:00
|
|
|
* @package GNUsocial
|
2009-08-26 07:19:04 +09:00
|
|
|
* @author Evan Prodromou <evan@status.net>
|
2009-08-26 07:12:20 +09:00
|
|
|
* @copyright 2009 StatusNet, Inc.
|
2020-08-11 01:29:04 +09:00
|
|
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
2009-01-23 05:17:05 +09:00
|
|
|
*/
|
|
|
|
|
2020-08-11 01:29:04 +09:00
|
|
|
defined('GNUSOCIAL') || die();
|
2009-01-23 05:17:05 +09:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Groups with the most posts section
|
|
|
|
*
|
2020-08-11 01:29:04 +09:00
|
|
|
* @category Widget
|
|
|
|
* @package GNUsocial
|
|
|
|
* @author Evan Prodromou <evan@status.net>
|
|
|
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
2009-01-23 05:17:05 +09:00
|
|
|
*/
|
|
|
|
class GroupsByPostsSection extends GroupSection
|
|
|
|
{
|
2020-08-11 01:29:04 +09:00
|
|
|
public function getGroups()
|
2009-01-23 05:17:05 +09:00
|
|
|
{
|
2019-09-11 16:12:49 +09:00
|
|
|
$limit = GROUPS_PER_SECTION;
|
|
|
|
|
2020-08-11 01:29:04 +09:00
|
|
|
$qry = <<<END
|
|
|
|
SELECT *
|
|
|
|
FROM user_group INNER JOIN (
|
|
|
|
SELECT group_id AS id, COUNT(group_id) AS value
|
|
|
|
FROM group_inbox
|
|
|
|
GROUP BY group_id
|
|
|
|
) AS t1 USING (id)
|
|
|
|
ORDER BY value DESC LIMIT {$limit};
|
|
|
|
END;
|
2009-01-23 05:17:05 +09:00
|
|
|
|
2020-08-11 01:29:04 +09:00
|
|
|
$group = Memcached_DataObject::cachedQuery('User_group', $qry, 3600);
|
2009-01-23 05:17:05 +09:00
|
|
|
return $group;
|
|
|
|
}
|
|
|
|
|
2020-08-11 01:29:04 +09:00
|
|
|
public function title()
|
2009-01-23 05:17:05 +09:00
|
|
|
{
|
2010-10-21 10:10:46 +09:00
|
|
|
// TRANS: Title for groups with the most posts section.
|
2011-04-15 07:16:27 +09:00
|
|
|
return _('Active groups');
|
2009-01-23 05:17:05 +09:00
|
|
|
}
|
|
|
|
|
2020-08-11 01:29:04 +09:00
|
|
|
public function divId()
|
2009-01-23 05:17:05 +09:00
|
|
|
{
|
|
|
|
return 'top_groups_by_post';
|
|
|
|
}
|
|
|
|
}
|