Fix iCal export

This commit is contained in:
Nathan Gray 2013-01-23 16:10:17 +00:00
parent 955be2c365
commit 25a8b7dbc4

View File

@ -35,13 +35,14 @@ class calendar_export_ical extends calendar_export_csv {
$limit_exception = bo_merge::is_export_limit_excepted(); $limit_exception = bo_merge::is_export_limit_excepted();
if (!$limit_exception) $export_limit = bo_merge::getExportLimit('calendar'); if (!$limit_exception) $export_limit = bo_merge::getExportLimit('calendar');
if($options['selection']['select'] == 'criteria') { if($options['selection'] == 'criteria')
{
$query = array( $query = array(
'start' => $options['selection']['start'], 'start' => $options['criteria']['start'],
'end' => strtotime('+1 day',$options['selection']['end'])-1, 'end' => strtotime('+1 day',$options['criteria']['end'])-1,
'categories' => $options['categories'] ? $options['categories'] : $options['selection']['categories'], 'categories' => $options['categories'],
'daywise' => false, 'daywise' => false,
'users' => $options['selection']['owner'], 'users' => $options['criteria']['owner'],
'cfs' => $cfs // Otherwise we shouldn't get any custom fields 'cfs' => $cfs // Otherwise we shouldn't get any custom fields
); );
if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) {
@ -49,9 +50,12 @@ class calendar_export_ical extends calendar_export_csv {
$query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0
} }
$events =& $this->bo->search($query); $events =& $this->bo->search($query);
} elseif ($options['selection']['select'] == 'search_results') { }
elseif ($options['selection'] == 'search_results')
{
$states = $GLOBALS['egw']->session->appsession('session_data','calendar'); $states = $GLOBALS['egw']->session->appsession('session_data','calendar');
if($states['view'] == 'listview') { if($states['view'] == 'listview')
{
$query = $GLOBALS['egw']->session->appsession('calendar_list','calendar'); $query = $GLOBALS['egw']->session->appsession('calendar_list','calendar');
$query['num_rows'] = -1; // all $query['num_rows'] = -1; // all
$query['start'] = 0; $query['start'] = 0;
@ -62,16 +66,20 @@ class calendar_export_ical extends calendar_export_csv {
} }
$ui = new calendar_uilist(); $ui = new calendar_uilist();
$ui->get_rows($query, $events, $unused); $ui->get_rows($query, $events, $unused);
} else { }
else
{
$query = $GLOBALS['egw']->session->appsession('session_data','calendar'); $query = $GLOBALS['egw']->session->appsession('session_data','calendar');
$query['users'] = explode(',', $query['owner']); $query['users'] = explode(',', $query['owner']);
$query['num_rows'] = -1; $query['num_rows'] = -1;
if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { if(bo_merge::hasExportLimit($export_limit) && !$limit_exception)
{
$query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0
} }
$events = array(); $events = array();
switch($states['view']) { switch($states['view'])
{
case 'month': case 'month':
$query += calendar_export_csv::get_query_month($states); $query += calendar_export_csv::get_query_month($states);
break; break;