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


PHP Horde_Date::format方法代码示例

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


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

示例1: processRequest

 public function processRequest(Horde_Controller_Request $request, Horde_Controller_Response $response)
 {
     $this->_mapper = $GLOBALS['injector']->getInstance('Horde_Routes_Mapper');
     $this->_matchDict = new Horde_Support_Array($this->_mapper->match($request->getPath()));
     $injector = $this->getInjector();
     switch ($this->_matchDict->action) {
         case 'category':
             $driver = $injector->getInstance('Dolcore_Factory_Driver')->create($injector);
             $categories = $driver->getCategoriesApi();
             $discussionApi = $driver->getDiscussionApi();
             $category = $categories->getCategory($this->_matchDict->category);
             /* Write a category's currently running Umfragen */
             $now = new Horde_Date(time());
             $template = $this->getInjector()->createInstance('Horde_Template');
             $template->set('updated', $now->format(DATE_ATOM));
             $template->set('category_caption', $category->getCaption());
             $template->set('category_id', $category->id);
             $discussions = array();
             foreach ($discussionApi->listDiscussions(array('category' => $category->id)) as $discussion) {
                 $discussions[$discussion->id]['title'] = $discussion->text;
                 $discussions[$discussion->id]['details'] = $discussion->hintergrund;
                 $discussions[$discussion->id]['modified'] = $discussion->erstelldatum;
                 $discussions[$discussion->id]['id'] = Dolcore::getUrlFor('discussion', array('discussion_id' => $discussion->id), true, true);
                 $discussions[$discussion->id]['url'] = Dolcore::getUrlFor('discussion', array('discussion_id' => $discussion->id), true, true);
             }
             $template->set('discussions', $discussions);
             $response->setBody($template->fetch(DOLCORE_TEMPLATES . '/feeds/atom.xml'));
             break;
         case 'categories':
             break;
     }
 }
开发者ID:ralflang,项目名称:dolcore,代码行数:32,代码来源:Feed.php

示例2: __construct

 /**
  * Constructor.
  *
  * @param array $config  Configuration key-value pairs.
  */
 public function __construct($config = array())
 {
     global $prefs, $registry;
     parent::__construct($config);
     $blank = new Horde_Url();
     $this->addNewButton(_("_New Event"), $blank, array('id' => 'kronolithNewEvent'));
     $this->newExtra = $blank->link(array_merge(array('id' => 'kronolithQuickEvent'), Horde::getAccessKeyAndTitle(_("Quick _insert"), false, true)));
     $sidebar = $GLOBALS['injector']->createInstance('Horde_View');
     /* Minical. */
     $today = new Horde_Date($_SERVER['REQUEST_TIME']);
     $sidebar->today = $today->format('F Y');
     $sidebar->weekdays = array();
     for ($i = $prefs->getValue('week_start_monday'), $c = $i + 7; $i < $c; $i++) {
         $weekday = Horde_Nls::getLangInfo(constant('DAY_' . ($i % 7 + 1)));
         $sidebar->weekdays[$weekday] = Horde_String::substr($weekday, 0, 2);
     }
     /* Calendars. */
     $sidebar->newShares = $registry->getAuth() && !$prefs->isLocked('default_share');
     $sidebar->admin = $registry->isAdmin();
     $sidebar->resourceAdmin = $registry->isAdmin() || $GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('resource_management');
     $sidebar->resources = $GLOBALS['conf']['resources']['enabled'];
     $sidebar->addRemote = !$prefs->isLocked('remote_cals');
     $remotes = unserialize($prefs->getValue('remote_cals'));
     $sidebar->showRemote = !($prefs->isLocked('remote_cals') && empty($remotes));
     $this->content = $sidebar->render('dynamic/sidebar');
 }
开发者ID:horde,项目名称:horde,代码行数:31,代码来源:Sidebar.php

