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


PHP ilDateTime::getValue方法代码示例

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


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

示例1: writeEvent

 /**
  * write a new event
  *
  * @access protected
  */
 protected function writeEvent()
 {
     $entry = new ilCalendarEntry();
     // Search for summary
     foreach ($this->getContainer()->getItemsByName('SUMMARY', false) as $item) {
         if (is_a($item, 'ilICalProperty')) {
             $entry->setTitle($this->purgeString($item->getValue()));
             break;
         }
     }
     // Search description
     foreach ($this->getContainer()->getItemsByName('DESCRIPTION', false) as $item) {
         if (is_a($item, 'ilICalProperty')) {
             $entry->setDescription($this->purgeString($item->getValue()));
             break;
         }
     }
     // Search location
     foreach ($this->getContainer()->getItemsByName('LOCATION', false) as $item) {
         if (is_a($item, 'ilICalProperty')) {
             $entry->setLocation($this->purgeString($item->getValue()));
             break;
         }
     }
     foreach ($this->getContainer()->getItemsByName('DTSTART') as $start) {
         $fullday = false;
         foreach ($start->getItemsByName('VALUE') as $type) {
             if ($type->getValue() == 'DATE') {
                 $fullday = true;
             }
         }
         $start_tz = $this->default_timezone;
         foreach ($start->getItemsByName('TZID') as $param) {
             $start_tz = $this->getTZ($param->getValue());
         }
         if ($fullday) {
             $start = new ilDate($start->getValue(), IL_CAL_DATE);
         } else {
             $start = new ilDateTime($start->getValue(), IL_CAL_DATETIME, $start_tz->getIdentifier());
         }
         $entry->setStart($start);
         $entry->setFullday($fullday);
     }
     foreach ($this->getContainer()->getItemsByName('DTEND') as $end) {
         $fullday = false;
         foreach ($end->getItemsByName('VALUE') as $type) {
             if ($type->getValue() == 'DATE') {
                 $fullday = true;
             }
         }
         $end_tz = $this->default_timezone;
         foreach ($end->getItemsByName('TZID') as $param) {
             $end_tz = $this->getTZ($param->getValue());
         }
         if ($fullday) {
             $end = new ilDate($end->getValue(), IL_CAL_DATE);
             $end->increment(IL_CAL_DAY, -1);
         } else {
             $end = new ilDateTime($end->getValue(), IL_CAL_DATETIME, $end_tz->getIdentifier());
         }
         $entry->setEnd($end);
         $entry->setFullday($fullday);
     }
     // save calendar event
     if ($this->category->getLocationType() == ilCalendarCategory::LTYPE_REMOTE) {
         $entry->setAutoGenerated(true);
     }
     $entry->save();
     include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
     $ass = new ilCalendarCategoryAssignments($entry->getEntryId());
     $ass->addAssignment($this->category->getCategoryID());
     // Recurrences
     foreach ($this->getContainer()->getItemsByName('RRULE') as $recurrence) {
         #var_dump("<pre>",$recurrence,"</pre>");
         include_once './Services/Calendar/classes/class.ilCalendarRecurrence.php';
         $rec = new ilCalendarRecurrence();
         $rec->setEntryId($entry->getEntryId());
         foreach ($recurrence->getItemsByName('FREQ') as $freq) {
             switch ($freq->getValue()) {
                 case 'DAILY':
                 case 'WEEKLY':
                 case 'MONTHLY':
                 case 'YEARLY':
                     $rec->setFrequenceType((string) $freq->getValue());
                     break;
                 default:
                     $this->log->write(__METHOD__ . ': Cannot handle recurring event of type: ' . $freq->getValue());
                     break 3;
             }
         }
         foreach ($recurrence->getItemsByName('COUNT') as $value) {
             $rec->setFrequenceUntilCount((string) $value->getValue());
             break;
         }
         foreach ($recurrence->getItemsByName('UNTIL') as $until) {
//.........这里部分代码省略.........
开发者ID:arlendotcn,项目名称:ilias,代码行数:101,代码来源:class.ilICalParser.php


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