function showActions()
 {
     $cur = common_current_user();
     $this->out->elementStart('div', 'entity_actions');
     // TRANS: Group actions header (h2). Text hidden by default.
     $this->out->element('h2', null, _('Group actions'));
     $this->out->elementStart('ul');
     if (Event::handle('StartGroupActionsList', array($this, $this->group))) {
         $this->out->elementStart('li', 'entity_subscribe');
         if (Event::handle('StartGroupSubscribe', array($this, $this->group))) {
             if ($cur) {
                 $profile = $cur->getProfile();
                 if ($profile->isMember($this->group)) {
                     $lf = new LeaveForm($this->out, $this->group);
                     $lf->show();
                 } else {
                     if ($profile->isPendingMember($this->group)) {
                         $cf = new CancelGroupForm($this->out, $this->group);
                         $cf->show();
                     } else {
                         if (!Group_block::isBlocked($this->group, $profile)) {
                             $jf = new JoinForm($this->out, $this->group);
                             $jf->show();
                         }
                     }
                 }
             }
             Event::handle('EndGroupSubscribe', array($this, $this->group));
         }
         $this->out->elementEnd('li');
         if ($cur && $cur->hasRight(Right::DELETEGROUP)) {
             $this->out->elementStart('li', 'entity_delete');
             $df = new DeleteGroupForm($this->out, $this->group);
             $df->show();
             $this->out->elementEnd('li');
         }
         Event::handle('EndGroupActionsList', array($this, $this->group));
     }
     $this->out->elementEnd('ul');
     $this->out->elementEnd('div');
 }
Esempio n. 2
0
 /**
  * Show the group profile
  *
  * Information about the group
  *
  * @return void
  */
 function showGroupProfile()
 {
     $this->elementStart('div', array('id' => 'i', 'class' => 'entity_profile vcard author'));
     $this->element('h2', null, _('Group profile'));
     $this->elementStart('dl', 'entity_depiction');
     $this->element('dt', null, _('Avatar'));
     $this->elementStart('dd');
     $logo = $this->group->homepage_logo ? $this->group->homepage_logo : User_group::defaultLogo(AVATAR_PROFILE_SIZE);
     $this->element('img', array('src' => $logo, 'class' => 'photo avatar', 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, 'alt' => $this->group->nickname));
     $this->elementEnd('dd');
     $this->elementEnd('dl');
     $this->elementStart('dl', 'entity_nickname');
     $this->element('dt', null, _('Nickname'));
     $this->elementStart('dd');
     $hasFN = $this->group->fullname ? 'nickname url uid' : 'fn org nickname url uid';
     $this->element('a', array('href' => $this->group->homeUrl(), 'rel' => 'me', 'class' => $hasFN), $this->group->nickname);
     $this->elementEnd('dd');
     $this->elementEnd('dl');
     if ($this->group->fullname) {
         $this->elementStart('dl', 'entity_fn');
         $this->element('dt', null, _('Full name'));
         $this->elementStart('dd');
         $this->element('span', 'fn org', $this->group->fullname);
         $this->elementEnd('dd');
         $this->elementEnd('dl');
     }
     if ($this->group->location) {
         $this->elementStart('dl', 'entity_location');
         $this->element('dt', null, _('Location'));
         $this->element('dd', 'label', $this->group->location);
         $this->elementEnd('dl');
     }
     if ($this->group->homepage) {
         $this->elementStart('dl', 'entity_url');
         $this->element('dt', null, _('URL'));
         $this->elementStart('dd');
         $this->element('a', array('href' => $this->group->homepage, 'rel' => 'me', 'class' => 'url'), $this->group->homepage);
         $this->elementEnd('dd');
         $this->elementEnd('dl');
     }
     if ($this->group->description) {
         $this->elementStart('dl', 'entity_note');
         $this->element('dt', null, _('Note'));
         $this->element('dd', 'note', $this->group->description);
         $this->elementEnd('dl');
     }
     if (common_config('group', 'maxaliases') > 0) {
         $aliases = $this->group->getAliases();
         if (!empty($aliases)) {
             $this->elementStart('dl', 'entity_aliases');
             $this->element('dt', null, _('Aliases'));
             $this->element('dd', 'aliases', implode(' ', $aliases));
             $this->elementEnd('dl');
         }
     }
     $this->elementEnd('div');
     $cur = common_current_user();
     $this->elementStart('div', 'entity_actions');
     $this->element('h2', null, _('Group actions'));
     $this->elementStart('ul');
     $this->elementStart('li', 'entity_subscribe');
     if (Event::handle('StartGroupSubscribe', array($this, $this->group))) {
         if ($cur) {
             if ($cur->isMember($this->group)) {
                 $lf = new LeaveForm($this, $this->group);
                 $lf->show();
             } else {
                 if (!Group_block::isBlocked($this->group, $cur->getProfile())) {
                     $jf = new JoinForm($this, $this->group);
                     $jf->show();
                 }
             }
         }
         Event::handle('EndGroupSubscribe', array($this, $this->group));
     }
     $this->elementEnd('li');
     if ($cur && $cur->hasRight(Right::DELETEGROUP)) {
         $this->elementStart('li', 'entity_delete');
         $df = new DeleteGroupForm($this, $this->group);
         $df->show();
         $this->elementEnd('li');
     }
     $this->elementEnd('ul');
     $this->elementEnd('div');
 }
