replace Sabre_VObject_Element_DateTime with Sabre_VObject_Property_DateTime
This commit is contained in:
parent
e082d473bb
commit
1d1dfcbc1a
|
@ -21,15 +21,15 @@ $vevent = $object->VEVENT;
|
|||
$dtstart = $vevent->DTSTART;
|
||||
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
|
||||
switch($dtstart->getDateType()) {
|
||||
case Sabre_VObject_Element_DateTime::LOCALTZ:
|
||||
case Sabre_VObject_Element_DateTime::LOCAL:
|
||||
case Sabre_VObject_Property_DateTime::LOCALTZ:
|
||||
case Sabre_VObject_Property_DateTime::LOCAL:
|
||||
$startdate = $dtstart->getDateTime()->format('d-m-Y');
|
||||
$starttime = $dtstart->getDateTime()->format('H:i');
|
||||
$enddate = $dtend->getDateTime()->format('d-m-Y');
|
||||
$endtime = $dtend->getDateTime()->format('H:i');
|
||||
$allday = false;
|
||||
break;
|
||||
case Sabre_VObject_Element_DateTime::DATE:
|
||||
case Sabre_VObject_Property_DateTime::DATE:
|
||||
$startdate = $dtstart->getDateTime()->format('d-m-Y');
|
||||
$starttime = '';
|
||||
$dtend->getDateTime()->modify('-1 day');
|
||||
|
|
|
@ -24,19 +24,19 @@ $dtstart = $vevent->DTSTART;
|
|||
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
|
||||
$start_type = $dtstart->getDateType();
|
||||
$end_type = $dtend->getDateType();
|
||||
if ($allday && $start_type != Sabre_VObject_Element_DateTime::DATE){
|
||||
$start_type = $end_type = Sabre_VObject_Element_DateTime::DATE;
|
||||
if ($allday && $start_type != Sabre_VObject_Property_DateTime::DATE){
|
||||
$start_type = $end_type = Sabre_VObject_Property_DateTime::DATE;
|
||||
$dtend->setDateTime($dtend->getDateTime()->modify('+1 day'), $end_type);
|
||||
}
|
||||
if (!$allday && $start_type == Sabre_VObject_Element_DateTime::DATE){
|
||||
$start_type = $end_type = Sabre_VObject_Element_DateTime::LOCALTZ;
|
||||
if (!$allday && $start_type == Sabre_VObject_Property_DateTime::DATE){
|
||||
$start_type = $end_type = Sabre_VObject_Property_DateTime::LOCALTZ;
|
||||
}
|
||||
$dtstart->setDateTime($dtstart->getDateTime()->add($delta), $start_type);
|
||||
$dtend->setDateTime($dtend->getDateTime()->add($delta), $end_type);
|
||||
unset($vevent->DURATION);
|
||||
|
||||
$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Element_DateTime::UTC);
|
||||
$vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Element_DateTime::UTC);
|
||||
$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Property_DateTime::UTC);
|
||||
$vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Property_DateTime::UTC);
|
||||
|
||||
$result = OC_Calendar_Object::edit($id, $vcalendar->serialize());
|
||||
$lastmodified = $vevent->__get('LAST-MODIFIED')->getDateTime();
|
||||
|
|
|
@ -24,8 +24,8 @@ $end_type = $dtend->getDateType();
|
|||
$dtend->setDateTime($dtend->getDateTime()->add($delta), $end_type);
|
||||
unset($vevent->DURATION);
|
||||
|
||||
$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Element_DateTime::UTC);
|
||||
$vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Element_DateTime::UTC);
|
||||
$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Property_DateTime::UTC);
|
||||
$vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Property_DateTime::UTC);
|
||||
|
||||
$result = OC_Calendar_Object::edit($id, $vcalendar->serialize());
|
||||
$lastmodified = $vevent->__get('LAST-MODIFIED')->getDateTime();
|
||||
|
|
|
@ -47,7 +47,7 @@ foreach($events as $event){
|
|||
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
|
||||
$start_dt = $dtstart->getDateTime();
|
||||
$end_dt = $dtend->getDateTime();
|
||||
if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){
|
||||
if ($dtstart->getDateType() == Sabre_VObject_Property_DateTime::DATE){
|
||||
$return_event['allDay'] = true;
|
||||
}else{
|
||||
$return_event['allDay'] = false;
|
||||
|
|
|
@ -625,7 +625,7 @@ class OC_Calendar_Object{
|
|||
$vevent = new OC_VObject('VEVENT');
|
||||
$vcalendar->add($vevent);
|
||||
|
||||
$vevent->setDateTime('CREATED', 'now', Sabre_VObject_Element_DateTime::UTC);
|
||||
$vevent->setDateTime('CREATED', 'now', Sabre_VObject_Property_DateTime::UTC);
|
||||
|
||||
$vevent->setUID();
|
||||
return self::updateVCalendarFromRequest($request, $vcalendar);
|
||||
|
@ -786,24 +786,24 @@ class OC_Calendar_Object{
|
|||
}
|
||||
|
||||
|
||||
$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Element_DateTime::UTC);
|
||||
$vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Element_DateTime::UTC);
|
||||
$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Property_DateTime::UTC);
|
||||
$vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Property_DateTime::UTC);
|
||||
$vevent->setString('SUMMARY', $title);
|
||||
|
||||
$dtstart = new Sabre_VObject_Element_DateTime('DTSTART');
|
||||
$dtend = new Sabre_VObject_Element_DateTime('DTEND');
|
||||
$dtstart = new Sabre_VObject_Property_DateTime('DTSTART');
|
||||
$dtend = new Sabre_VObject_Property_DateTime('DTEND');
|
||||
if($allday){
|
||||
$start = new DateTime($from);
|
||||
$end = new DateTime($to.' +1 day');
|
||||
$vevent->setDateTime('DTSTART', $start, Sabre_VObject_Element_DateTime::DATE);
|
||||
$vevent->setDateTime('DTEND', $end, Sabre_VObject_Element_DateTime::DATE);
|
||||
$vevent->setDateTime('DTSTART', $start, Sabre_VObject_Property_DateTime::DATE);
|
||||
$vevent->setDateTime('DTEND', $end, Sabre_VObject_Property_DateTime::DATE);
|
||||
}else{
|
||||
$timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$timezone = new DateTimeZone($timezone);
|
||||
$start = new DateTime($from.' '.$fromtime, $timezone);
|
||||
$end = new DateTime($to.' '.$totime, $timezone);
|
||||
$vevent->setDateTime('DTSTART', $start, Sabre_VObject_Element_DateTime::LOCALTZ);
|
||||
$vevent->setDateTime('DTEND', $end, Sabre_VObject_Element_DateTime::LOCALTZ);
|
||||
$vevent->setDateTime('DTSTART', $start, Sabre_VObject_Property_DateTime::LOCALTZ);
|
||||
$vevent->setDateTime('DTEND', $end, Sabre_VObject_Property_DateTime::LOCALTZ);
|
||||
}
|
||||
unset($vevent->DURATION);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class OC_Search_Provider_Calendar extends OC_Search_Provider{
|
|||
$start_dt->setTimezone(new DateTimeZone($user_timezone));
|
||||
$end_dt = $dtend->getDateTime();
|
||||
$end_dt->setTimezone(new DateTimeZone($user_timezone));
|
||||
if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){
|
||||
if ($dtstart->getDateType() == Sabre_VObject_Property_DateTime::DATE){
|
||||
$end_dt->modify('-1 sec');
|
||||
if($start_dt->format('d.m.Y') != $end_dt->format('d.m.Y')){
|
||||
$info = $l->t('Date') . ': ' . $start_dt->format('d.m.Y') . ' - ' . $end_dt->format('d.m.Y');
|
||||
|
|
|
@ -41,7 +41,7 @@ class OC_VObject{
|
|||
*/
|
||||
public static function parse($data){
|
||||
try {
|
||||
Sabre_VObject_Property::$classMap['LAST-MODIFIED'] = 'Sabre_VObject_Element_DateTime';
|
||||
Sabre_VObject_Property::$classMap['LAST-MODIFIED'] = 'Sabre_VObject_Property_DateTime';
|
||||
$vobject = Sabre_VObject_Reader::read($data);
|
||||
if ($vobject instanceof Sabre_VObject_Component){
|
||||
$vobject = new OC_VObject($vobject);
|
||||
|
@ -150,12 +150,12 @@ class OC_VObject{
|
|||
* @param int $dateType
|
||||
* @return void
|
||||
*/
|
||||
public function setDateTime($name, $datetime, $dateType=Sabre_VObject_Element_DateTime::LOCALTZ){
|
||||
public function setDateTime($name, $datetime, $dateType=Sabre_VObject_Property_DateTime::LOCALTZ){
|
||||
if ($datetime == 'now'){
|
||||
$datetime = new DateTime();
|
||||
}
|
||||
if ($datetime instanceof DateTime){
|
||||
$datetime_element = new Sabre_VObject_Element_DateTime($name);
|
||||
$datetime_element = new Sabre_VObject_Property_DateTime($name);
|
||||
$datetime_element->setDateTime($datetime, $dateType);
|
||||
$this->vobject->__set($name, $datetime_element);
|
||||
}else{
|
||||
|
|
Loading…
Reference in New Issue