Merge branch 'master' of ssh://git.kolabsys.com/git/roundcube

This commit is contained in:
Aleksander Machniak (Kolab Systems) 2011-07-19 15:21:12 +02:00
commit d0111b6e01
3 changed files with 9 additions and 7 deletions

View file

@ -582,7 +582,7 @@ class calendar extends rcube_plugin
} }
/** /**
* * Construct the ics file for exporting events to iCalendar format;
*/ */
function export_events() function export_events()
{ {
@ -590,7 +590,7 @@ class calendar extends rcube_plugin
$end = get_input_value('end', RCUBE_INPUT_GET); $end = get_input_value('end', RCUBE_INPUT_GET);
if (!$start) $start = mktime(0, 0, 0, 1, date('n'), date('Y')-1); if (!$start) $start = mktime(0, 0, 0, 1, date('n'), date('Y')-1);
if (!$end) $end = mktime(0, 0, 0, 31, 12, date('Y')+10); if (!$end) $end = mktime(0, 0, 0, 31, 12, date('Y')+10);
$events = $this->driver->load_events($start, $end, get_input_value('source', RCUBE_INPUT_GET)); $events = $this->driver->load_events($start, $end, null, get_input_value('source', RCUBE_INPUT_GET), 0);
header("Content-Type: text/calendar"); header("Content-Type: text/calendar");
header("Content-Disposition: inline; filename=calendar.ics"); header("Content-Disposition: inline; filename=calendar.ics");

View file

@ -191,9 +191,10 @@ class kolab_calendar
* @param integer Event's new start (unix timestamp) * @param integer Event's new start (unix timestamp)
* @param integer Event's new end (unix timestamp) * @param integer Event's new end (unix timestamp)
* @param string Search query (optional) * @param string Search query (optional)
* @param boolean Strip virtual events (optional)
* @return array A list of event records * @return array A list of event records
*/ */
public function list_events($start, $end, $search = null) public function list_events($start, $end, $search = null, $virtual = 1)
{ {
$this->_fetch_events(); $this->_fetch_events();
@ -224,7 +225,7 @@ class kolab_calendar
} }
// resolve recurring events // resolve recurring events
if ($event['recurrence']) { if ($event['recurrence'] && $virtual == 1) {
$events = array_merge($events, $this->_get_recurring_events($event, $start, $end)); $events = array_merge($events, $this->_get_recurring_events($event, $start, $end));
} }
} }

View file

@ -505,9 +505,10 @@ class kolab_driver extends calendar_driver
* @param integer Event's new end (unix timestamp) * @param integer Event's new end (unix timestamp)
* @param string Search query (optional) * @param string Search query (optional)
* @param mixed List of calendar IDs to load events from (either as array or comma-separated string) * @param mixed List of calendar IDs to load events from (either as array or comma-separated string)
* @param boolean Strip virtual events (optional)
* @return array A list of event records * @return array A list of event records
*/ */
public function load_events($start, $end, $search = null, $calendars = null) public function load_events($start, $end, $search = null, $calendars = null, $virtual = 1)
{ {
if ($calendars && is_string($calendars)) if ($calendars && is_string($calendars))
$calendars = explode(',', $calendars); $calendars = explode(',', $calendars);
@ -517,7 +518,7 @@ class kolab_driver extends calendar_driver
if ($calendars && !in_array($cid, $calendars)) if ($calendars && !in_array($cid, $calendars))
continue; continue;
$events = array_merge($events, $this->calendars[$cid]->list_events($start, $end, $search)); $events = array_merge($events, $this->calendars[$cid]->list_events($start, $end, $search, $virtual));
} }
return $events; return $events;