123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <?php
- if (!defined('STATUSNET')) {
-
-
- exit(1);
- }
- class GroupsNav extends MoreMenu
- {
- protected $user;
- protected $groups;
- function __construct($action, $user)
- {
- parent::__construct($action);
- $this->user = $user;
- $this->groups = $user->getGroups();
- }
- function haveGroups()
- {
- return ($this->groups instanceof User_group && $this->groups->N > 0);
- }
- function tag()
- {
- return 'groups';
- }
- function getItems()
- {
- $items = array();
- while ($this->groups instanceof User_group && $this->groups->fetch()) {
- $items[] = array('placeholder',
- array('nickname' => $this->groups->getNickname(),
- 'mainpage' => $this->groups->homeUrl()),
- $this->groups->getNickname(),
- $this->groups->getBestName()
- );
- }
- return $items;
- }
- function seeAllItem() {
- return array('usergroups',
- array('nickname' => $this->user->nickname),
-
- _('See all'),
-
- _('See all groups you belong to.'));
- }
- function item($actionName, array $args, $label, $description, $id=null, $cls=null)
- {
- if ($actionName != 'placeholder') {
- return parent::item($actionName, $args, $label, $description, $id, $cls);
- }
- if (empty($id)) {
- $id = $this->menuItemID('showgroup', array('nickname' => $args['nickname']));
- }
- $url = $args['mainpage'];
- $this->out->menuItem($url,
- $label,
- $description,
- $this->isCurrent($actionName, $args),
- $id,
- $cls);
- }
- }
|