mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
New all-day event implementation
This commit is contained in:
parent
7611cd1374
commit
ee18b0acac
@ -722,21 +722,56 @@ class calendar_bo
|
||||
{
|
||||
$event['tzid'] = egw_time::$server_timezone->getName();
|
||||
}
|
||||
// we convert here from the server-time timestamps to user-time and (optional) to a different date-format!
|
||||
foreach(array('start','end','modified','created','recur_enddate','recurrence') as $ts)
|
||||
if (($event['whole_day'] = $this->so->isWholeDay($event)) &&
|
||||
$date_format != 'server')
|
||||
{
|
||||
// Adjust dates to user TZ
|
||||
$time = new egw_time($event['start'], egw_time::$server_timezone);
|
||||
$time =& $this->so->startOfDay($time, $event['tzid']);
|
||||
$event['start'] = egw_time::to($time, $date_format);
|
||||
$time = new egw_time($event['end'], egw_time::$server_timezone);
|
||||
$time =& $this->so->startOfDay($time, $event['tzid']);
|
||||
$time->setTime(23, 59, 59);
|
||||
$event['end'] = egw_time::to($time, $date_format);
|
||||
$time = new egw_time($event['recurrence'], egw_time::$server_timezone);
|
||||
$time =& $this->so->startOfDay($time, $event['tzid']);
|
||||
$event['recurrence'] = egw_time::to($time, $date_format);
|
||||
$time = new egw_time($event['recur_enddate'], egw_time::$server_timezone);
|
||||
$time =& $this->so->startOfDay($time, $event['tzid']);
|
||||
$time->setTime(23, 59, 59);
|
||||
$event['recur_enddate'] = egw_time::to($time, $date_format);
|
||||
$timestamps = array('modified','created');
|
||||
}
|
||||
else
|
||||
{
|
||||
$timestamps = array('start','end','modified','created','recur_enddate','recurrence');
|
||||
}
|
||||
// we convert here from the server-time timestamps to user-time and (optional) to a different date-format!
|
||||
foreach ($timestamps as $ts)
|
||||
{
|
||||
if (!empty($event[$ts]))
|
||||
{
|
||||
if (empty($event[$ts])) continue;
|
||||
|
||||
$event[$ts] = $this->date2usertime($event[$ts],$date_format);
|
||||
}
|
||||
}
|
||||
// same with the recur exceptions
|
||||
if (isset($event['recur_exception']) && is_array($event['recur_exception']))
|
||||
{
|
||||
foreach($event['recur_exception'] as &$date)
|
||||
{
|
||||
if ($event['whole_day'] && $date_format != 'server')
|
||||
{
|
||||
// Adjust dates to user TZ
|
||||
$time = new egw_time($date, egw_time::$server_timezone);
|
||||
$time =& $this->so->startOfDay($time, $event['tzid']);
|
||||
$date = egw_time::to($time, $date_format);
|
||||
}
|
||||
else
|
||||
{
|
||||
$date = $this->date2usertime($date,$date_format);
|
||||
}
|
||||
}
|
||||
}
|
||||
// same with the alarms
|
||||
if (isset($event['alarm']) && is_array($event['alarm']))
|
||||
{
|
||||
|
@ -852,8 +852,30 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
|
||||
$save_event = $event;
|
||||
if (!isset($event['whole_day']) && ($event['whole_day'] = $this->isWholeDay($event)))
|
||||
{
|
||||
$time = new egw_time($event['start'], egw_time::$user_timezone);
|
||||
$time =& $this->so->startOfDay($time);
|
||||
$event['start'] = egw_time::to($time, 'ts');
|
||||
$time = new egw_time($event['end'], egw_time::$user_timezone);
|
||||
$time =& $this->so->startOfDay($time);
|
||||
$time->setTime(23, 59, 59);
|
||||
$event['end'] = egw_time::to($time, 'ts');
|
||||
$time = new egw_time($event['recurrence'], egw_time::$user_timezone);
|
||||
$time =& $this->so->startOfDay($time);
|
||||
$event['recurrence'] = egw_time::to($time, 'ts');
|
||||
$time = new egw_time($event['recur_enddate'], egw_time::$user_timezone);
|
||||
$time =& $this->so->startOfDay($time);
|
||||
$time->setTime(23, 59, 59);
|
||||
$event['recur_enddate'] = egw_time::to($time, 'ts');
|
||||
$timestamps = array('modified','created');
|
||||
}
|
||||
else
|
||||
{
|
||||
$timestamps = array('start','end','modified','created','recur_enddate','recurrence');
|
||||
}
|
||||
// we run all dates through date2ts, to adjust to server-time and the possible date-formats
|
||||
foreach(array('start','end','modified','created','recur_enddate','recurrence') as $ts)
|
||||
foreach($timestamps as $ts)
|
||||
{
|
||||
// we convert here from user-time to timestamps in server-time!
|
||||
if (isset($event[$ts])) $event[$ts] = $event[$ts] ? $this->date2ts($event[$ts],true) : 0;
|
||||
@ -867,10 +889,19 @@ class calendar_boupdate extends calendar_bo
|
||||
if (isset($event['recur_exception']) && is_array($event['recur_exception']))
|
||||
{
|
||||
foreach($event['recur_exception'] as $n => $date)
|
||||
{
|
||||
if ($event['whole_day'])
|
||||
{
|
||||
$time = new egw_time($date, egw_time::$user_timezone);
|
||||
$time =& $this->so->startOfDay($time);
|
||||
$date = egw_time::to($time, 'ts');
|
||||
}
|
||||
else
|
||||
{
|
||||
$event['recur_exception'][$n] = $this->date2ts($date,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
// same with the alarms
|
||||
if (isset($event['alarm']) && is_array($event['alarm']))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user