remove old phpgwapi datetime class from calendar, as it is no longer in api

This commit is contained in:
Ralf Becker 2016-05-02 20:22:47 +00:00
parent c15a722f3a
commit bc4362c22e
4 changed files with 21 additions and 31 deletions

View File

@ -194,12 +194,6 @@ class calendar_bo
* @var calendar_so * @var calendar_so
*/ */
var $so; var $so;
/**
* Instance of the datetime class
*
* @var egw_datetime
*/
var $datetime;
/** /**
* Instance of the categories class * Instance of the categories class
* *
@ -229,7 +223,6 @@ class calendar_bo
if ($this->debug > 0) $this->debug_message('calendar_bo::bocal() started',True); if ($this->debug > 0) $this->debug_message('calendar_bo::bocal() started',True);
$this->so = new calendar_so(); $this->so = new calendar_so();
$this->datetime = $GLOBALS['egw']->datetime;
$this->common_prefs =& $GLOBALS['egw_info']['user']['preferences']['common']; $this->common_prefs =& $GLOBALS['egw_info']['user']['preferences']['common'];
$this->cal_prefs =& $GLOBALS['egw_info']['user']['preferences']['calendar']; $this->cal_prefs =& $GLOBALS['egw_info']['user']['preferences']['calendar'];
@ -1835,7 +1828,7 @@ class calendar_bo
* @param type $event * @param type $event
* @return array array of selected calendar fields * @return array array of selected calendar fields
*/ */
function get_link_options ($event = array()) public static function get_link_options ($event = array())
{ {
unset($event); // not used, but required by function signature unset($event); // not used, but required by function signature
$options = array ( $options = array (

View File

@ -46,12 +46,6 @@ class calendar_ui
* @var jscalendar * @var jscalendar
*/ */
var $jscal; var $jscal;
/**
* Reference to global datetime class
*
* @var egw_datetime
*/
var $datetime;
/** /**
* Instance of Api\Categories class * Instance of Api\Categories class
* *
@ -151,7 +145,6 @@ class calendar_ui
{ {
$this->bo = new calendar_bo(); $this->bo = new calendar_bo();
} }
$this->datetime = $GLOBALS['egw']->datetime;
$this->categories = new Api\Categories($this->user,'calendar'); $this->categories = new Api\Categories($this->user,'calendar');

View File

@ -324,8 +324,9 @@ class calendar_uilist extends calendar_ui
$this->last = $search_params['end'] = $today->format('ts'); $this->last = $search_params['end'] = $today->format('ts');
break; break;
case 'week': case 'week':
$start = $this->bo->date2array($params['date'] ? $params['date'] : $this->date); $start = new Api\DateTime($params['date'] ? $params['date'] : $this->date);
$this->first = $this->datetime->get_weekday_start($start['year'],$start['month'],$start['day']); $start->setWeekstart();
$this->first = $start->format('ts');
$this->last = $this->bo->date2array($this->first); $this->last = $this->bo->date2array($this->first);
$this->last['day'] += ($params['weekend'] == 'true' ? 7 : 5) - 1; $this->last['day'] += ($params['weekend'] == 'true' ? 7 : 5) - 1;
$this->last['hour'] = 23; $this->last['minute'] = $this->last['sec'] = 59; $this->last['hour'] = 23; $this->last['minute'] = $this->last['sec'] = 59;

View File

@ -438,7 +438,9 @@ class calendar_uiviews extends calendar_ui
} }
elseif ($this->planner_view == 'week' || $this->planner_view == 'weekN') // weeekview elseif ($this->planner_view == 'week' || $this->planner_view == 'weekN') // weeekview
{ {
$this->first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day); $start = new Api\DateTime($this->date);
$start->setWeekstart();
$this->first = $start->format('ts');
$this->last = $this->bo->date2array($this->first); $this->last = $this->bo->date2array($this->first);
$this->last['day'] += ($this->planner_view == 'week' ? 7 : 7 * $this->cal_prefs['multiple_weeks'])-1; $this->last['day'] += ($this->planner_view == 'week' ? 7 : 7 * $this->cal_prefs['multiple_weeks'])-1;
$this->last['hour'] = 23; $this->last['minute'] = $this->last['sec'] = 59; $this->last['hour'] = 23; $this->last['minute'] = $this->last['sec'] = 59;
@ -527,7 +529,9 @@ class calendar_uiviews extends calendar_ui
if ($weeks) if ($weeks)
{ {
$this->first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day); $start = new Api\DateTime($this->date);
$start->setWeekstart();
$this->first = $start->format('ts');
$this->last = strtotime("+$weeks weeks",$this->first) - 1; $this->last = strtotime("+$weeks weeks",$this->first) - 1;
$weekNavH = "$weeks weeks"; $weekNavH = "$weeks weeks";
$navHeader = lang('Week').' '.$this->week_number($this->first).' - '.$this->week_number($this->last).': '. $navHeader = lang('Week').' '.$this->week_number($this->first).' - '.$this->week_number($this->last).': '.
@ -579,19 +583,16 @@ class calendar_uiviews extends calendar_ui
*/ */
function _week_align_month(&$first,&$last,$day=1) function _week_align_month(&$first,&$last,$day=1)
{ {
$first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day=$day); $start = new Api\DateTime($this->date);
if ($day == 1) $start->setDate($this->year,$this->month,$this->day=$day);
{ $start->setWeekstart();
$last = $this->datetime->get_weekday_start($this->year,$this->month, $first = $start->format('ts');
$this->datetime->days_in_month($this->month,$this->year)); $start->setDate($this->year,$this->month+1,$day);
} if ($day == 1) $start->add('-1day');
else $start->setWeekstart();
{
$last = $this->datetime->get_weekday_start($this->year,$this->month+1,$day);
}
// now we need to calculate the end of the last day of that week // now we need to calculate the end of the last day of that week
// as simple $last += WEEK_s - 1; does NOT work, if daylight saving changes in that week!!! // as simple $last += WEEK_s - 1; does NOT work, if daylight saving changes in that week!!!
$arr = $this->bo->date2array($last); $arr = $start->format('array');
$arr['day'] += 6; $arr['day'] += 6;
$arr['hour'] = 23; $arr['hour'] = 23;
$arr['min'] = $arr['sec'] = 59; $arr['min'] = $arr['sec'] = 59;
@ -628,7 +629,9 @@ class calendar_uiviews extends calendar_ui
} }
else else
{ {
$wd_start = $this->first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day); $start = new Api\DateTime($this->date);
$start->setWeekstart();
$wd_start = $this->first = $start->format('ts');
if ($days <= 5) // no weekend-days if ($days <= 5) // no weekend-days
{ {
switch($this->cal_prefs['weekdaystarts']) switch($this->cal_prefs['weekdaystarts'])