示例3: __construct

 /**
  *
  * @global Horde_Prefs $prefs
  * @param Horde_Date $date
  *
  * @return Kronolith_View_Month
  */
 public function __construct(Horde_Date $date)
 {
     global $prefs;
     $this->month = $date->month;
     $this->year = $date->year;
     // Need to calculate the start and length of the view.
     $this->date = new Horde_Date($date);
     $this->date->mday = 1;
     $this->_startday = $this->date->dayOfWeek();
     if (!$prefs->getValue('week_start_monday')) {
         $this->_startOfView = 1 - $this->_startday;
     } else {
         if ($this->_startday == Horde_Date::DATE_SUNDAY) {
             $this->_startOfView = -5;
         } else {
             $this->_startOfView = 2 - $this->_startday;
         }
     }
     $startDate = new Horde_Date($this->year, $this->month, $this->_startOfView);
     $this->_endDate = new Horde_Date($this->year, $this->month, Horde_Date_Utils::daysInMonth($this->month, $this->year) + 1);
     $this->_endDate->mday += (7 - ($this->_endDate->format('w') - $prefs->getValue('week_start_monday'))) % 7;
     if ($prefs->getValue('show_shared_side_by_side')) {
         $allCalendars = Kronolith::listInternalCalendars();
         $this->_currentCalendars = array();
         foreach ($GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_CALENDARS) as $id) {
             $this->_currentCalendars[$id] = $allCalendars[$id];
         }
     } else {
         $this->_currentCalendars = array('internal_0' => true);
     }
     try {
         $this->_events = Kronolith::listEvents($startDate, $this->_endDate);
     } catch (Exception $e) {
         $GLOBALS['notification']->push($e, 'horde.error');
         $this->_events = array();
     }
     if (!is_array($this->_events)) {
         $this->_events = array();
     }
 }
开发者ID:horde,项目名称:horde,代码行数:47,代码来源:Month.php

