return $block->count();
}
+ function getQueueCount()
+ {
+ // XXX: WORM cache this
+
+ $queue = new Group_join_queue();
+ $queue->group_id = $this->id;
+
+ return $queue->count();
+ }
+
function getAdmins($offset=0, $limit=null)
{
$qry =
$this->showMembers();
$cur = common_current_user();
if ($cur && $cur->isAdmin($this->group)) {
+ $this->showPending();
$this->showBlocked();
}
$this->showAdmins();
$this->elementEnd('div');
}
+
+ function showPending()
+ {
+ if ($this->group->join_policy != User_group::JOIN_POLICY_MODERATE) {
+ return;
+ }
+
+ $pending = $this->group->getQueueCount();
+
+ if (!$pending) {
+ return;
+ }
+
+ $request = $this->group->getRequests(0, MEMBERS_PER_SECTION);
+
+ if (!$request) {
+ return;
+ }
+
+ $this->elementStart('div', array('id' => 'entity_pending',
+ 'class' => 'section'));
+
+ if (Event::handle('StartShowGroupPendingMiniList', array($this))) {
+
+ $this->elementStart('h2');
+
+ $this->element('a', array('href' => common_local_url('groupqueue', array('nickname' =>
+ $this->group->nickname))),
+ _('Pending'));
+
+ $this->text(' ');
+
+ $this->text($pending);
+
+ $this->elementEnd('h2');
+
+ $gmml = new ProfileMiniList($request, $this);
+ $gmml->show();
+
+ Event::handle('EndShowGroupPendingMiniList', array($this));
+ }
+
+ $this->elementEnd('div');
+ }
+
function showBlocked()
{
- $member = $this->group->getBlocked(0, MEMBERS_PER_SECTION);
+ $blocked = $this->group->getBlocked(0, MEMBERS_PER_SECTION);
- if (!$member) {
+ if (!$blocked) {
return;
}
$this->elementEnd('h2');
- $gmml = new GroupBlockedMiniList($member, $this);
+ $gmml = new GroupBlockedMiniList($blocked, $this);
$cnt = $gmml->show();
if ($cnt == 0) {
// TRANS: Description for mini list of group members on a group page when the group has no members.
$cur = common_current_user();
if ($cur && $cur->isAdmin($this->group)) {
- $pending = $this->countPendingMembers();
- if ($pending || $this->group->join_policy == User_group::JOIN_POLICY_MODERATE) {
- $this->out->menuItem(common_local_url('groupqueue', array('nickname' =>
- $nickname)),
- // TRANS: Menu item in the group navigation page. Only shown for group administrators.
- // TRANS: %d is the number of pending members.
- sprintf(_m('MENU','Pending members (%d)','Pending members (%d)',$pending), $pending),
- // TRANS: Tooltip for menu item in the group navigation page. Only shown for group administrators.
- // TRANS: %s is the nickname of the group.
- sprintf(_m('TOOLTIP','%s pending members'), $nickname),
- $action_name == 'groupqueue',
- 'nav_group_pending');
- }
}
Event::handle('EndGroupGroupNav', array($this));
}