當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OC_Calendar_Calendar::addCalendarFromDAVData方法代碼示例

本文整理匯總了PHP中OC_Calendar_Calendar::addCalendarFromDAVData方法的典型用法代碼示例。如果您正苦於以下問題:PHP OC_Calendar_Calendar::addCalendarFromDAVData方法的具體用法?PHP OC_Calendar_Calendar::addCalendarFromDAVData怎麽用?PHP OC_Calendar_Calendar::addCalendarFromDAVData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OC_Calendar_Calendar的用法示例。


在下文中一共展示了OC_Calendar_Calendar::addCalendarFromDAVData方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createCalendar

 /**
  * Creates a new calendar for a principal.
  *
  * If the creation was a success, an id must be returned that can be used to reference
  * this calendar in other methods, such as updateCalendar
  *
  * @param string $principalUri
  * @param string $calendarUri
  * @param array $properties
  * @return mixed
  */
 public function createCalendar($principalUri, $calendarUri, array $properties)
 {
     $fieldNames = array('principaluri', 'uri', 'ctag');
     $values = array(':principaluri' => $principalUri, ':uri' => $calendarUri, ':ctag' => 1);
     // Default value
     $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
     $fieldNames[] = 'components';
     if (!isset($properties[$sccs])) {
         $values[':components'] = 'VEVENT,VTODO';
     } else {
         if (!$properties[$sccs] instanceof \Sabre\CalDAV\Property\SupportedCalendarComponentSet) {
             throw new \Sabre\DAV\Exception('The ' . $sccs . ' property must be of type: \\Sabre\\CalDAV\\Property\\SupportedCalendarComponentSet');
         }
         $values[':components'] = implode(',', $properties[$sccs]->getValue());
     }
     foreach ($this->propertyMap as $xmlName => $dbName) {
         if (isset($properties[$xmlName])) {
             $myValue = $properties[$xmlName];
             $values[':' . $dbName] = $properties[$xmlName];
             $fieldNames[] = $dbName;
         }
     }
     if (!isset($newValues['displayname'])) {
         $newValues['displayname'] = 'unnamed';
     }
     if (!isset($newValues['components'])) {
         $newValues['components'] = 'VEVENT,VTODO';
     }
     if (!isset($newValues['timezone'])) {
         $newValues['timezone'] = null;
     }
     if (!isset($newValues['calendarorder'])) {
         $newValues['calendarorder'] = 0;
     }
     if (!isset($newValues['calendarcolor'])) {
         $newValues['calendarcolor'] = null;
     }
     if (!is_null($newValues['calendarcolor']) && strlen($newValues['calendarcolor']) == 9) {
         $newValues['calendarcolor'] = substr($newValues['calendarcolor'], 0, 7);
     }
     return OC_Calendar_Calendar::addCalendarFromDAVData($principalUri, $calendarUri, $newValues['displayname'], $newValues['components'], $newValues['timezone'], $newValues['calendarorder'], $newValues['calendarcolor']);
 }
開發者ID:AlfredoCubitos,項目名稱:calendar,代碼行數:53,代碼來源:backend.php


注:本文中的OC_Calendar_Calendar::addCalendarFromDAVData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。