当前位置: 首页>>代码示例>>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;未经允许,请勿转载。