Esempio n. 3
0
 function showActions()
 {
     $cur = common_current_user();
     $this->out->elementStart('div', 'entity_actions');
     // TRANS: Group actions header (h2). Text hidden by default.
     $this->out->element('h2', null, _('Group actions'));
     $this->out->elementStart('ul');
     if (Event::handle('StartGroupActionsList', array($this, $this->group))) {
         $this->out->elementStart('li', 'entity_subscribe');
         if (Event::handle('StartGroupSubscribe', array($this, $this->group))) {
             if ($cur) {
                 $profile = $cur->getProfile();
                 if ($profile->isMember($this->group)) {
                     $lf = new LeaveForm($this->out, $this->group);
                     $lf->show();
                 } else {
                     if ($profile->isPendingMember($this->group)) {
                         $cf = new CancelGroupForm($this->out, $this->group);
                         $cf->show();
                     } else {
                         if (!Group_block::isBlocked($this->group, $profile)) {
                             $jf = new JoinForm($this->out, $this->group);
                             $jf->show();
                         }
                     }
                 }
             }
             Event::handle('EndGroupSubscribe', array($this, $this->group));
         }
         $this->out->elementEnd('li');
         if ($cur && $cur->isAdmin($this->group)) {
             $this->out->elementStart('li', 'entity_edit');
             $this->out->element('a', array('href' => common_local_url('editgroup', array('nickname' => $this->group->nickname)), 'title' => sprintf(_m('TOOLTIP', 'Edit %s group properties'), $this->group->nickname)), _m('BUTTON', 'Edit'));
             $this->out->elementEnd('li');
             $this->out->elementStart('li', 'entity_edit');
             $this->out->element('a', array('href' => common_local_url('grouplogo', array('nickname' => $this->group->nickname)), 'title' => sprintf(_m('TOOLTIP', 'Add or edit %s logo'), $this->group->nickname)), _m('MENU', 'Logo'));
             $this->out->elementEnd('li');
         }
         if ($cur && $cur->hasRight(Right::DELETEGROUP)) {
             $this->out->elementStart('li', 'entity_delete');
             $df = new DeleteGroupForm($this->out, $this->group);
             $df->show();
             $this->out->elementEnd('li');
         }
         Event::handle('EndGroupActionsList', array($this, $this->group));
     }
     $this->out->elementEnd('ul');
     $this->out->elementEnd('div');
 }
 function endActions()
 {
     // delete button
     $cur = common_current_user();
     list($action, $r2args) = $this->out->returnToArgs();
     $r2args['action'] = $action;
     if ($cur instanceof User && $cur->hasRight(Right::DELETEGROUP)) {
         $this->out->elementStart('li', 'entity_delete');
         $df = new DeleteGroupForm($this->out, $this->profile->getGroup(), $r2args);
         $df->show();
         $this->out->elementEnd('li');
     }
     $this->out->elementEnd('ul');
     $this->out->elementEnd('td');
 }