summaryrefslogtreecommitdiff
path: root/plugins/calendar/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/calendar/drivers')
-rw-r--r--plugins/calendar/drivers/calendar_driver.php4
-rw-r--r--plugins/calendar/drivers/database/database_driver.php8
-rw-r--r--plugins/calendar/drivers/kolab/kolab_driver.php11
3 files changed, 18 insertions, 5 deletions
diff --git a/plugins/calendar/drivers/calendar_driver.php b/plugins/calendar/drivers/calendar_driver.php
index 52de901..c09d8b9 100644
--- a/plugins/calendar/drivers/calendar_driver.php
+++ b/plugins/calendar/drivers/calendar_driver.php
@@ -236,9 +236,11 @@ abstract class calendar_driver
* @param integer Event's new end (unix timestamp)
* @param string Search query (optional)
* @param mixed List of calendar IDs to load events from (either as array or comma-separated string)
+ * @param boolean Include virtual/recurring events (optional)
+ * @param integer Only list events modified since this time (unix timestamp)
* @return array A list of event objects (see header of this file for struct of an event)
*/
- abstract function load_events($start, $end, $query = null, $calendars = null);
+ abstract function load_events($start, $end, $query = null, $calendars = null, $virtual = 1, $modifiedsince = null);
/**
* Get a list of pending alarms to be displayed to the user
diff --git a/plugins/calendar/drivers/database/database_driver.php b/plugins/calendar/drivers/database/database_driver.php
index 8cd363c..a2cb903 100644
--- a/plugins/calendar/drivers/database/database_driver.php
+++ b/plugins/calendar/drivers/database/database_driver.php
@@ -724,7 +724,7 @@ class database_driver extends calendar_driver
*
* @see calendar_driver::load_events()
*/
- public function load_events($start, $end, $query = null, $calendars = null)
+ public function load_events($start, $end, $query = null, $calendars = null, $virtual = 1, $modifiedsince = null)
{
if (empty($calendars))
$calendars = array_keys($this->calendars);
@@ -742,6 +742,12 @@ class database_driver extends calendar_driver
$sql_add = 'AND (' . join(' OR ', $sql_query) . ')';
}
+ if (!$virtual)
+ $sql_arr .= ' AND e.recurrence_id = 0';
+
+ if ($modifiedsince)
+ $sql_add .= ' AND e.changed >= ' . $this->rc->db->quote(date('Y-m-d H:i:s', $modifiedsince));
+
$events = array();
if (!empty($calendar_ids)) {
$result = $this->rc->db->query(sprintf(
diff --git a/plugins/calendar/drivers/kolab/kolab_driver.php b/plugins/calendar/drivers/kolab/kolab_driver.php
index b8171b7..0722d23 100644
--- a/plugins/calendar/drivers/kolab/kolab_driver.php
+++ b/plugins/calendar/drivers/kolab/kolab_driver.php
@@ -733,20 +733,25 @@ class kolab_driver extends calendar_driver
* @param integer Event's new end (unix timestamp)
* @param string Search query (optional)
* @param mixed List of calendar IDs to load events from (either as array or comma-separated string)
- * @param boolean Strip virtual events (optional)
+ * @param boolean Include virtual events (optional)
+ * @param integer Only list events modified since this time (unix timestamp)
* @return array A list of event records
*/
- public function load_events($start, $end, $search = null, $calendars = null, $virtual = 1)
+ public function load_events($start, $end, $search = null, $calendars = null, $virtual = 1, $modifiedsince = null)
{
if ($calendars && is_string($calendars))
$calendars = explode(',', $calendars);
+ $query = array();
+ if ($modifiedsince)
+ $query[] = array('changed', '>=', $modifiedsince);
+
$events = $categories = array();
foreach (array_keys($this->calendars) as $cid) {
if ($calendars && !in_array($cid, $calendars))
continue;
- $events = array_merge($events, $this->calendars[$cid]->list_events($start, $end, $search, $virtual));
+ $events = array_merge($events, $this->calendars[$cid]->list_events($start, $end, $search, $virtual, $query));
$categories += $this->calendars[$cid]->categories;
}