Update Contacts and Calendar with namespaces for Sabre 1.7.1

master
Susinthiran Sithamparanathan 2012-10-17 14:32:18 +02:00
parent 0353171ca0
commit d1b6e5281f
9 changed files with 29 additions and 29 deletions

View File

@ -27,7 +27,7 @@ $vevent = $object->VEVENT;
$dtstart = $vevent->DTSTART;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
switch($dtstart->getDateType()) {
case Sabre_VObject_Property_DateTime::UTC:
case Sabre\VObject\Property\DateTime::UTC:
$timeOffset = $_SESSION['timezone']*60;
$newDT = $dtstart->getDateTime();
$newDT->add(new DateInterval("PT" . $timeOffset . "M"));
@ -35,15 +35,15 @@ switch($dtstart->getDateType()) {
$newDT = $dtend->getDateTime();
$newDT->add(new DateInterval("PT" . $timeOffset . "M"));
$dtend->setDateTime($newDT);
case Sabre_VObject_Property_DateTime::LOCALTZ:
case Sabre_VObject_Property_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_Property_DateTime::DATE:
case Sabre\VObject\Property\DateTime::DATE:
$startdate = $dtstart->getDateTime()->format('d-m-Y');
$starttime = '';
$dtend->getDateTime()->modify('-1 day');

View File

@ -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_Property_DateTime::DATE) {
$start_type = $end_type = Sabre_VObject_Property_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_Property_DateTime::DATE) {
$start_type = $end_type = Sabre_VObject_Property_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_Property_DateTime::UTC);
$vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Property_DateTime::UTC);
$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre\VObject\Property\DateTime::UTC);
$vevent->setDateTime('DTSTAMP', 'now', Sabre\VObject\Property\DateTime::UTC);
try {
OC_Calendar_Object::edit($id, $vcalendar->serialize());

View File

@ -31,8 +31,8 @@ $end_type = $dtend->getDateType();
$dtend->setDateTime($dtend->getDateTime()->add($delta), $end_type);
unset($vevent->DURATION);
$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Property_DateTime::UTC);
$vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Property_DateTime::UTC);
$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre\VObject\Property\DateTime::UTC);
$vevent->setDateTime('DTSTAMP', 'now', Sabre\VObject\Property\DateTime::UTC);
OC_Calendar_Object::edit($id, $vcalendar->serialize());
$lastmodified = $vevent->__get('LAST-MODIFIED')->getDateTime();

View File

