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


PHP Horde_Icalendar::_exportDateTime方法代码示例

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


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

示例1: vtodo2sif

 public function vtodo2sif($vcard)
 {
     $iCal = new Horde_Icalendar();
     if (!$iCal->parsevCalendar($vcard)) {
         return PEAR::raiseError('There was an error importing the data.');
     }
     $components = $iCal->getComponents();
     switch (count($components)) {
         case 0:
             return PEAR::raiseError('No data was found');
         case 1:
             $content = $components[0];
             break;
         default:
             return PEAR::raiseError('Multiple components found; only one is supported.');
     }
     $hash['Complete'] = 0;
     $due = false;
     $attr = $content->getAllAttributes();
     foreach ($attr as $item) {
         switch ($item['name']) {
             case 'SUMMARY':
                 $hash['Subject'] = $item['value'];
                 break;
             case 'DESCRIPTION':
                 $hash['Body'] = $item['value'];
                 break;
             case 'PRIORITY':
                 if ($item['value'] == 1) {
                     $hash['Importance'] = 2;
                 } elseif ($item['value'] == 5) {
                     $hash['Importance'] = 0;
                 } else {
                     $hash['Importance'] = 1;
                 }
                 break;
             case 'DTSTART':
                 $hash['StartDate'] = Horde_Icalendar::_exportDateTime($item['value']);
                 break;
             case 'DUE':
                 $hash['DueDate'] = Horde_Icalendar::_exportDateTime($item['value']);
                 $due = $item['value'];
                 break;
             case 'AALARM':
                 $hash['ReminderTime'] = $item['value'];
                 $hash['ReminderSet'] = 1;
                 break;
             case 'STATUS':
                 $hash['Complete'] = $item['value'] == 'COMPLETED' ? 1 : 0;
                 break;
             case 'CATEGORIES':
                 $hash['Categories'] = $item['value'];
                 break;
             case 'CLASS':
                 switch (Horde_String::upper($item['value'])) {
                     case 'PUBLIC':
                         $hash['Sensitivity'] = 0;
                         break;
                     case 'PRIVATE':
                         $hash['Sensitivity'] = 2;
                         break;
                     case 'CONFIDENTIAL':
                         $hash['Sensitivity'] = 3;
                         break;
                 }
                 break;
         }
     }
     if ($due && !isset($hash['ReminderSet'])) {
         // Parse VALARM components.
         foreach ($content->getComponents() as $component) {
             if ($component->getType() != 'vAlarm') {
                 continue;
             }
             try {
                 $trigger = $component->getAttribute('TRIGGER');
             } catch (Horde_Icalendar_Exception $e) {
                 continue;
             }
             if (is_array($trigger) || empty($trigger)) {
                 continue;
             }
             $hash['ReminderSet'] = 1;
             $hash['ReminderTime'] = Horde_Icalendar::_exportDateTime($due - $trigger);
         }
     }
     return Horde_SyncMl_Device_sync4j::array2sif($hash, '<?xml version="1.0"?><task>', '</task>');
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:88,代码来源:Sync4j.php

示例2: toRRule20

 /**
  * Creates an iCalendar 2.0 recurrence rule.
  *
  * @link http://rfc.net/rfc2445.html#s4.3.10
  * @link http://rfc.net/rfc2445.html#s4.8.5
  * @link http://www.shuchow.com/vCalAddendum.html
  *
  * @param Horde_Icalendar $calendar  A Horde_Icalendar object instance.
  *
  * @return string  An iCalendar 2.0 conform RRULE value.
  */
 public function toRRule20($calendar)
 {
     switch ($this->recurType) {
         case self::RECUR_NONE:
             return '';
         case self::RECUR_DAILY:
             $rrule = 'FREQ=DAILY;INTERVAL=' . $this->recurInterval;
             break;
         case self::RECUR_WEEKLY:
             $rrule = 'FREQ=WEEKLY;INTERVAL=' . $this->recurInterval . ';BYDAY=';
             $vcaldays = array('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA');
             for ($i = $flag = 0; $i <= 7; ++$i) {
                 if ($this->recurOnDay(pow(2, $i))) {
                     if ($flag) {
                         $rrule .= ',';
                     }
                     $rrule .= $vcaldays[$i];
                     $flag = true;
                 }
             }
             break;
         case self::RECUR_MONTHLY_DATE:
             $rrule = 'FREQ=MONTHLY;INTERVAL=' . $this->recurInterval;
             break;
         case self::RECUR_MONTHLY_WEEKDAY:
             if (isset($this->recurNthDay)) {
                 $nth_weekday = $this->recurNthDay;
                 $day_of_week = log($this->recurData, 2);
             } else {
                 $day_of_week = $this->start->dayOfWeek();
                 $nth_weekday = (int) ($this->start->mday / 7);
                 if ($this->start->mday % 7 > 0) {
                     $nth_weekday++;
                 }
             }
             $vcaldays = array('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA');
             $rrule = 'FREQ=MONTHLY;INTERVAL=' . $this->recurInterval . ';BYDAY=' . $nth_weekday . $vcaldays[$day_of_week];
             break;
         case self::RECUR_YEARLY_DATE:
             $rrule = 'FREQ=YEARLY;INTERVAL=' . $this->recurInterval;
             break;
         case self::RECUR_YEARLY_DAY:
             $rrule = 'FREQ=YEARLY;INTERVAL=' . $this->recurInterval . ';BYYEARDAY=' . $this->start->dayOfYear();
             break;
         case self::RECUR_YEARLY_WEEKDAY:
             if (isset($this->recurNthDay)) {
                 $nth_weekday = $this->recurNthDay;
                 $day_of_week = log($this->recurData, 2);
             } else {
                 $day_of_week = $this->start->dayOfWeek();
                 $nth_weekday = (int) ($this->start->mday / 7);
                 if ($this->start->mday % 7 > 0) {
                     $nth_weekday++;
                 }
             }
             $months = !empty($this->recurMonths) ? join(',', $this->recurMonths) : $this->start->month;
             $vcaldays = array('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA');
             $rrule = 'FREQ=YEARLY;INTERVAL=' . $this->recurInterval . ';BYDAY=' . $nth_weekday . $vcaldays[$day_of_week] . ';BYMONTH=' . $this->start->month;
             break;
     }
     if ($this->hasRecurEnd()) {
         $recurEnd = clone $this->recurEnd;
         $rrule .= ';UNTIL=' . $calendar->_exportDateTime($recurEnd);
     }
     if ($count = $this->getRecurCount()) {
         $rrule .= ';COUNT=' . $count;
     }
     return $rrule;
 }
开发者ID:claudineyqr,项目名称:Kolab-Roundcube-Calendar,代码行数:80,代码来源:Horde_Date_Recurrence.php


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