Code cleanup

This commit is contained in:
Thomas Bruederli 2011-06-18 18:34:01 -06:00
parent c82b5070a6
commit c943ab2b3b

View file

@ -29,6 +29,7 @@ class calendar extends rcube_plugin
public $rc; public $rc;
public $driver; public $driver;
public $home; // declare public to be used in other classes public $home; // declare public to be used in other classes
public $timezone;
public $ical; public $ical;
public $ui; public $ui;
@ -559,32 +560,13 @@ class calendar extends rcube_plugin
return $settings; return $settings;
} }
/**
* Convert the given time stamp to a GMT date string
*/
function toGMT($time, $user_tz = true)
{
$tz = $user_tz ? $this->gmt_offset : date('Z');
return date('Y-m-d H:i:s', $time - $tz);
}
/**
* Shift the given time stamo to a GMT time zone
*/
function toGMTTS($time, $user_tz = true)
{
$tz = $user_tz ? $this->gmt_offset : date('Z');
return $time - $tz;
}
/** /**
* Convert the given date string into a GMT-based time stamp * Convert the given date string into a GMT-based time stamp
*/ */
function fromGMT($datetime, $user_tz = true) function fromGMT($datetime)
{ {
$tz = $user_tz ? $this->gmt_offset : date('Z');
$ts = is_numeric($datetime) ? $datetime : strtotime($datetime); $ts = is_numeric($datetime) ? $datetime : strtotime($datetime);
return $ts + $tz; return $ts + $this->gmt_offset;
} }
/** /**
@ -609,7 +591,7 @@ class calendar extends rcube_plugin
'description' => strval($event['description']), 'description' => strval($event['description']),
'location' => strval($event['location']), 'location' => strval($event['location']),
'className' => ($addcss ? 'fc-event-cal-'.asciiwords($event['calendar'], true).' ' : '') . 'cat-' . asciiwords($event['categories'], true), 'className' => ($addcss ? 'fc-event-cal-'.asciiwords($event['calendar'], true).' ' : '') . 'cat-' . asciiwords($event['categories'], true),
'allDay' => ($event['allday'] == 1)?true:false, 'allDay' => ($event['allday'] == 1),
) + $event; ) + $event;
} }
return json_encode($json); return json_encode($json);