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


PHP Horde_Icalendar::exportvCalendar方法代码示例

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


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

示例1: _handle


//.........这里部分代码省略.........
                 }
                 break;
             case 'send':
             case 'reply':
             case 'reply2m':
                 // vfreebusy request.
                 if (isset($components[$key]) && $components[$key]->getType() == 'vFreebusy') {
                     $vFb = $components[$key];
                     // Get the organizer details.
                     try {
                         $organizer = parse_url($vFb->getAttribute('ORGANIZER'));
                     } catch (Horde_Icalendar_Exception $e) {
                         break;
                     }
                     $organizerEmail = $organizer['path'];
                     $organizer = $vFb->getAttribute('ORGANIZER', true);
                     $organizerFullEmail = new Horde_Mail_Rfc822_Address($organizerEmail);
                     if (isset($organizer['cn'])) {
                         $organizerFullEmail->personal = $organizer['cn'];
                     }
                     if ($action == 'reply2m') {
                         $startStamp = time();
                         $endStamp = $startStamp + 60 * 24 * 3600;
                     } else {
                         try {
                             $startStamp = $vFb->getAttribute('DTSTART');
                         } catch (Horde_Icalendar_Exception $e) {
                             $startStamp = time();
                         }
                         try {
                             $endStamp = $vFb->getAttribute('DTEND');
                         } catch (Horde_Icalendar_Exception $e) {
                         }
                         if (!$endStamp) {
                             try {
                                 $duration = $vFb->getAttribute('DURATION');
                                 $endStamp = $startStamp + $duration;
                             } catch (Horde_Icalendar_Exception $e) {
                                 $endStamp = $startStamp + 60 * 24 * 3600;
                             }
                         }
                     }
                     $vfb_reply = $registry->call('calendar/getFreeBusy', array($startStamp, $endStamp));
                     // Find out who we are and update status.
                     $identity = $injector->getInstance('IMP_Identity');
                     $email = $identity->getFromAddress();
                     // Build the reply.
                     $msg_headers = new Horde_Mime_Headers();
                     $vCal = new Horde_Icalendar();
                     $vCal->setAttribute('PRODID', '-//The Horde Project//' . $msg_headers->getUserAgent() . '//EN');
                     $vCal->setAttribute('METHOD', 'REPLY');
                     $vCal->addComponent($vfb_reply);
                     $message = _("Attached is a reply to a calendar request you sent.");
                     $body = new Horde_Mime_Part();
                     $body->setType('text/plain');
                     $body->setCharset('UTF-8');
                     $body->setContents(Horde_String::wrap($message, 76));
                     $ics = new Horde_Mime_Part();
                     $ics->setType('text/calendar');
                     $ics->setCharset('UTF-8');
                     $ics->setContents($vCal->exportvCalendar());
                     $ics->setName('icalendar.ics');
                     $ics->setContentTypeParameter('METHOD', 'REPLY');
                     $mime = new Horde_Mime_Part();
                     $mime->addPart($body);
                     $mime->addPart($ics);
                     // Build the reply headers.
                     $msg_headers->addReceivedHeader(array('dns' => $injector->getInstance('Net_DNS2_Resolver'), 'server' => $conf['server']['name']));
                     $msg_headers->addMessageIdHeader();
                     $msg_headers->addHeader('Date', date('r'));
                     $msg_headers->addHeader('From', $email);
                     $msg_headers->addHeader('To', $organizerFullEmail);
                     $identity->setDefault($vars->identity);
                     $replyto = $identity->getValue('replyto_addr');
                     if (!empty($replyto) && !$email->match($replyto)) {
                         $msg_headers->addHeader('Reply-To', $replyto);
                     }
                     $msg_headers->addHeader('Subject', _("Free/Busy Request Response"));
                     // Send the reply.
                     try {
                         $mime->send($organizerEmail, $msg_headers, $injector->getInstance('IMP_Mail'));
                         $notification->push(_("Reply Sent."), 'horde.success');
                         $result = true;
                     } catch (Exception $e) {
                         $notification->push(sprintf(_("Error sending reply: %s."), $e->getMessage()), 'horde.error');
                     }
                 } else {
                     $notification->push(_("Invalid Action selected for this component."), 'horde.warning');
                 }
                 break;
             case 'nosup':
                 // vFreebusy request.
             // vFreebusy request.
             default:
                 $notification->push(_("This action is not supported."), 'horde.warning');
                 break;
         }
     }
     return $result;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:101,代码来源:ItipRequest.php

示例2: array

 /**
  * Yet another problem: Outlook seems to remove the organizer from
  * the iCal when forwarding -- we put the original sender back in
  * as organizer.
  *
  * @param string        $icaltext  The ical message.
  * @param MIME_Headers  $from      The message sender.
  */
 function _addOrganizer(&$icaltxt, $from)
 {
     global $conf;
     if (isset($conf['kolab']['filter']['email_domain'])) {
         $email_domain = $conf['kolab']['filter']['email_domain'];
     } else {
         $email_domain = 'localhost';
     }
     $iCal = new Horde_Icalendar();
     $iCal->parsevCalendar($icaltxt);
     $vevent =& $iCal->findComponent('VEVENT');
     if ($vevent) {
         $organizer = $vevent->getAttribute('ORGANIZER', true);
         if (is_a($organizer, 'PEAR_Error')) {
             $adrs = imap_rfc822_parse_adrlist($from, $email_domain);
             if (count($adrs) > 0) {
                 $org_email = 'mailto:' . $adrs[0]->mailbox . '@' . $adrs[0]->host;
                 $org_name = $adrs[0]->personal;
                 if ($org_name) {
                     $vevent->setAttribute('ORGANIZER', $org_email, array('CN' => $org_name), false);
                 } else {
                     $vevent->setAttribute('ORGANIZER', $org_email, array(), false);
                 }
                 Horde::log(sprintf("Adding missing organizer '%s <%s>' to iCal.", $org_name, $org_email), 'DEBUG');
                 $icaltxt = $iCal->exportvCalendar();
             }
         }
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:37,代码来源:Outlook.php


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