Beispiel #1
0
 function showSubscriptions()
 {
     $profile = $this->user->getSubscriptions(0, PROFILES_PER_MINILIST + 1);
     $this->elementStart('div', array('id' => 'entity_subscriptions', 'class' => 'section'));
     if (Event::handle('StartShowSubscriptionsMiniList', array($this))) {
         $this->element('h2', null, _('关注的用户'));
         $cnt = 0;
         if (!empty($profile)) {
             $pml = new ProfileMiniList($profile, $this);
             $cnt = $pml->show();
             if ($cnt == 0) {
                 $this->element('p', null, _('(无)'));
             }
         }
         if ($cnt > PROFILES_PER_MINILIST) {
             $this->elementStart('p');
             $this->element('a', array('href' => common_local_url('subscriptions', array('nickname' => $this->profile->nickname)), 'class' => 'more'), _('查看全部'));
             $this->elementEnd('p');
         }
         Event::handle('EndShowSubscriptionsMiniList', array($this));
     }
     $this->elementEnd('div');
 }
Beispiel #2
0
 function showSubscribers()
 {
     $profile = $this->user->getSubscribers(0, PROFILES_PER_MINILIST + 1);
     $this->elementStart('div', array('id' => 'entity_subscribers', 'class' => 'section'));
     $this->element('h2', null, _('Subscribers'));
     if ($profile) {
         $pml = new ProfileMiniList($profile, $this->user, $this);
         $cnt = $pml->show();
         if ($cnt == 0) {
             $this->element('p', null, _('(None)'));
         }
     }
     if ($cnt > PROFILES_PER_MINILIST) {
         $this->elementStart('p');
         $this->element('a', array('href' => common_local_url('subscribers', array('nickname' => $this->profile->nickname)), 'class' => 'more'), _('All subscribers'));
         $this->elementEnd('p');
     }
     $this->elementEnd('div');
 }
Beispiel #3
0
 protected function showEvent(Notice $stored, HTMLOutputter $out, Profile $scoped = null)
 {
     $profile = $stored->getProfile();
     $event = Happening::fromNotice($stored);
     if (!$event instanceof Happening) {
         // TRANS: Content for a deleted RSVP list item (RSVP stands for "please respond").
         $out->element('p', null, _m('Deleted.'));
         return;
     }
     $out->elementStart('div', 'h-event');
     $out->elementStart('h3', 'p-summary p-name');
     try {
         $out->element('a', array('href' => $event->getUrl()), $event->title);
     } catch (InvalidUrlException $e) {
         $out->text($event->title);
     }
     $out->elementEnd('h3');
     $now = new DateTime();
     $startDate = new DateTime($event->start_time);
     $endDate = new DateTime($event->end_time);
     $userTz = new DateTimeZone(common_timezone());
     // Localize the time for the observer
     $now->setTimeZone($userTz);
     $startDate->setTimezone($userTz);
     $endDate->setTimezone($userTz);
     $thisYear = $now->format('Y');
     $startYear = $startDate->format('Y');
     $endYear = $endDate->format('Y');
     $dateFmt = 'D, F j, ';
     // e.g.: Mon, Aug 31
     if ($startYear != $thisYear || $endYear != $thisYear) {
         $dateFmt .= 'Y,';
         // append year if we need to think about years
     }
     $startDateStr = $startDate->format($dateFmt);
     $endDateStr = $endDate->format($dateFmt);
     $timeFmt = 'g:ia';
     $startTimeStr = $startDate->format($timeFmt);
     $endTimeStr = $endDate->format("{$timeFmt} (T)");
     $out->elementStart('div', 'event-times');
     // VEVENT/EVENT-TIMES IN
     // TRANS: Field label for event description.
     $out->element('strong', null, _m('Time:'));
     $out->element('time', array('class' => 'dt-start', 'datetime' => common_date_iso8601($event->start_time)), $startDateStr . ' ' . $startTimeStr);
     $out->text(' – ');
     $out->element('time', array('class' => 'dt-end', 'datetime' => common_date_iso8601($event->end_time)), $startDateStr != $endDateStr ? "{$endDateStr} {$endTimeStr}" : $endTimeStr);
     $out->elementEnd('div');
     // VEVENT/EVENT-TIMES OUT
     if (!empty($event->location)) {
         $out->elementStart('div', 'event-location');
         // TRANS: Field label for event description.
         $out->element('strong', null, _m('Location:'));
         $out->element('span', 'p-location', $event->location);
         $out->elementEnd('div');
     }
     if (!empty($event->description)) {
         $out->elementStart('div', 'event-description');
         // TRANS: Field label for event description.
         $out->element('strong', null, _m('Description:'));
         $out->element('div', 'p-description', $event->description);
         $out->elementEnd('div');
     }
     $rsvps = $event->getRSVPs();
     $out->elementStart('div', 'event-rsvps');
     // TRANS: Field label for event description.
     $out->element('strong', null, _m('Attending:'));
     $out->elementStart('ul', 'attending-list');
     foreach ($rsvps as $verb => $responses) {
         $out->elementStart('li', 'rsvp-list');
         switch ($verb) {
             case RSVP::POSITIVE:
                 $out->text(_('Yes:'));
                 break;
             case RSVP::NEGATIVE:
                 $out->text(_('No:'));
                 break;
             case RSVP::POSSIBLE:
                 $out->text(_('Maybe:'));
                 break;
         }
         $ids = array();
         foreach ($responses as $response) {
             $ids[] = $response->profile_id;
         }
         $ids = array_slice($ids, 0, ProfileMiniList::MAX_PROFILES + 1);
         $minilist = new ProfileMiniList(Profile::multiGet('id', $ids), $out);
         $minilist->show();
         $out->elementEnd('li');
     }
     $out->elementEnd('ul');
     $out->elementEnd('div');
     if ($scoped instanceof Profile) {
         $rsvp = $event->getRSVP($scoped);
         if (empty($rsvp)) {
             $form = new RSVPForm($event, $out);
         } else {
             $form = new CancelRSVPForm($rsvp, $out);
         }
         $form->show();
     }
     $out->elementEnd('div');
 }
