By default only display alarms from my own calendars

This commit is contained in:
Thomas 2011-07-07 08:23:49 +02:00
parent 0f26ae4e7a
commit a3045734b0
2 changed files with 18 additions and 7 deletions

View file

@ -24,6 +24,7 @@ class kolab_calendar
public $ready = false;
public $readonly = true;
public $attachments = true;
public $alarms = false;
private $cal;
private $storage;
@ -56,10 +57,11 @@ class kolab_calendar
$this->ready = !PEAR::isError($this->storage);
// Set readonly and editable flags according to folder permissions
// Set readonly and alarms flags according to folder permissions
if ($this->ready) {
if ($this->get_owner() == $_SESSION['username']) {
$this->readonly = false;
$this->alarms = true;
}
else {
$acl = $this->storage->_folder->getACL();

View file

@ -503,13 +503,22 @@ class kolab_driver extends calendar_driver
*/
public function pending_alarms($time, $calendars = null)
{
if ($calendars && is_string($calendars))
$calendars = explode(',', $calendars);
$events = array();
foreach ($this->load_events($time, $time + 86400 * 365, $calendars) as $e) {
// add to list if alarm is set
if ($e['_alarm'] && ($notifyat = $e['start'] - $e['_alarm'] * 60) <= $time) {
$id = $e['id'];
$events[$id] = $e;
$events[$id]['notifyat'] = $notifyat;
foreach ($this->calendars as $cid => $calendar) {
// skip calendars with alarms disabled
if (!$calendar->alarms || ($calendars && !in_array($cid, $calendars)))
continue;
foreach ($calendar->list_events($time, $time + 86400 * 365) as $e) {
// add to list if alarm is set
if ($e['_alarm'] && ($notifyat = $e['start'] - $e['_alarm'] * 60) <= $time) {
$id = $e['id'];
$events[$id] = $e;
$events[$id]['notifyat'] = $notifyat;
}
}
}