forked from extern/egroupware
Re-work how calendar export criteria preset dates are calculated - use view start instead of today
This commit is contained in:
parent
627fa6fc9c
commit
3f808215fe
@ -84,6 +84,7 @@ class calendar_export_csv implements importexport_iface_export_plugin {
|
|||||||
$query += $this->get_query_month($states);
|
$query += $this->get_query_month($states);
|
||||||
break;
|
break;
|
||||||
case 'week':
|
case 'week':
|
||||||
|
case 'weekN':
|
||||||
$query += $this->get_query_week($states);
|
$query += $this->get_query_week($states);
|
||||||
break;
|
break;
|
||||||
case 'day':
|
case 'day':
|
||||||
@ -96,7 +97,7 @@ class calendar_export_csv implements importexport_iface_export_plugin {
|
|||||||
{
|
{
|
||||||
ob_start();
|
ob_start();
|
||||||
$ui->$states['view']();
|
$ui->$states['view']();
|
||||||
ob_end_flush();
|
ob_end_clean();
|
||||||
}
|
}
|
||||||
$query += array(
|
$query += array(
|
||||||
'start' => is_array($ui->first) ? $this->bo->date2ts($ui->first) : $ui->first,
|
'start' => is_array($ui->first) ? $this->bo->date2ts($ui->first) : $ui->first,
|
||||||
@ -237,15 +238,21 @@ class calendar_export_csv implements importexport_iface_export_plugin {
|
|||||||
*/
|
*/
|
||||||
public function get_selectors_etpl($definition = null) {
|
public function get_selectors_etpl($definition = null) {
|
||||||
$states = $GLOBALS['egw']->session->appsession('session_data','calendar');
|
$states = $GLOBALS['egw']->session->appsession('session_data','calendar');
|
||||||
$start= new egw_time($states['date']);
|
switch($states['view']) {
|
||||||
if($states['view'] == 'week')
|
case 'month':
|
||||||
{
|
$query = $this->get_query_month($states);
|
||||||
$days = isset($_GET['days']) ? $_GET['days'] : $GLOBALS['egw_info']['user']['preferences']['calendar']['days_in_weekview'];
|
break;
|
||||||
if ($days != 5) $days = 7;
|
case 'week':
|
||||||
$end = "+$days days";
|
case 'weekN':
|
||||||
$end = strtotime($end, $start->format('ts'))-1;
|
$query = $this->get_query_week($states);
|
||||||
|
break;
|
||||||
|
case 'day':
|
||||||
|
$query = $this->get_query_day($states);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
elseif ($states['view'] == 'listview')
|
$start= new egw_time($query['start']);
|
||||||
|
$end = new egw_time($query['end']);
|
||||||
|
if ($states['view'] == 'listview')
|
||||||
{
|
{
|
||||||
$list = $GLOBALS['egw']->session->appsession('calendar_list','calendar');
|
$list = $GLOBALS['egw']->session->appsession('calendar_list','calendar');
|
||||||
|
|
||||||
@ -253,8 +260,8 @@ class calendar_export_csv implements importexport_iface_export_plugin {
|
|||||||
$ui = new calendar_uilist();
|
$ui = new calendar_uilist();
|
||||||
$list['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session
|
$list['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session
|
||||||
$ui->get_rows($list,$rows,$readonlys);
|
$ui->get_rows($list,$rows,$readonlys);
|
||||||
if($ui->first) $start = $ui->first;
|
$start = $ui->first ? $ui->first : new egw_time($ui->date);
|
||||||
if($ui->last) $end = $ui->last;
|
$end = $ui->last;
|
||||||
|
|
||||||
// Special handling
|
// Special handling
|
||||||
if($list['filter'] == 'all') $start = $end = null;
|
if($list['filter'] == 'all') $start = $end = null;
|
||||||
@ -265,12 +272,11 @@ class calendar_export_csv implements importexport_iface_export_plugin {
|
|||||||
}
|
}
|
||||||
$ui = null;
|
$ui = null;
|
||||||
}
|
}
|
||||||
else
|
elseif(!$end)
|
||||||
{
|
{
|
||||||
$end = '+1 ' . $states['view'];
|
$end = '+1 ' . $states['view'];
|
||||||
$end = strtotime($end, $start->format('ts'))-1;
|
$end = strtotime($end, $start->format('ts'))-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$prefs = unserialize($GLOBALS['egw_info']['user']['preferences']['importexport'][$definition->definition_id]);
|
$prefs = unserialize($GLOBALS['egw_info']['user']['preferences']['importexport'][$definition->definition_id]);
|
||||||
$data = array(
|
$data = array(
|
||||||
'name' => 'calendar.export_csv_select',
|
'name' => 'calendar.export_csv_select',
|
||||||
@ -310,7 +316,7 @@ class calendar_export_csv implements importexport_iface_export_plugin {
|
|||||||
$days = isset($_GET['days']) ? $_GET['days'] : $ui->cal_prefs['days_in_weekview'];
|
$days = isset($_GET['days']) ? $_GET['days'] : $ui->cal_prefs['days_in_weekview'];
|
||||||
if ($days != 5) $days = 7;
|
if ($days != 5) $days = 7;
|
||||||
}
|
}
|
||||||
if ($days == 4) // next 4 days view
|
if ($states['view'] == 'week' && $days == 4) // next 4 days view
|
||||||
{
|
{
|
||||||
$query['start'] = $this->bo->date2ts($states['date']);
|
$query['start'] = $this->bo->date2ts($states['date']);
|
||||||
$query['end'] = strtotime("+$days days",$query['start']) - 1;
|
$query['end'] = strtotime("+$days days",$query['start']) - 1;
|
||||||
@ -330,7 +336,7 @@ class calendar_export_csv implements importexport_iface_export_plugin {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$query['end'] = strtotime("+$days days",$query['start']) - 1;
|
$query['end'] = strtotime($states['view'] == 'week' ? "+$days days" : "+{$ui->cal_prefs['multiple_weeks']} weeks",$query['start']) - 1;
|
||||||
}
|
}
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user