示例#1
0
 function showContent()
 {
     $notice = $this->nli->notice;
     $out = $this->nli->out;
     $rsvp = RSVP::fromNotice($notice);
     if (empty($rsvp)) {
         // TRANS: Content for a deleted RSVP list item (RSVP stands for "please respond").
         $out->element('p', null, _m('Deleted.'));
         return;
     }
     $out->elementStart('div', 'rsvp');
     $out->raw($rsvp->asHTML());
     $out->elementEnd('div');
     return;
 }
示例#2
0
 /**
  * Add a new event
  *
  * @return void
  */
 function newRSVP()
 {
     try {
         $saved = RSVP::saveNew($this->user->getProfile(), $this->event, $this->verb);
     } catch (ClientException $ce) {
         $this->error = $ce->getMessage();
         $this->showPage();
         return;
     }
     if ($this->boolean('ajax')) {
         $rsvp = RSVP::fromNotice($saved);
         header('Content-Type: text/xml;charset=utf-8');
         $this->xw->startDocument('1.0', 'UTF-8');
         $this->elementStart('html');
         $this->elementStart('head');
         // TRANS: Page title after creating an event.
         $this->element('title', null, _m('Event saved'));
         $this->elementEnd('head');
         $this->elementStart('body');
         $this->elementStart('body');
         $cancel = new CancelRSVPForm($rsvp, $this);
         $cancel->show();
         $this->elementEnd('body');
         $this->elementEnd('body');
         $this->elementEnd('html');
     } else {
         common_redirect($saved->bestUrl(), 303);
     }
 }
示例#3
0
 protected function showRSVP(Notice $stored, HTMLOutputter $out, Profile $scoped = null)
 {
     $rsvp = RSVP::fromNotice($stored);
     if (empty($rsvp)) {
         // TRANS: Content for a deleted RSVP list item (RSVP stands for "please respond").
         $out->element('p', null, _m('Deleted.'));
         return;
     }
     $out->elementStart('div', 'rsvp');
     $out->raw($rsvp->asHTML());
     $out->elementEnd('div');
 }
示例#4
0
 /**
  * When a notice is deleted, clean up related tables.
  *
  * @param Notice $notice
  */
 function deleteRelated($notice)
 {
     switch ($notice->object_type) {
         case Happening::OBJECT_TYPE:
             common_log(LOG_DEBUG, "Deleting event from notice...");
             $happening = Happening::fromNotice($notice);
             $happening->delete();
             break;
         case RSVP::POSITIVE:
         case RSVP::NEGATIVE:
         case RSVP::POSSIBLE:
             common_log(LOG_DEBUG, "Deleting rsvp from notice...");
             $rsvp = RSVP::fromNotice($notice);
             common_log(LOG_DEBUG, "to delete: {$rsvp->id}");
             $rsvp->delete();
             break;
         default:
             common_log(LOG_DEBUG, "Not deleting related, wtf...");
     }
 }