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


PHP Horde_Date::dateString方法代码示例

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


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

示例1: _hours

 protected function _hours()
 {
     global $prefs;
     $hours_html = '';
     $dayWidth = round(100 / $this->_days);
     $span = floor(($this->_endHour - $this->_startHour) / 3);
     if (($this->_endHour - $this->_startHour) % 3) {
         $span++;
     }
     $date_format = $prefs->getValue('date_format');
     for ($i = 0; $i < $this->_days; $i++) {
         $t = new Horde_Date(array('month' => $this->_start->month, 'mday' => $this->_start->mday + $i, 'year' => $this->_start->year));
         $day_label = Horde::url('#')->link(array('onclick' => 'return switchDateView(\'Day\',' . $t->dateString() . ');')) . $t->strftime($date_format) . '</a>';
         $hours_html .= sprintf('<th colspan="%d" width="%s%%">%s</th>', $span, $dayWidth, $day_label);
     }
     $hours_html .= '</tr><tr><td width="100" class="label">&nbsp;</td>';
     $width = round(100 / ($span * $this->_days));
     for ($i = 0; $i < $this->_days; $i++) {
         for ($h = $this->_startHour; $h < $this->_endHour; $h += 3) {
             $start = new Horde_Date(array('hour' => $h, 'month' => $this->_start->month, 'mday' => $this->_start->mday + $i, 'year' => $this->_start->year));
             $end = new Horde_Date($start);
             $end->hour += 2;
             $end->min = 59;
             $this->_timeBlocks[] = array($start, $end);
             $hour = $start->strftime($prefs->getValue('twentyFour') ? '%H:00' : '%I:00');
             $hours_html .= sprintf('<th width="%d%%">%s</th>', $width, $hour);
         }
     }
     return $hours_html;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:30,代码来源:Week.php

示例2: _hours

 protected function _hours()
 {
     $hours_html = '';
     $dayWidth = round(100 / $this->_days);
     $week = $this->_start->weekOfYear();
     $span = (7 - $week) % 7 + 1;
     $span_left = $this->_days;
     $t = new Horde_Date($this->_start);
     while ($span_left > 0) {
         $span_left -= $span;
         $week_label = Horde::url('#')->link(array('onclick' => 'return switchDateView(\'Week\',' . $t->dateString() . ');')) . "Week" . ' ' . $week . '</a>';
         $hours_html .= sprintf('<th colspan="%d" width="%s%%">%s</th>', $span, $dayWidth, $week_label);
         $week++;
         $t->mday += 7;
         $span = min($span_left, 7);
     }
     $hours_html .= '</tr><tr><td width="100" class="label">&nbsp;</td>';
     for ($i = 0; $i < $this->_days; $i++) {
         $t = new Horde_Date(array('month' => $this->_start->month, 'mday' => $this->_start->mday + $i, 'year' => $this->_start->year));
         $day_label = Horde::url('#')->link(array('onclick' => 'return switchDateView(\'Day\',' . $t->dateString() . ');')) . ($i + 1) . '.</a>';
         $hours_html .= sprintf('<th width="%s%%">%s</th>', $dayWidth, $day_label);
     }
     for ($i = 0; $i < $this->_days; $i++) {
         $start = new Horde_Date(array('hour' => $this->_startHour, 'month' => $this->_start->month, 'mday' => $this->_start->mday + $i, 'year' => $this->_start->year));
         $end = new Horde_Date(array('hour' => $this->_endHour, 'month' => $this->_start->month, 'mday' => $this->_start->mday + $i, 'year' => $this->_start->year));
         $this->_timeBlocks[] = array($start, $end);
     }
     return $hours_html;
 }
开发者ID:horde,项目名称:horde,代码行数:29,代码来源:Month.php

示例3: _title

 protected function _title()
 {
     global $prefs;
     $prev = new Horde_Date($this->_start);
     $prev->mday--;
     $next = new Horde_Date($this->_start);
     $next->mday++;
     return Horde::url('#')->link(array('title' => _("Previous Day"), 'onclick' => 'return switchDate(' . $prev->dateString() . ');')) . Horde::img('nav/left.png', '<') . '</a>' . $this->_start->strftime($prefs->getValue('date_format')) . Horde::url('#')->link(array('title' => _("Next Day"), 'onclick' => 'return switchDate(' . $next->dateString() . ');')) . Horde::img('nav/right.png', '>') . '</a>';
 }
开发者ID:horde,项目名称:horde,代码行数:9,代码来源:Day.php

示例4: toJson

 /**
  * Converts free/busy data to a simple object suitable to be transferred
  * as json.
  *
  * @param Horde_Icalendar_Vfreebusy $fb  A Free/busy component.
  *
  * @return object  A simple object representation.
  */
 public static function toJson(Horde_Icalendar_Vfreebusy $fb)
 {
     $json = new stdClass();
     $start = $fb->getStart();
     if ($start) {
         $start = new Horde_Date($start);
         $json->s = $start->dateString();
     }
     $end = $fb->getEnd();
     if ($end) {
         $end = new Horde_Date($end);
         $json->e = $end->dateString();
     }
     $b = $fb->getBusyPeriods();
     if (empty($b)) {
         $b = new StdClass();
     }
     $new = new StdClass();
     foreach ($b as $from => $to) {
         $from = new Horde_Date($from);
         $to = new Horde_Date($to);
         $new->{$from->toJson()} = $to->toJson();
     }
     $json->b = $new;
     return $json;
 }
开发者ID:horde,项目名称:horde,代码行数:34,代码来源:FreeBusy.php

示例5: addCoverDates

 /**
  * Adds an event to all the days it covers.
  *
  * @param array $result           The current result list.
  * @param Kronolith_Event $event  An event object.
  * @param Horde_Date $eventStart  The event's start at the actual
  *                                recurrence.
  * @param Horde_Date $eventEnd    The event's end at the actual recurrence.
  * @param boolean $json           Store the results of the events' toJson()
  *                                method?
  */
 public static function addCoverDates(&$results, $event, $eventStart, $eventEnd, $json)
 {
     $loopDate = new Horde_Date($eventStart->year, $eventStart->month, $eventStart->mday);
     $allDay = $event->isAllDay();
     while ($loopDate->compareDateTime($eventEnd) <= 0) {
         if (!$allDay || $loopDate->compareDateTime($eventEnd) != 0) {
             $addEvent = clone $event;
             $addEvent->start = $eventStart;
             $addEvent->end = $eventEnd;
             if ($loopDate->compareDate($eventStart) != 0) {
                 $addEvent->first = false;
             }
             if ($loopDate->compareDate($eventEnd) != 0) {
                 $addEvent->last = false;
             }
             if ($addEvent->recurs() && $addEvent->recurrence->hasCompletion($loopDate->year, $loopDate->month, $loopDate->mday)) {
                 $addEvent->status = Kronolith::STATUS_CANCELLED;
             }
             $results[$loopDate->dateString()][$addEvent->id] = $json ? $addEvent->toJson($allDay) : $addEvent;
         }
         $loopDate->mday++;
     }
 }
开发者ID:AsylumCorp,项目名称:horde,代码行数:34,代码来源:Kronolith.php

示例6: toJson

 /**
  * Converts free/busy data to a simple object suitable to be transferred
  * as json.
  *
  * @param Horde_Icalendar_Vfreebusy $fb  A Free/busy component.
  *
  * @return object  A simple object representation.
  */
 public static function toJson(Horde_Icalendar_Vfreebusy $fb)
 {
     $json = new stdClass();
     $start = $fb->getStart();
     if ($start) {
         $start = new Horde_Date($start);
         $json->s = $start->dateString();
     }
     $end = $fb->getEnd();
     if ($end) {
         $end = new Horde_Date($end);
         $json->e = $end->dateString();
     }
     $b = $fb->getBusyPeriods();
     if (empty($b)) {
         $b = new StdClass();
     }
     $json->b = $b;
     return $json;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:28,代码来源:FreeBusy.php

示例7: array

            $attendees[$partname]['response'] = $partval;
            $session->set('kronolith', 'attendees', $attendees);
        }
        break;
    case 'dismiss':
        // Close the attendee window.
        if ($browser->hasFeature('javascript')) {
            echo Horde::wrapInlineScript(array('window.close();'));
            exit;
        }
        $url = Horde_Util::getFormData('url');
        if (!empty($url)) {
            $url = new Horde_Url($url, true);
        } else {
            $date = new Horde_Date(Horde_Util::getFormData('startdate'));
            $url = Horde::url($prefs->getValue('defaultview') . '.php', true)->add('date', $date->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;
}
/* Get list of resources for select list, and remove those we already added */
if (!empty($conf['resources']['enabled'])) {
    $allResources = Kronolith::getDriver('Resource')->listResources(Horde_Perms::READ, array(), 'name');
    foreach (array_keys($resources) as $id) {
        unset($allResources[$id]);
    }
开发者ID:raz0rsdge,项目名称:horde,代码行数:31,代码来源:attendees.php

示例8: html

 public function html()
 {
     global $prefs;
     $html = '<table id="kronolith-view-year" class="kronolith-minical"><tr>';
     for ($month = 1; $month <= 12; ++$month) {
         $html .= '<td>';
         // Heading for each month.
         $date = new Horde_Date(sprintf('%04d%02d01010101', $this->year, $month));
         $html .= '<table><thead><tr class="kronolith-minical-nav"><th colspan="7">' . Horde::url('month.php')->add('date', $date->dateString())->link() . $date->strftime('%B') . '</a></th></tr><tr><th class="kronolith-minical-empty">&nbsp;</th>';
         if (!$prefs->getValue('week_start_monday')) {
             $html .= '<th>' . _("Su") . '</th>';
         }
         $html .= '<th>' . _("Mo") . '</th>' . '<th>' . _("Tu") . '</th>' . '<th>' . _("We") . '</th>' . '<th>' . _("Th") . '</th>' . '<th>' . _("Fr") . '</th>' . '<th>' . _("Sa") . '</th>';
         if ($prefs->getValue('week_start_monday')) {
             $html .= '<th>' . _("Su") . '</th>';
         }
         $html .= '</tr></thead><tbody><tr><td class="kronolith-minical-week">';
         $startday = new Horde_Date(array('mday' => 1, 'month' => $month, 'year' => $this->year));
         $startday = $startday->dayOfWeek();
         $daysInView = Date_Calc::weeksInMonth($month, $this->year) * 7;
         if (!$prefs->getValue('week_start_monday')) {
             $startOfView = 1 - $startday;
             // We may need to adjust the number of days in the
             // view if we're starting weeks on Sunday.
             if ($startday == Horde_Date::DATE_SUNDAY) {
                 $daysInView -= 7;
             }
             $endday = new Horde_Date(array('mday' => Horde_Date_Utils::daysInMonth($month, $this->year), 'month' => $month, 'year' => $this->year));
             $endday = $endday->dayOfWeek();
             if ($endday == Horde_Date::DATE_SUNDAY) {
                 $daysInView += 7;
             }
         } else {
             if ($startday == Horde_Date::DATE_SUNDAY) {
                 $startOfView = -5;
             } else {
                 $startOfView = 2 - $startday;
             }
         }
         $currentCalendars = array(true);
         foreach ($currentCalendars as $id => $cal) {
             $cell = 0;
             for ($day = $startOfView; $day < $startOfView + $daysInView; ++$day) {
                 $date = new Kronolith_Day($month, $day, $this->year);
                 $date->hour = $prefs->getValue('twentyFour') ? 12 : 6;
                 $week = $date->weekOfYear();
                 if ($cell % 7 == 0) {
                     if ($cell != 0) {
                         $html .= "</tr>\n<tr><td class=\"kronolith-minical-week\">";
                     }
                     $html .= (int) $date->weekOfYear() . '</td>';
                 }
                 if ($date->month != $month) {
                     $style = 'kronolith-other-month';
                 } else {
                     $style = '';
                 }
                 /* Set up the link to the day view. */
                 $url = Horde::url('day.php', true)->add('date', $date->dateString());
                 if ($date->month == $month && !empty($this->_events[$date->dateString()])) {
                     /* There are events; create a cell with tooltip to list
                      * them. */
                     $day_events = '';
                     foreach ($this->_events[$date->dateString()] as $event) {
                         if ($event->status == Kronolith::STATUS_CONFIRMED) {
                             /* Set the background color to distinguish the
                              * day */
                             $style = 'year-event';
                         }
                         if ($event->isAllDay()) {
                             $day_events .= _("All day");
                         } else {
                             $day_events .= $event->start->strftime($prefs->getValue('twentyFour') ? '%R' : '%I:%M%p') . '-' . $event->end->strftime($prefs->getValue('twentyFour') ? '%R' : '%I:%M%p');
                         }
                         $day_events .= ':' . ($event->getLocation() ? ' (' . $event->getLocation() . ')' : '') . ' ' . $event->getTitle() . "\n";
                     }
                     /* Bold the cell if there are events. */
                     $cellday = '<strong>' . Horde::linkTooltip($url, _("View Day"), '', '', '', $day_events) . $date->mday . '</a></strong>';
                 } else {
                     /* No events, plain link to the day. */
                     $cellday = Horde::linkTooltip($url, _("View Day")) . $date->mday . '</a>';
                 }
                 if ($date->isToday() && $date->month == $month) {
                     $style .= ' kronolith-today';
                 }
                 $html .= '<td align="center" class="' . $style . '" height="10" width="5%" valign="top">' . $cellday . '</td>';
                 ++$cell;
             }
         }
         $html .= '</tr></tbody></table></td>';
         if ($month % 3 == 0 && $month != 12) {
             $html .= '</tr><tr>';
         }
     }
     echo $html . '</tr></table>';
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:96,代码来源:Year.php

示例9: addCoverDates

 /**
  * Adds an event to all the days it covers.
  *
  * @param array $result              The current result list.
  * @param Kronolith_Event $event     An event object.
  * @param Horde_Date $eventStart     The event's start of the actual
  *                                   recurrence.
  * @param Horde_Date $eventEnd       The event's end of the actual
  *                                   recurrence.
  * @param boolean $json              Store the results of the events'
  *                                   toJson() method?
  * @param Horde_Date $originalStart  The actual starting time of a single
  *                                   event spanning multiple days.
  * @param Horde_Date $originalEnd    The actual ending time of a single
  *                                   event spanning multiple days.
  */
 public static function addCoverDates(&$results, $event, $eventStart, $eventEnd, $json, $originalStart = null, $originalEnd = null, Horde_Date $endDate = null)
 {
     $loopDate = new Horde_Date(array('month' => $eventStart->month, 'mday' => $eventStart->mday, 'year' => $eventStart->year));
     $allDay = $event->isAllDay();
     while ($loopDate->compareDateTime($eventEnd) <= 0 && $loopDate->compareDateTime($endDate) <= 0) {
         if (!$allDay || $loopDate->compareDateTime($eventEnd) != 0) {
             $addEvent = clone $event;
             if ($originalStart) {
                 $addEvent->originalStart = $originalStart;
             }
             if ($originalEnd) {
                 $addEvent->originalEnd = $originalEnd;
             }
             /* If this is the start day, set the start time to
              * the real start time, otherwise set it to
              * 00:00 */
             if ($loopDate->compareDate($eventStart) != 0) {
                 $addEvent->start = clone $loopDate;
                 $addEvent->start->hour = $addEvent->start->min = $addEvent->start->sec = 0;
                 $addEvent->first = false;
             } else {
                 $addEvent->start = $eventStart;
             }
             /* If this is the end day, set the end time to the
              * real event end, otherwise set it to 23:59. */
             if ($loopDate->compareDate($eventEnd) != 0) {
                 $addEvent->end = clone $loopDate;
                 $addEvent->end->hour = 23;
                 $addEvent->end->min = $addEvent->end->sec = 59;
                 $addEvent->last = false;
             } else {
                 $addEvent->end = $eventEnd;
             }
             if ($addEvent->recurs() && $addEvent->recurrence->hasCompletion($loopDate->year, $loopDate->month, $loopDate->mday)) {
                 $addEvent->status = Kronolith::STATUS_CANCELLED;
             }
             $results[$loopDate->dateString()][$addEvent->id] = $json ? $addEvent->toJson(array('all_day' => $allDay)) : $addEvent;
         }
         $loopDate->mday++;
     }
 }
开发者ID:horde,项目名称:horde,代码行数:57,代码来源:Kronolith.php

示例10: toJson

 /**
  * Get the json representation of this slice. The resulting json contains
  * the following properties
  *<pre>
  * c    - client id
  * cn   - client object
  * co   - costobject id
  * con  - costobject name
  * d    - date
  * desc - description
  * e    - employee
  * h    - hours
  * i    - slice id
  * n    - note
  * r    - rate
  * s    - submitted
  * t    - type id
  * tn   - type name
  * b    - billable
  * x    - can edit
  *</pre>
  *
  * @return array
  */
 public function toJson()
 {
     $d = new Horde_Date($this->_properties['date']);
     // @TODO: DO we need the *entire* contact object?
     $cn = $GLOBALS['registry']->clients->getClients(array($this->_properties['client']));
     $json = array('c' => $this->_properties['client'], 'cn' => current($cn), 'co' => $this->_properties['costobject'], 'con' => $this->_properties['_costobject_name'], 'd' => $d->dateString(), 'desc' => $this->_properties['description'], 'e' => $this->_properties['employee'], 'h' => $this->_properties['hours'], 'i' => $this->_properties['id'], 'n' => $this->_properties['note'], 'r' => $this->_properties['rate'], 's' => $this->_properties['submitted'], 't' => $this->_properties['type'], 'tn' => $this->_properties['_type_name'], 'b' => $this->_properties['billable'], 'x' => Hermes::canEditTimeslice($this->_properties['id']));
     return $json;
 }
开发者ID:horde,项目名称:horde,代码行数:32,代码来源:Slice.php


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