当前位置: 首页>>代码示例>>PHP>>正文


PHP Tinebase_Backend_Sql_Abstract::setETags方法代码示例

本文整理汇总了PHP中Tinebase_Backend_Sql_Abstract::setETags方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Backend_Sql_Abstract::setETags方法的具体用法?PHP Tinebase_Backend_Sql_Abstract::setETags怎么用?PHP Tinebase_Backend_Sql_Abstract::setETags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tinebase_Backend_Sql_Abstract的用法示例。


在下文中一共展示了Tinebase_Backend_Sql_Abstract::setETags方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: importAllCalendarData

 public function importAllCalendarData($onlyCurrentUserOrganizer = false, $update = false)
 {
     if (count($this->calendarICSs) < 1 && !$this->findAllCalendarICSs()) {
         return false;
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
         Tinebase_Core::getLogger()->info(__METHOD__ . ' ' . __LINE__ . ' Importing all calendar data for user ' . $this->userName . ' with ics uris: ' . print_r(array_keys($this->calendarICSs), true));
     }
     Tinebase_Core::getApplicationInstance($this->appName, $this->modelName)->sendNotifications(false);
     Tinebase_Core::getApplicationInstance($this->appName, $this->modelName)->useNotes(false);
     Sabre\VObject\Component\VCalendar::$propertyMap['ATTACH'] = '\\Calendar_Import_CalDav_SabreAttachProperty';
     $this->decorator->initCalendarImport();
     $application_id = Tinebase_Application::getInstance()->getApplicationByName($this->appName)->getId();
     $type = Tinebase_Model_Container::TYPE_PERSONAL;
     $defaultContainer = Tinebase_Container::getInstance()->getDefaultContainer($this->modelName);
     $defaultCalendarsName = $this->_getDefaultCalendarsName();
     foreach ($this->calendarICSs as $calUri => $calICSs) {
         if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
             Tinebase_Core::getLogger()->info(__METHOD__ . ' ' . __LINE__ . ' Processing calendar ' . print_r($this->calendars[$calUri], true));
         }
         $container = $this->findContainerForCalendar($calUri, $this->calendars[$calUri]['displayname'], $defaultCalendarsName, $type, $application_id);
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
             Tinebase_Core::getLogger()->trace(__METHOD__ . ' ' . __LINE__ . ' User container: ' . print_r($container->toArray(), true));
         }
         $this->decorator->setCalendarProperties($container, $this->calendars[$calUri]);
         // we shouldnt do the grants here as the caldav user file may not contain all users, so setting the grants wont work properly!
         // use importAllCalendars to have the grants set
         //$grants = $this->getCalendarGrants($calUri);
         //Tinebase_Container::getInstance()->setGrants($container->getId(), $grants, TRUE, FALSE);
         $start = 0;
         $max = count($calICSs);
         do {
             $etags = array();
             $requestEnd = '';
             for ($i = $start; $i < $max && $i < $this->maxBulkRequest + $start; ++$i) {
                 if (in_array($calICSs[$i], $this->_icsBlacklist)) {
                     if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
                         Tinebase_Core::getLogger()->info(__METHOD__ . ' ' . __LINE__ . ' Ignoring blacklisted ics: ' . $calICSs[$i]);
                     }
                     continue;
                 }
                 $requestEnd .= '  <a:href>' . $calICSs[$i] . "</a:href>\n";
             }
             $start = $i;
             $requestEnd .= '</b:calendar-multiget>';
             $result = $this->calDavRequest('REPORT', $calUri, self::getAllCalendarDataRequest . $requestEnd, 1);
             foreach ($result as $key => $value) {
                 if (!isset($value['{urn:ietf:params:xml:ns:caldav}calendar-data'])) {
                     continue;
                 }
                 $data = $value['{urn:ietf:params:xml:ns:caldav}calendar-data'];
                 if (strpos($data, 'BEGIN:' . $this->skipComonent) !== false) {
                     if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
                         Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Skipping ' . $this->skipComonent);
                     }
                     continue;
                 }
                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                     Tinebase_Core::getLogger()->debug(__METHOD__ . ' ' . __LINE__ . ' Processing caldav record: ' . $key);
                 }
                 $name = explode('/', $key);
                 $name = end($name);
                 $id = $this->_getEventIdFromName($name);
                 try {
                     if ($update && in_array($id, $this->existingRecordIds[$calUri])) {
                         $webdavFrontend = new $this->webdavFrontend($container, $id);
                         // @todo move this to separate fn
                         if ($onlyCurrentUserOrganizer && $this->modelName === 'Calendar_Model_Event') {
                             // assert current user is organizer
                             if ($webdavFrontend->getRecord()->organizer && $webdavFrontend->getRecord()->organizer == Tinebase_Core::getUser()->contact_id) {
                                 $webdavFrontend->put($data);
                             } else {
                                 continue;
                             }
                         } else {
                             $webdavFrontend->put($data);
                         }
                     } else {
                         $webdavFrontend = call_user_func_array(array($this->webdavFrontend, 'create'), array($container, $name, $data, $onlyCurrentUserOrganizer));
                     }
                     if ($webdavFrontend) {
                         $etags[$webdavFrontend->getRecord()->getId()] = $value['{DAV:}getetag'];
                     }
                 } catch (Exception $e) {
                     if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
                         Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Could not create event from data: ' . $data);
                     }
                     Tinebase_Exception::log($e, false);
                 }
             }
             $this->_recordBackend->setETags($etags);
         } while ($start < $max);
     }
     return true;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:95,代码来源:Client.php


注:本文中的Tinebase_Backend_Sql_Abstract::setETags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。