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 $so;
/**
* Instance of the datetime class
*
* @var egw_datetime
*/
var $datetime;
/**
* Instance of the categories class
*
@ -229,7 +223,6 @@ class calendar_bo
if ($this->debug > 0) $this->debug_message('calendar_bo::bocal() started',True);
$this->so = new calendar_so();
$this->datetime = $GLOBALS['egw']->datetime;
$this->common_prefs =& $GLOBALS['egw_info']['user']['preferences']['common'];
$this->cal_prefs =& $GLOBALS['egw_info']['user']['preferences']['calendar'];
@ -1835,7 +1828,7 @@ class calendar_bo
* @param type $event
* @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
$options = array (

View File

@ -46,12 +46,6 @@ class calendar_ui
* @var jscalendar
*/
var $jscal;
/**
* Reference to global datetime class
*
* @var egw_datetime
*/
var $datetime;
/**
* Instance of Api\Categories class
*
@ -151,7 +145,6 @@ class calendar_ui
{
$this->bo = new calendar_bo();
}
$this->datetime = $GLOBALS['egw']->datetime;
$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');
break;
case 'week':
$start = $this->bo->date2array($params['date'] ? $params['date'] : $this->date);
$this->first = $this->datetime->get_weekday_start($start['year'],$start['month'],$start['day']);
$start = new Api\DateTime($params['date'] ? $params['date'] : $this->date);
$start->setWeekstart();
$this->first = $start->format('ts');
$this->last = $this->bo->date2array($this->first);
$this->last['day'] += ($params['weekend'] == 'true' ? 7 : 5) - 1;
$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
{
$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['day'] += ($this->planner_view == 'week' ? 7 : 7 * $this->cal_prefs['multiple_weeks'])-1;
$this->last['hour'] = 23; $this->last['minute'] = $this->last['sec'] = 59;
@ -527,7 +529,9 @@ class calendar_uiviews extends calendar_ui
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;
$weekNavH = "$weeks weeks";
$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)
{
$first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day=$day);
if ($day == 1)
{
$last = $this->datetime->get_weekday_start($this->year,$this->month,
$this->datetime->days_in_month($this->month,$this->year));
}
else
{
$last = $this->datetime->get_weekday_start($this->year,$this->month+1,$day);
}
$start = new Api\DateTime($this->date);
$start->setDate($this->year,$this->month,$this->day=$day);
$start->setWeekstart();
$first = $start->format('ts');
$start->setDate($this->year,$this->month+1,$day);
if ($day == 1) $start->add('-1day');
$start->setWeekstart();
// 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!!!
$arr = $this->bo->date2array($last);
$arr = $start->format('array');
$arr['day'] += 6;
$arr['hour'] = 23;
$arr['min'] = $arr['sec'] = 59;
@ -628,7 +629,9 @@ class calendar_uiviews extends calendar_ui
}
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
{
switch($this->cal_prefs['weekdaystarts'])