@ -378,7 +378,7 @@ class OC_Calendar_App{
$vevent = $object->VEVENT;
$return = array();
$id = $event['id'];
$allday = ($vevent->DTSTART->getDateType() == Sabre_VObject_Element_DateTime::DATE)?true:false;
$allday = ($vevent->DTSTART->getDateType() == Sabre\VObject\Property\DateTime::DATE)?true:false;
$last_modified = @$vevent->__get('LAST-MODIFIED');
$lastmodified = ($last_modified)?$last_modified->getDateTime()->format('U'):0;
$staticoutput = array('id'=>(int)$event['id'],
@ -410,7 +410,7 @@ class OC_Calendar_App{
$object->expand($start, $end);
}
foreach($object->getComponents() as $singleevent) {
if(!($singleevent instanceof Sabre_VObject_Component_VEvent)) {
if(!($singleevent instanceof Sabre\VObject\Component\VEvent)) {
continue;
}
$dynamicoutput = OC_Calendar_Object::generateStartEndDate($singleevent->DTSTART, OC_Calendar_Object::getDTEndFromVEvent($singleevent), $allday, self::$tz);

View File

@ -74,11 +74,11 @@ class OC_Calendar_Export{
$start_dt = $dtstart->getDateTime();
$dtend = OC_Calendar_Object::getDTEndFromVEvent($object->VEVENT);
$end_dt = $dtend->getDateTime();
if($dtstart->getDateType() !== Sabre_VObject_Element_DateTime::DATE) {
if($dtstart->getDateType() !== Sabre\VObject\Element\DateTime::DATE) {
$start_dt->setTimezone(new DateTimeZone('UTC'));
$end_dt->setTimezone(new DateTimeZone('UTC'));
$object->VEVENT->setDateTime('DTSTART', $start_dt, Sabre_VObject_Property_DateTime::UTC);
$object->VEVENT->setDateTime('DTEND', $end_dt, Sabre_VObject_Property_DateTime::UTC);
$object->VEVENT->setDateTime('DTSTART', $start_dt, Sabre\VObject\Property\DateTime::UTC);
$object->VEVENT->setDateTime('DTEND', $end_dt, Sabre\VObject\Property\DateTime::UTC);
}
return $object->VEVENT->serialize();
}

View File

@ -20,7 +20,7 @@ class OC_Calendar_Import{
private $cacheprogress;
/*
* @brief Sabre_VObject_Component_VCalendar object - for documentation see http://code.google.com/p/sabredav/wiki/Sabre_VObject_Component_VCalendar
* @brief Sabre\VObject\Component\VCalendar object - for documentation see http://code.google.com/p/sabredav/wiki/Sabre_VObject_Component_VCalendar
*/
private $calobject;
@ -108,7 +108,7 @@ class OC_Calendar_Import{
}
$numofcomponents = count($this->calobject->getComponents());
foreach($this->calobject->getComponents() as $object) {
if(!($object instanceof Sabre_VObject_Component_VEvent) && !($object instanceof Sabre_VObject_Component_VJournal) && !($object instanceof Sabre_VObject_Component_VTodo)) {
if(!($object instanceof Sabre\VObject\Component\VEvent) && !($object instanceof Sabre\VObject\Component\VJournal) && !($object instanceof Sabre\VObject\Component\VTodo)) {
continue;
}
$dtend = OC_Calendar_Object::getDTEndFromVEvent($object);

View File

@ -754,7 +754,7 @@ class OC_Calendar_Object{
$vevent = new OC_VObject('VEVENT');
$vcalendar->add($vevent);
$vevent->setDateTime('CREATED', 'now', Sabre_VObject_Property_DateTime::UTC);
$vevent->setDateTime('CREATED', 'now', Sabre\VObject\Property\DateTime::UTC);
$vevent->setUID();
return self::updateVCalendarFromRequest($request, $vcalendar);
@ -923,22 +923,22 @@ class OC_Calendar_Object{
}
$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Property_DateTime::UTC);
$vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Property_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);
if($allday) {
$start = new DateTime($from);
$end = new DateTime($to.' +1 day');
$vevent->setDateTime('DTSTART', $start, Sabre_VObject_Property_DateTime::DATE);
$vevent->setDateTime('DTEND', $end, Sabre_VObject_Property_DateTime::DATE);
$vevent->setDateTime('DTSTART', $start, Sabre\VObject\Property\DateTime::DATE);
$vevent->setDateTime('DTEND', $end, Sabre\VObject\Property\DateTime::DATE);
}else{
$timezone = OC_Calendar_App::getTimezone();
$timezone = new DateTimeZone($timezone);
$start = new DateTime($from.' '.$fromtime, $timezone);
$end = new DateTime($to.' '.$totime, $timezone);
$vevent->setDateTime('DTSTART', $start, Sabre_VObject_Property_DateTime::LOCALTZ);
$vevent->setDateTime('DTEND', $end, Sabre_VObject_Property_DateTime::LOCALTZ);
$vevent->setDateTime('DTSTART', $start, Sabre\VObject\Property\DateTime::LOCALTZ);
$vevent->setDateTime('DTEND', $end, Sabre\VObject\Property\DateTime::LOCALTZ);
}
unset($vevent->DURATION);

View File

@ -95,10 +95,10 @@ class OC_Calendar_Repeat{
$end->modify('+5 years');
$object->expand($start, $end);
foreach($object->getComponents() as $vevent) {
if(!($vevent instanceof Sabre_VObject_Component_VEvent)) {
if(!($vevent instanceof Sabre\VObject\Component\VEvent)) {
continue;
}
$startenddate = OC_Calendar_Object::generateStartEndDate($vevent->DTSTART, OC_Calendar_Object::getDTEndFromVEvent($vevent), ($vevent->DTSTART->getDateType() == Sabre_VObject_Element_DateTime::DATE)?true:false, 'UTC');
$startenddate = OC_Calendar_Object::generateStartEndDate($vevent->DTSTART, OC_Calendar_Object::getDTEndFromVEvent($vevent), ($vevent->DTSTART->getDateType() == Sabre\VObject\Property\DateTime::DATE)?true:false, 'UTC');
$stmt = OCP\DB::prepare('INSERT INTO `*PREFIX*calendar_repeat` (`eventid`,`calid`,`startdate`,`enddate`) VALUES(?,?,?,?)');
$stmt->execute(array($id,OC_Calendar_Object::getCalendarid($id),$startenddate['start'],$startenddate['end']));
}

View File

@ -29,7 +29,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_Property_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');