Beispiel #4
0
 function showSubscriptions()
 {
     $profile = $this->profile->getSubscriptions(0, PROFILES_PER_MINILIST + 1);
     $this->elementStart('div', array('id' => 'entity_subscriptions', 'class' => 'section'));
     if (Event::handle('StartShowSubscriptionsMiniList', array($this))) {
         $this->elementStart('h2');
         // TRANS: H2 text for user subscription statistics.
         $this->statsSectionLink('subscriptions', _('Following'));
         $this->text(' ');
         $this->text($this->profile->subscriptionCount());
         $this->elementEnd('h2');
         $cnt = 0;
         if (!empty($profile)) {
             $pml = new ProfileMiniList($profile, $this);
             $cnt = $pml->show();
             if ($cnt == 0) {
                 // TRANS: Text for user subscription statistics if the user has no subscriptions.
                 $this->element('p', null, _('(None)'));
             }
         }
         Event::handle('EndShowSubscriptionsMiniList', array($this));
     }
     $this->elementEnd('div');
 }
Beispiel #5
0
 function showContent()
 {
     $notice = $this->nli->notice;
     $out = $this->nli->out;
     $profile = $notice->getProfile();
     $event = Happening::fromNotice($notice);
     if (empty($event)) {
         // TRANS: Content for a deleted RSVP list item (RSVP stands for "please respond").
         $out->element('p', null, _m('Deleted.'));
         return;
     }
     $out->elementStart('div', 'vevent event');
     // VEVENT IN
     $out->elementStart('h3');
     // VEVENT/H3 IN
     if (!empty($event->url)) {
         $out->element('a', array('href' => $event->url, 'class' => 'event-title entry-title summary'), $event->title);
     } else {
         $out->text($event->title);
     }
     $out->elementEnd('h3');
     // VEVENT/H3 OUT
     $now = new DateTime();
     $startDate = new DateTime($event->start_time);
     $endDate = new DateTime($event->end_time);
     $userTz = new DateTimeZone(common_timezone());
     // Localize the time for the observer
     $now->setTimeZone($userTz);
     $startDate->setTimezone($userTz);
     $endDate->setTimezone($userTz);
     $thisYear = $now->format('Y');
     $startYear = $startDate->format('Y');
     $endYear = $endDate->format('Y');
     $dateFmt = 'D, F j, ';
     // e.g.: Mon, Aug 31
     if ($startYear != $thisYear || $endYear != $thisYear) {
         $dateFmt .= 'Y,';
         // append year if we need to think about years
     }
     $startDateStr = $startDate->format($dateFmt);
     $endDateStr = $endDate->format($dateFmt);
     $timeFmt = 'g:ia';
     $startTimeStr = $startDate->format($timeFmt);
     $endTimeStr = $endDate->format("{$timeFmt} (T)");
     $out->elementStart('div', 'event-times');
     // VEVENT/EVENT-TIMES IN
     // TRANS: Field label for event description.
     $out->element('strong', null, _m('Time:'));
     $out->element('abbr', array('class' => 'dtstart', 'title' => common_date_iso8601($event->start_time)), $startDateStr . ' ' . $startTimeStr);
     $out->text(' – ');
     if ($startDateStr == $endDateStr) {
         $out->element('span', array('class' => 'dtend', 'title' => common_date_iso8601($event->end_time)), $endTimeStr);
     } else {
         $out->element('span', array('class' => 'dtend', 'title' => common_date_iso8601($event->end_time)), $endDateStr . ' ' . $endTimeStr);
     }
     $out->elementEnd('div');
     // VEVENT/EVENT-TIMES OUT
     if (!empty($event->location)) {
         $out->elementStart('div', 'event-location');
         // TRANS: Field label for event description.
         $out->element('strong', null, _m('Location:'));
         $out->element('span', 'location', $event->location);
         $out->elementEnd('div');
     }
     if (!empty($event->description)) {
         $out->elementStart('div', 'event-description');
         // TRANS: Field label for event description.
         $out->element('strong', null, _m('Description:'));
         $out->element('span', 'description', $event->description);
         $out->elementEnd('div');
     }
     $rsvps = $event->getRSVPs();
     $out->elementStart('div', 'event-rsvps');
     // TRANS: Field label for event description.
     $out->text(_m('Attending:'));
     $out->elementStart('ul', 'attending-list');
     foreach ($rsvps as $verb => $responses) {
         $out->elementStart('li', 'rsvp-list');
         switch ($verb) {
             case RSVP::POSITIVE:
                 $out->text(_m('Yes:'));
                 break;
             case RSVP::NEGATIVE:
                 $out->text(_('No:'));
                 break;
             case RSVP::POSSIBLE:
                 $out->text(_m('Maybe:'));
                 break;
         }
         $ids = array();
         foreach ($responses as $response) {
             $ids[] = $response->profile_id;
         }
         $ids = array_slice($ids, 0, ProfileMiniList::MAX_PROFILES + 1);
         $profiles = Profile::pivotGet('id', $ids);
         $profile = new ArrayWrapper(array_values($profiles));
         $minilist = new ProfileMiniList($profile, $out);
         $minilist->show();
         $out->elementEnd('li');
     }
     $out->elementEnd('ul');
     $out->elementEnd('div');
     $user = common_current_user();
     if (!empty($user)) {
         $rsvp = $event->getRSVP($user->getProfile());
         if (empty($rsvp)) {
             $form = new RSVPForm($event, $out);
         } else {
             $form = new CancelRSVPForm($rsvp, $out);
         }
         $form->show();
     }
     $out->elementEnd('div');
     // vevent out
 }
 function showSubscribers()
 {
     $profile = $this->peopletag->getSubscribers(0, PROFILES_PER_MINILIST + 1);
     $this->elementStart('div', array('id' => 'entity_subscribers', 'class' => 'section'));
     if (Event::handle('StartShowProfileTagSubscribersMiniList', array($this))) {
         // TRANS: Header for tag subscribers.
         $this->element('h2', null, _('Subscribers'));
         $cnt = 0;
         if (!empty($profile)) {
             $pml = new ProfileMiniList($profile, $this);
             $cnt = $pml->show();
             if ($cnt == 0) {
                 // TRANS: Content of "People following tag x" if there are no subscribed users.
                 $this->element('p', null, _('(None)'));
             }
         }
         // FIXME: link to full list
         Event::handle('EndShowProfileTagSubscribersMiniList', array($this));
     }
     $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');
 }