示例4: toString

 /**
  * Output a human readable description of the recurrence rule.
  *
  * @return string
  * @since 2.1.0
  */
 public function toString($date_format)
 {
     $string = '';
     if ($this->hasRecurType(self::RECUR_DAILY)) {
         $string = _("Daily: Recurs every") . ' ' . $this->getRecurInterval() . ' ' . _("day(s)");
     } elseif ($this->hasRecurType(self::RECUR_WEEKLY)) {
         $weekdays = array();
         if ($this->recurOnDay(Horde_Date::MASK_MONDAY)) {
             $weekdays[] = _("Monday");
         }
         if ($this->recurOnDay(Horde_Date::MASK_TUESDAY)) {
             $weekdays[] = _("Tuesday");
         }
         if ($this->recurOnDay(Horde_Date::MASK_WEDNESDAY)) {
             $weekdays[] = _("Wednesday");
         }
         if ($this->recurOnDay(Horde_Date::MASK_THURSDAY)) {
             $weekdays[] = _("Thursday");
         }
         if ($this->recurOnDay(Horde_Date::MASK_FRIDAY)) {
             $weekdays[] = _("Friday");
         }
         if ($this->recurOnDay(Horde_Date::MASK_SATURDAY)) {
             $weekdays[] = _("Saturday");
         }
         if ($this->recurOnDay(Horde_Date::MASK_SUNDAY)) {
             $weekdays[] = _("Sunday");
         }
         $string = _("Weekly: Recurs every") . ' ' . $this->getRecurInterval() . ' ' . _("week(s) on:") . ' ' . implode(', ', $weekdays);
     } elseif ($this->hasRecurType(self::RECUR_MONTHLY_DATE)) {
         $string = _("Monthly: Recurs every") . ' ' . $this->getRecurInterval() . ' ' . _("month(s)") . ' ' . _("on the same date");
     } elseif ($this->hasRecurType(self::RECUR_MONTHLY_WEEKDAY)) {
         $string = _("Monthly: Recurs every") . ' ' . $this->getRecurInterval() . ' ' . _("month(s)") . ' ' . _("on the same weekday");
     } elseif ($this->hasRecurType(self::RECUR_MONTHLY_LAST_WEEKDAY)) {
         $string = _("Monthly: Recurs every") . ' ' . $this->getRecurInterval() . ' ' . _("month(s)") . ' ' . _("on the same last weekday");
     } elseif ($this->hasRecurType(self::RECUR_YEARLY_DATE)) {
         $string = _("Yearly: Recurs every") . ' ' . $this->getRecurInterval() . ' ' . _("year(s) on the same date");
     } elseif ($this->hasRecurType(self::RECUR_YEARLY_DAY)) {
         $string = _("Yearly: Recurs every") . ' ' . $this->getRecurInterval() . ' ' . _("year(s) on the same day of the year");
     } elseif ($this->hasRecurType(self::RECUR_YEARLY_WEEKDAY)) {
         $string = _("Yearly: Recurs every") . ' ' . $this->getRecurInterval() . ' ' . _("year(s) on the same weekday and month of the year");
     }
     $string .= "\n" . _("Ends after") . ': ' . ($this->hasRecurEnd() ? $this->recurEnd->strftime($date_format) . ($this->recurEnd->hour == 23 && $this->recurEnd->min == 59 ? '' : ' ' . $this->recurEnd->format($date_format)) : ($this->getRecurCount() ? sprintf(_("%d times"), $this->getRecurCount()) : _("No end date")));
     if ($this->getExceptions()) {
         $string .= "\n" . _("Exceptions on") . ': ';
         foreach ($this->getExceptions() as $exception_date) {
             $string .= $this->_formatExceptionDate($exception_date, $date_format) . ' ';
         }
     }
     return $string;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:57,代码来源:Recurrence.php

示例5: testFile

 /**
  * @dataProvider timezones
  */
 public function testFile($file)
 {
     $result = '';
     $ical = new Horde_Icalendar();
     $ical->parsevCalendar(file_get_contents($file));
     foreach ($ical->getComponents() as $component) {
         if ($component->getType() != 'vEvent') {
             continue;
         }
         $date = $component->getAttribute('DTSTART');
         if (is_array($date)) {
             continue;
         }
         $result .= str_replace("\r", '', $component->getAttribute('SUMMARY')) . "\n";
         $d = new Horde_Date($date);
         $result .= $d->format('H:i') . "\n";
     }
     $this->assertStringEqualsFile(__DIR__ . '/fixtures/vTimezone/' . basename($file, 'ics') . 'txt', $result, 'Failed parsing file ' . basename($file));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:22,代码来源:TimezonesTest.php

示例6: normalizePoomContactsDates

 /**
  * Return the number of hours to offset a POOMCONTACTS:BIRTHDAY
  * or ANNIVERSARY field in an attempt to work around a bug in the
  * protocol - which doesn't define a standard time for birthdays to occur.
  *
  *  WP:
  *     Devices seem to send the birthdays at the entered date, with
  *     a time of 00:00:00 UTC during standard time and with 01:00:00 UTC
  *     during DST if the client's configured timezone observes it. No idea
  *     what purpose this serves since no timezone data is transmitted for
  *     birthday values.
  *
  *   iOS:
  *     Seems different based on version. iOS 5+, at least seems to send
  *     the birthday as midnight at the entered date in the device's timezone
  *     then converted to UTC. Some minor issues with offsets being off an
  *     hour or two for some timezones though.
  *
  *     iOS < 5 sends the birthday time part as the time the birthday
  *     was entered/edited on the device, converted to UTC, so it can't be
  *     trusted at all. The best we can do here is transform the date to
  *     midnight on date_default_timezone() converted to UTC.
  *
  *   Android:
  *     For contacts originating on the SERVER, the following is true:
  *
  *     Stock 4.3 Takes the down-synched bday value which is assumed to be
  *     UTC, does some magic to it (converts to milliseconds, creates a
  *     gregorian calendar object, then converts to YYYY-MM-DD). When
  *     sending the bday value up, it sends it up as-is. No conversion
  *     to/from UTC or local is done.
  *
  *     Stock 4.4.x does the above, but before sending the bday value,
  *     validates that it's in a correct format for sending to the server.
  *     This really only affects date data originally entered on the device
  *     for non-stock android clients.
  *
  *     There is some strange bit of code in Android that adds 1 to the
  *     DAY_OF_MONTH when HOUR_OF_DAY >= 12 in an attempt to "fix"
  *     birthday handling for GMT+n users. See:
  *     https://android.googlesource.com/platform/packages/apps/Exchange/+/32daacdd71b9de8fd5e3f59c37934e3e4a9fa972%5E!/exchange2/src/com/android/exchange/adapter/ContactsSyncAdapter.java
  *     Not sure what to make of it, or why it's not just converted to
  *     local tz when displaying but this probably breaks birthday handling
  *     for people in a few timezones.
  *
  *     For contacts originating on the CLIENT, the datetime is sent as
  *     08:00:00 UTC, and this seems to be regardless of the timezone set
  *     in the Android system.
  *
  *     Given all of this, it makes sense to me to ALWAYS send birthday
  *     data as occuring at 08:00:00 UTC for *native* Android clients.
  *
  *   BB 10+ expects it at 12:00:00 UTC
  *
  * @param Horde_Date $date  The date. This should normally be in the local
  *                          timezone if encoding the date for the client.
  *                          If decoding the date from the client, it will
  *                          normally be in UTC.
  * @param boolean $toEas    Convert from local to device if true.
  *                          DEFAULT: false
  *
  * @return Horde_Date  The date of the birthday/anniversary, with
  *                     any fixes applied for the current device. The
  *                     timezone set in the object will depend on the
  *                     client detected, and whether the date is being
  *                     encoding or decoding.
  */
 public function normalizePoomContactsDates($date, $toEas = false)
 {
     switch (Horde_String::lower($this->clientType)) {
         case self::TYPE_WP:
         case 'wp8':
             // Legacy. Remove in H6.
         // Legacy. Remove in H6.
         case 'wp':
             // Legacy. Remove in H6.
             if ($toEas) {
                 return new Horde_Date($date->format('Y-m-d'), 'UTC');
             } else {
                 $date = new Horde_Date($date->format('Y-m-d'));
                 return $date->setTimezone('UTC');
             }
         case self::TYPE_ANDROID:
             // Need to protect against clients that don't send the actual Android
             // version in the OS field.
             if (stripos($this->deviceType, 'samsung') === 0) {
                 // Samsung's native Contacts app works differently than stock
                 // Android, always sending as 00:00:00
                 if ($toEas) {
                     return new Horde_Date($date->format('Y-m-d'), 'UTC');
                 }
                 $date = new Horde_Date($date->format('Y-m-d'));
                 return $date->setTimezone('UTC');
             }
             if ($this->getMajorVersion() >= 4 && $this->getMajorVersion() <= 10) {
                 if ($toEas) {
                     return new Horde_Date($date->format('Y-m-d 08:00:00'), 'UTC');
                 } else {
                     $date = new Horde_Date($date->format('Y-m-d'));
                     return $date->setTimezone('UTC');
//.........这里部分代码省略.........
开发者ID:platolin,项目名称:horde,代码行数:101,代码来源:Device.php

示例7: _generateOffsetsForTransition

 /**
  * Calculate the offsets for the specified transition
  *
  * @param array $offsets      A TZ offset hash
  * @param array $transition   A transition hash
  * @param string $type        Transition type - dst or std
  *
  * @return array  A populated offset hash
  */
 protected static function _generateOffsetsForTransition(array $offsets, array $transition, $type)
 {
     // We can't use Horde_Date directly here, since it is unable to
     // properly convert to UTC from local ON the exact hour of a std -> dst
     // transition. This is due to a conversion to DateTime in the localtime
     // zone internally before the timezone change is applied
     $transitionDate = new DateTime($transition['time']);
     $transitionDate->setTimezone(new DateTimeZone('UTC'));
     $transitionDate = new Horde_Date($transitionDate);
     $offsets[$type . 'month'] = $transitionDate->format('n');
     $offsets[$type . 'day'] = $transitionDate->format('w');
     $offsets[$type . 'minute'] = (int) $transitionDate->format('i');
     $offsets[$type . 'hour'] = (int) $transitionDate->format('H');
     for ($i = 5; $i > 0; $i--) {
         if (self::_isNthOcurrenceOfWeekdayInMonth($transition['ts'], $i)) {
             $offsets[$type . 'week'] = $i;
             break;
         }
     }
     return $offsets;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:30,代码来源:Timezone.php

示例8: _getEvents

 private function _getEvents($dh, $startDate, $endDate)
 {
     $events = array();
     for ($date = new Horde_Date($startDate); $date->compareDate($endDate) <= 0; $date->mday++) {
         $holidays = $dh->getHolidayForDate($date->format('Y-m-d'), null, true);
         if (Date_Holidays::isError($holidays)) {
             Horde::log(sprintf('Unable to retrieve list of holidays from %s to %s', (string) $startDate, (string) $endDate), __FILE__, __LINE__);
             continue;
         }
         if (is_null($holidays)) {
             continue;
         }
         foreach ($holidays as $holiday) {
             $event = new Kronolith_Event_Holidays($this, $holiday);
             $events[] = $event;
         }
     }
     return $events;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:19,代码来源:Holidays.php

示例9: toJson

 /**
  * Returns a simple object suitable for json transport representing this
  * task.
  *
  * @param boolean $full        Whether to return all task details.
  * @param string $time_format  The date() format to use for time formatting.
  *
  * @return object  A simple object.
  */
 public function toJson($full = false, $time_format = 'H:i')
 {
     $json = new stdClass();
     $json->l = $this->tasklist;
     $json->p = $this->parent_id;
     $json->i = $this->indent;
     $json->n = $this->name;
     if ($this->desc) {
         //TODO: Get the proper amount of characters, and cut by last
         //whitespace
         $json->sd = Horde_String::substr($this->desc, 0, 80);
     }
     $json->cp = (bool) $this->completed;
     if ($this->due && ($due = $this->getNextDue())) {
         $json->du = $due->toJson();
     }
     if ($this->start && ($start = $this->getNextStart())) {
         $json->s = $start->toJson();
     }
     $json->pr = (int) $this->priority;
     if ($this->recurs()) {
         $json->r = $this->recurrence->getRecurType();
     }
     $json->t = array_values($this->tags);
     if ($full) {
         // @todo: do we really need all this?
         $json->id = $this->id;
         $json->de = $this->desc;
         if ($this->due) {
             $date = new Horde_Date($this->due);
             $json->dd = $date->strftime('%x');
             $json->dt = $date->format($time_format);
         }
         $json->as = $this->assignee;
         if ($this->estimate) {
             $json->e = $this->estimate;
         }
         /*
         $json->o = $this->owner;
         
         if ($this->completed_date) {
             $date = new Horde_Date($this->completed_date);
             $json->cd = $date->toJson();
         }
         */
         $json->a = (int) $this->alarm;
         $json->m = $this->methods;
         //$json->pv = (boolean)$this->private;
         if ($this->recurs()) {
             $json->r = $this->recurrence->toJson();
         }
         if ($this->tasklist == '**EXTERNAL**') {
             $json->vl = (string) $this->view_link;
             $json->cl = (string) $this->complete_link;
             $json->pe = $json->pd = false;
         } else {
             try {
                 $share = $GLOBALS['nag_shares']->getShare($this->tasklist);
             } catch (Horde_Share_Exception $e) {
                 Horde::log($e->getMessage(), 'ERR');
                 throw new Nag_Exception($e);
             }
             $json->pe = $share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT);
             $json->pd = $share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE);
         }
     }
     return $json;
 }
开发者ID:GenerationLabs,项目名称:horde,代码行数:77,代码来源:Task.php

示例10: _exifToTags

 /**
  * Adds specified EXIF fields to this image's tags.
  * Called during image upload/creation.
  *
  * @param array $fields  An array of EXIF fields to import as a tag.
  *
  * @return void
  */
 protected function _exifToTags(array $fields = array())
 {
     $tags = array();
     foreach ($fields as $field) {
         if (!empty($this->_exif[$field])) {
             if (substr($field, 0, 8) == 'DateTime') {
                 $d = new Horde_Date(strtotime($this->_exif[$field]));
                 $tags[] = $d->format("Y-m-d");
             } elseif ($field == 'Keywords') {
                 $tags = array_merge($tags, explode(',', $this->_exif[$field]));
             } else {
                 $tags[] = $this->_exif[$field];
             }
         }
     }
     $this->_tags = array_merge($this->_tags, $tags);
 }
开发者ID:platolin,项目名称:horde,代码行数:25,代码来源:Image.php

示例11: _formatDate

 /**
  * Oh yeah. This is beautiful. Exchange outputs date fields differently in
  * calendar items and emails. We could just always send one or the other,
  * but unfortunately nokia's 'Mail for exchange' depends on this quirk.
  * So we have to send a different date type depending on where it's used.
  * Used when encoding a date value to send to the client.
  *
  * @param Horde_Date $dt  The Horde_Date object to format
  *                        (should normally be in local tz).
  * @param integer $type   The type to format as: One of
  *     TYPE_DATE or TYPE_DATE_DASHES, TYPE_DATE_LOCAL
  *
  * @return string  The formatted date
  * @throws  InvalidArgumentException
  */
 protected function _formatDate(Horde_Date $dt, $type)
 {
     switch ($type) {
         case self::TYPE_DATE:
             return $dt->setTimezone('UTC')->format('Ymd\\THis\\Z');
         case self::TYPE_DATE_DASHES:
             return $dt->setTimezone('UTC')->format('Y-m-d\\TH:i:s\\.000\\Z');
         case self::TYPE_DATE_LOCAL:
             return $dt->format('Y-m-d\\TH:i:s\\.000\\Z');
         default:
             throw new InvalidArgumentException('Unidentified DATE_TYPE');
     }
 }
开发者ID:horde,项目名称:horde,代码行数:28,代码来源:Base.php

示例12: getTimeRange

 /**
  * @return string  The time range of the event ("All Day", "1:00pm-3:00pm",
  *                 "08:00-22:00").
  */
 public function getTimeRange()
 {
     if ($this->isAllDay()) {
         return _("All day");
     } elseif (($cmp = $this->start->compareDate($this->end)) > 0) {
         $df = $GLOBALS['prefs']->getValue('date_format');
         if ($cmp > 0) {
             return $this->end->strftime($df) . '-' . $this->start->strftime($df);
         } else {
             return $this->start->strftime($df) . '-' . $this->end->strftime($df);
         }
     } else {
         $twentyFour = $GLOBALS['prefs']->getValue('twentyFour');
         return $this->start->format($twentyFour ? 'G:i' : 'g:ia') . '-' . $this->end->format($twentyFour ? 'G:i' : 'g:ia');
     }
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:20,代码来源:Event.php

示例13: htmlspecialchars

        $desc = $event->isPrivate() ? '' : htmlspecialchars($event->description);
        if (strlen($desc)) {
            $desc .= '<br /><br />';
        }
        /* Time. */
        $desc .= _("When:") . ' ' . $event->start->strftime($prefs->getValue('date_format')) . ' ' . $event->start->format($twentyFour ? 'H:i' : 'H:ia') . _(" to ");
        if ($event->start->compareDate($event->end->timestamp()) == 0) {
            $desc .= $event->end->format($twentyFour ? 'H:i' : 'h:ia');
        } else {
            $desc .= $event->end->strftime($prefs->getValue('date_format')) . ' ' . $event->end->format($twentyFor ? 'H:i' : 'h:ia');
        }
        /* Attendees. */
        if (!$event->isPrivate()) {
            $attendees = Kronolith::getAttendeeEmailList($event->attendees);
            if (count($attendees)) {
                $desc .= '<br />' . _("Who:") . ' ' . htmlspecialchars(strval($attendees));
            }
            if (strlen($event->location)) {
                $desc .= '<br />' . _("Where:") . ' ' . htmlspecialchars($event->location);
            }
        }
        $desc .= '<br />' . _("Event Status:") . ' ' . Kronolith::statusToString($event->status);
        $entries[$id]['title'] = htmlspecialchars($event->getTitle());
        $entries[$id]['desc'] = htmlspecialchars($desc);
        $entries[$id]['url'] = htmlspecialchars(Horde::url($event->getViewUrl(), true, -1));
        $entries[$id]['modified'] = $modified->format(DATE_ATOM);
    }
}
$template->set('entries', $entries, true);
$browser->downloadHeaders($calendar . '.xml', 'text/xml', true);
echo $template->fetch(KRONOLITH_TEMPLATES . '/feeds/' . $feed_type . '.xml');
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:index.php

示例14: nextRecurrence

 /**
  * Finds the next recurrence of this event that's after $afterDate.
  *
  * @param Horde_Date|string $after  Return events after this date.
  *
  * @return Horde_Date|boolean  The date of the next recurrence or false
  *                             if the event does not recur after
  *                             $afterDate.
  */
 public function nextRecurrence($after)
 {
     if (!$after instanceof Horde_Date) {
         $after = new Horde_Date($after);
     } else {
         $after = clone $after;
     }
     // Make sure $after and $this->start are in the same TZ
     $after->setTimezone($this->start->timezone);
     if ($this->start->compareDateTime($after) >= 0) {
         return clone $this->start;
     }
     if ($this->recurInterval == 0 && empty($this->rdates)) {
         return false;
     }
     switch ($this->getRecurType()) {
         case self::RECUR_DAILY:
             $diff = $this->start->diff($after);
             $recur = ceil($diff / $this->recurInterval);
             if ($this->recurCount && $recur >= $this->recurCount) {
                 return false;
             }
             $recur *= $this->recurInterval;
             $next = $this->start->add(array('day' => $recur));
             if ((!$this->hasRecurEnd() || $next->compareDateTime($this->recurEnd) <= 0) && $next->compareDateTime($after) >= 0) {
                 return $next;
             }
             break;
         case self::RECUR_WEEKLY:
             if (empty($this->recurData)) {
                 return false;
             }
             $start_week = Horde_Date_Utils::firstDayOfWeek($this->start->format('W'), $this->start->year);
             $start_week->timezone = $this->start->timezone;
             $start_week->hour = $this->start->hour;
             $start_week->min = $this->start->min;
             $start_week->sec = $this->start->sec;
             // Make sure we are not at the ISO-8601 first week of year while
             // still in month 12...OR in the ISO-8601 last week of year while
             // in month 1 and adjust the year accordingly.
             $week = $after->format('W');
             if ($week == 1 && $after->month == 12) {
                 $theYear = $after->year + 1;
             } elseif ($week >= 52 && $after->month == 1) {
                 $theYear = $after->year - 1;
             } else {
                 $theYear = $after->year;
             }
             $after_week = Horde_Date_Utils::firstDayOfWeek($week, $theYear);
             $after_week->timezone = $this->start->timezone;
             $after_week_end = clone $after_week;
             $after_week_end->mday += 7;
             $diff = $start_week->diff($after_week);
             $interval = $this->recurInterval * 7;
             $repeats = floor($diff / $interval);
             if ($diff % $interval < 7) {
                 $recur = $diff;
             } else {
                 /**
                  * If the after_week is not in the first week interval the
                  * search needs to skip ahead a complete interval. The way it is
                  * calculated here means that an event that occurs every second
                  * week on Monday and Wednesday with the event actually starting
                  * on Tuesday or Wednesday will only have one incidence in the
                  * first week.
                  */
                 $recur = $interval * ($repeats + 1);
             }
             if ($this->hasRecurCount()) {
                 $recurrences = 0;
                 /**
                  * Correct the number of recurrences by the number of events
                  * that lay between the start of the start week and the
                  * recurrence start.
                  */
                 $next = clone $start_week;
                 while ($next->compareDateTime($this->start) < 0) {
                     if ($this->recurOnDay((int) pow(2, $next->dayOfWeek()))) {
                         $recurrences--;
                     }
                     ++$next->mday;
                 }
                 if ($repeats > 0) {
                     $weekdays = $this->recurData;
                     $total_recurrences_per_week = 0;
                     while ($weekdays > 0) {
                         if ($weekdays % 2) {
                             $total_recurrences_per_week++;
                         }
                         $weekdays = ($weekdays - $weekdays % 2) / 2;
                     }
//.........这里部分代码省略.........
开发者ID:claudineyqr,项目名称:Kolab-Roundcube-Calendar,代码行数:101,代码来源:Horde_Date_Recurrence.php

示例15: download

 /**
  * @throws Nag_Exception
  */
 public function download(Horde_Variables $vars)
 {
     global $display_tasklists, $injector, $registry;
     switch ($vars->actionID) {
         case 'export':
             $tasklists = $vars->get('exportList', $display_tasklists);
             if (!is_array($tasklists)) {
                 $tasklists = array($tasklists);
             }
             /* Get the full, sorted task list. */
             $tasks = Nag::listTasks(array('tasklists' => $tasklists, 'completed' => $vars->exportTasks, 'include_tags' => true, 'include_history' => false));
             $tasks->reset();
             switch ($vars->exportID) {
                 case Horde_Data::EXPORT_CSV:
                     $data = array();
                     while ($task = $tasks->each()) {
                         $task = $task->toHash();
                         $task['desc'] = str_replace(',', '', $task['desc']);
                         $task['tags'] = implode(',', $task['tags']);
                         unset($task['complete_link'], $task['delete_link'], $task['edit_link'], $task['parent'], $task['task_id'], $task['tasklist_id'], $task['view_link'], $task['recurrence'], $task['methods']);
                         foreach (array('start', 'due', 'completed_date') as $field) {
                             if (!empty($task[$field])) {
                                 $date = new Horde_Date($task[$field]);
                                 $task[$field] = $date->format('c');
                             }
                         }
                         $data[] = $task;
                     }
                     $injector->getInstance('Horde_Core_Factory_Data')->create('Csv', array('cleanup' => array($this, 'cleanupData')))->exportFile(_("tasks.csv"), $data, true);
                     exit;
                 case Horde_Data::EXPORT_ICALENDAR:
                     $iCal = new Horde_Icalendar();
                     $iCal->setAttribute('PRODID', '-//The Horde Project//Nag ' . $registry->getVersion() . '//EN');
                     while ($task = $tasks->each()) {
                         $iCal->addComponent($task->toiCalendar($iCal));
                     }
                     return array('data' => $iCal->exportvCalendar(), 'name' => _("tasks.ics"), 'type' => 'text/calendar');
             }
     }
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:43,代码来源:Application.php


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