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


PHP Horde_Date::datestamp方法代码示例

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


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

示例1: setDataValue

 /**
  * Saves the txt_datavalue or int_datavalue depending on context.
  *
  * Folds special data types into a serializable, preferably search-friendly
  * format.
  */
 public function setDataValue($value)
 {
     /* These field-specific handlers should better be delegated to field
      * definitions. */
     switch ($this->property->datatype) {
         case 'date':
         case 'datetime':
         case 'hourminutesecond':
         case 'monthdayyear':
         case 'monthyear':
         case 'time':
             if (is_array($value)) {
                 // Directly passing the array makes funny breakage :(
                 $dt = new Horde_Date();
                 foreach ($value as $marker => $content) {
                     if (strlen($content)) {
                         $dt->{$marker} = $content;
                     }
                 }
                 $value = $dt->datestamp();
             }
             break;
         case 'image':
             $value = $value['hash'];
             break;
     }
     return $this->txt_datavalue = $value;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:34,代码来源:Value.php

示例2: vevent2sif

 public function vevent2sif($vcard)
 {
     /* Some special handling for all-day vEvents that are not passed
      * as TYPE=DATE (TYPE=DATE does not exist for vCalendar 1.0) */
     if (preg_match('/(\\r\\n|\\r|\\n)DTSTART:.*T000000(\\r\\n|\\r|\\n)/', $vcard)) {
         if (preg_match('/(\\r\\n|\\r|\\n)DTEND:(\\d\\d\\d\\d)(\\d\\d)(\\d\\d)T235959(\\r\\n|\\r|\\n)/', $vcard, $m)) {
             $vcard = preg_replace('/(\\r\\n|\\r|\\n)DTSTART:(.*)T000000(\\r\\n|\\r|\\n)/', "\$1DTSTART;VALUE=DATE:\$2\$3", $vcard);
             $vcard = preg_replace('/(\\r\\n|\\r|\\n)DTEND:(.*)T235959(\\r\\n|\\r|\\n)/', "\$1DTEND;VALUE=DATE:\$2\$3", $vcard);
         }
         // @TODO: else: handle case with DTEND= T240000
     }
     $iCal = new Horde_Icalendar();
     if (!$iCal->parsevCalendar($vcard)) {
         // @TODO: NEVER use die() in a library.
         die("There was an error importing the data.");
     }
     $components = $iCal->getComponents();
     switch (count($components)) {
         case 0:
             // @TODO: NEVER use die() in a library.
             die("No data was found.");
         case 1:
             $content = $components[0];
             break;
         default:
             // @TODO: NEVER use die() in a library.
             die("Multiple components found; only one is supported.");
     }
     $hash = array('ReminderSet' => 0, 'IsRecurring' => 0, 'BusyStatus' => 2);
     $alarm = $end = null;
     $start = $content->getAttribute('DTSTART');
     $start_params = $content->getAttribute('DTSTART', true);
     if (!empty($start_params[0]['VALUE']) && $start_params[0]['VALUE'] == 'DATE') {
         $hash['AllDayEvent'] = 1;
         $hash['Start'] = sprintf('%04d-%02d-%02d', $start['year'], $start['month'], $start['mday']);
         $start = mktime(0, 0, 0, $start['month'], $start['mday'], $start['year']);
     } else {
         $hash['AllDayEvent'] = 0;
         $hash['Start'] = Horde_Icalendar::_exportDateTime($start);
     }
     foreach ($content->getAllAttributes() as $item) {
         $GLOBALS['backend']->logMessage(sprintf('Sync4j for name %s, value %s', $item['name'], is_string($item['value']) ? $item['value'] : var_export($item['value'], true)), 'DEBUG');
         switch (Horde_String::upper($item['name'])) {
             case 'DTSTART':
                 break;
             case 'DTEND':
                 if (!empty($item['params']['VALUE']) && $item['params']['VALUE'] == 'DATE') {
                     $hash['AllDayEvent'] = 1;
                     $date = new Horde_Date($item['value']['year'], $item['value']['month'], $item['value']['mday']);
                     $date->mday--;
                     $hash['End'] = $date->format('Y-m-d');
                     $end = $date->datestamp();
                 } else {
                     $hash['AllDayEvent'] = 0;
                     $hash['End'] = Horde_Icalendar::_exportDateTime($item['value']);
                     $end = $item['value'];
                 }
                 break;
             case 'SUMMARY':
                 $hash['Subject'] = $item['value'];
                 break;
             case 'DESCRIPTION':
                 $hash['Body'] = $item['value'];
                 break;
             case 'LOCATION':
                 $hash['Location'] = $item['value'];
                 break;
             case 'CATEGORIES':
                 $hash['Categories'] = $item['value'];
                 break;
             case 'AALARM':
                 $hash['ReminderSet'] = 1;
                 $alarm = $item['value'];
                 break;
             case 'STATUS':
                 switch (Horde_String::upper($item['value'])) {
                     case 'FREE':
                     case 'CANCELLED':
                         $hash['BusyStatus'] = 0;
                         break;
                     case 'TENTATIVE':
                         $hash['BusyStatus'] = 1;
                         break;
                     case 'CONFIRMED':
                         $hash['BusyStatus'] = 2;
                         break;
                 }
                 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;
                 }
//.........这里部分代码省略.........
开发者ID:jubinpatel,项目名称:horde,代码行数:101,代码来源:Sync4j.php

示例3: array

            $url = Horde::url($prefs->getValue('defaultview') . '.php', true)->add('date', $start->dateString());
        }
        // Make sure URL is unique.
        $url->unique()->redirect();
    case 'clear':
        // Remove all the attendees and resources.
        $session->remove('kronolith', 'attendees');
        $session->remove('kronolith', 'resources');
        break;
}
// Pre-format our delete image/link.
$delimg = Horde::img('delete.png', _("Remove Attendee"));
$ident = $injector->getInstance('Horde_Core_Factory_Identity')->create();
$identities = $ident->getAll('id');
$fbView = Kronolith_FreeBusy_View::singleton($view);
$fbOpts = array('start' => $start->datestamp(), 'end' => $end->datestamp());
try {
    $vfb = Kronolith_FreeBusy::getForUser($GLOBALS['registry']->getAuth(), $fbOpts);
    $fbView->addRequiredMember($vfb);
} catch (Exception $e) {
    $notification->push(sprintf(_("Error retrieving your free/busy information: %s"), $e->getMessage()));
}
// Add the Free/Busy information for each attendee.
foreach ($session->get('kronolith', 'attendees') as $attendee) {
    if ($attendee->role != Kronolith::PART_REQUIRED && $attendee->role != Kronolith::PART_OPTIONAL) {
        continue;
    }
    try {
        if ($attendee->user) {
            $vfb = Kronolith_Freebusy::getForUser($attendee->user, $fbOpts);
        } elseif (is_null($attendee->addressObject->host)) {
开发者ID:horde,项目名称:horde,代码行数:31,代码来源:attendees.php


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