Beispiel #8
0
 /**
  * Show mini-list of members
  *
  * @return void
  */
 function showMembers()
 {
     $member = $this->group->getMembers(0, MEMBERS_PER_SECTION);
     if (!$member) {
         return;
     }
     $this->elementStart('div', array('id' => 'entity_members', 'class' => 'section'));
     $this->element('h2', null, _('Members'));
     $pml = new ProfileMiniList($member, null, $this);
     $cnt = $pml->show();
     if ($cnt == 0) {
         $this->element('p', null, _('(None)'));
     }
     if ($cnt == MEMBERS_PER_SECTION) {
         $this->element('a', array('href' => common_local_url('groupmembers', array('nickname' => $this->group->nickname))), _('All members'));
     }
     $this->elementEnd('div');
 }
 function showSubscribers()
 {
     $profile = $this->peopletag->getSubscribers(0, PROFILES_PER_MINILIST + 1);
     $this->elementStart('div', array('id' => 'entity_subscribers', 'class' => 'section'));
     if (Event::handle('StartShowProfileTagSubscribersMiniList', array($this))) {
         // TRANS: Header for tag subscribers.
         $this->element('h2', null, _('Subscribers'));
         $cnt = 0;
         if (!empty($profile)) {
             $pml = new ProfileMiniList($profile, $this);
             $cnt = $pml->show();
             if ($cnt == 0) {
                 // TRANS: Content of "People following tag x" if there are no subscribed users.
                 $this->element('p', null, _('(None)'));
             }
         }
         if ($cnt > PROFILES_PER_MINILIST) {
             $this->elementStart('p');
             $this->element('a', array('href' => common_local_url('profiletagsubscribers', array('nickname' => $this->tagger->nickname, 'profiletag' => $this->peopletag->tag)), 'class' => 'more'), _('All subscribers'));
             $this->elementEnd('p');
         }
         Event::handle('EndShowProfileTagSubscribersMiniList', array($this));
     }
     $this->elementEnd('div');
 }