function asHTML()
{
+ $event = Happening::staticGet('id', $this->event_id);
+
return self::toHTML($this->getProfile(),
- $this->getEvent(),
+ $event,
$this->response);
}
function asString()
{
+ $event = Happening::staticGet('id', $this->event_id);
+
return self::toString($this->getProfile(),
- $this->getEvent(),
+ $event,
$this->response);
}
{
$fmt = null;
- $notice = $event->getNotice();
-
switch ($response) {
case 'Y':
$fmt = _("<span class='automatic event-rsvp'><a href='%1s'>%2s</a> is attending <a href='%3s'>%4s</a>.</span>");
break;
}
+ if (empty($event)) {
+ $eventUrl = '#';
+ $eventTitle = _('an unknown event');
+ } else {
+ $notice = $event->getNotice();
+ $eventUrl = $notice->bestUrl();
+ $eventTitle = $event->title;
+ }
+
return sprintf($fmt,
htmlspecialchars($profile->profileurl),
htmlspecialchars($profile->getBestName()),
- htmlspecialchars($notice->bestUrl()),
- htmlspecialchars($event->title));
+ htmlspecialchars($eventUrl),
+ htmlspecialchars($eventTitle));
}
static function toString($profile, $event, $response)
{
$fmt = null;
- $notice = $event->getNotice();
-
switch ($response) {
case 'Y':
$fmt = _("%1s is attending %2s.");
break;
}
+ if (empty($event)) {
+ $eventTitle = _('an unknown event');
+ } else {
+ $notice = $event->getNotice();
+ $eventTitle = $event->title;
+ }
+
return sprintf($fmt,
$profile->getBestName(),
- $event->title);
+ $eventTitle);
}
}