Skip to content

Commit

Permalink
Provide desktop notification-friendly text for event alarms.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Nov 28, 2013
1 parent a27361b commit 8d58705
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion kronolith/lib/Event.php
Expand Up @@ -2080,7 +2080,17 @@ public function toAlarm($time, $user = null, $prefs = null)

$methods['mail']['mimepart'] = Kronolith::buildMimeMessage($view, 'mail', $image);
}

if (isset($methods['desktop'])) {
if ($this->isAllDay()) {
if ($this->start->compareDate($this->end) == 0) {
$methods['desktop']['subtitle'] = sprintf(_("On %s"), $this->start->strftime($prefs->getValue('date_format')));
} else {
$methods['desktop']['subtitle'] = sprintf(_("From %s to %s"), $this->start->strftime($prefs->getValue('date_format')), $this->end->strftime($prefs->getValue('date_format')));
}
} else {
$methods['desktop']['subtitle'] = sprintf(_("From %s at %s to %s at %s"), $this->start->strftime($prefs->getValue('date_format')), $this->start->format($prefs->getValue('twentyFour') ? 'H:i' : 'h:ia'), $this->end->strftime($prefs->getValue('date_format')), $this->end->format($prefs->getValue('twentyFour') ? 'H:i' : 'h:ia'));
}
}
$alarm = array(
'id' => $this->uid,
'user' => $user,
Expand Down

0 comments on commit 8d58705

Please sign in to comment.