• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Horde_Date类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _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


示例2: 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


示例3: __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


示例4: 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


示例5: listEvents

 /**
  * Lists all events in the given time range.     *
  *
  * @param Horde_Date $startDate Start of range date object.
  * @param Horde_Date $endDate   End of range data object.
  *
  * @return array Events in the given time range.
  *
  * @throws Horde_Kolab_FreeBusy_Exception If retrieving the events failed.
  */
 public function listEvents(Horde_Date $startDate, Horde_Date $endDate)
 {
     $this->getLogger()->debug(sprintf('Listing events for resource %s between %s and %s.', $this->getResource()->getName(), (string) $startDate->rfc2822DateTime(), (string) $endDate->rfc2822DateTime()));
     $events = $this->getResource()->listEvents($startDate, $endDate);
     $this->getLogger()->debug(sprintf('Found %s events.', count($events)));
     return $events;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:17,代码来源:Log.php


示例6: _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


示例7: next

 /**
  * Return the next past or future Span for the time that this Repeater represents
  *   pointer - Symbol representing which temporal direction to fetch the next day
  *             must be either :past or :future
  */
 public function next($pointer = 'future')
 {
     parent::next($pointer);
     $halfDay = 3600 * 12;
     $fullDay = 3600 * 24;
     $first = false;
     if (!$this->currentTime) {
         $first = true;
         $midnight = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day));
         $yesterdayMidnight = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day - 1));
         $tomorrowMidnight = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day + 1));
         if ($pointer == 'future') {
             if ($this->ambiguous) {
                 foreach (array($midnight->add($this->type), $midnight->add($halfDay + $this->type), $tomorrowMidnight->add($this->type)) as $t) {
                     if ($t->compareDateTime($this->now) >= 0) {
                         $this->currentTime = $t;
                         break;
                     }
                 }
             } else {
                 foreach (array($midnight->add($this->type), $tomorrowMidnight->add($this->type)) as $t) {
                     if ($t->compareDateTime($this->now) >= 0) {
                         $this->currentTime = $t;
                         break;
                     }
                 }
             }
         } elseif ($pointer == 'past') {
             if ($this->ambiguous) {
                 foreach (array($midnight->add($halfDay + $this->type), $midnight->add($this->type), $yesterdayMidnight->add($this->type * 2)) as $t) {
                     if ($t->compareDateTime($this->now) <= 0) {
                         $this->currentTime = $t;
                         break;
                     }
                 }
             } else {
                 foreach (array($midnight->add($this->type), $yesterdayMidnight->add($this->type)) as $t) {
                     if ($t->compareDateTime($this->now) <= 0) {
                         $this->currentTime = $t;
                         break;
                     }
                 }
             }
         }
         if (!$this->currentTime) {
             throw new Horde_Date_Repeater_Exception('Current time cannot be null at this point');
         }
     }
     if (!$first) {
         $increment = $this->ambiguous ? $halfDay : $fullDay;
         $this->currentTime->sec += $pointer == 'future' ? $increment : -$increment;
     }
     return new Horde_Date_Span($this->currentTime, $this->currentTime->add(1));
 }
开发者ID:horde,项目名称:horde,代码行数:59,代码来源:Time.php


示例8: testMethodListeventsHasResultArrayTheEventsInTheGivenTimeSpan

 public function testMethodListeventsHasResultArrayTheEventsInTheGivenTimeSpan()
 {
     $rec_start = new Horde_Date('2009-12-12 10:00:00');
     $rec_end = new Horde_Date('2009-12-12 14:00:00');
     $objects = array(array('uid' => 1, 'sensitivity' => 'public', 'start-date' => $rec_start->timestamp(), 'end-date' => $rec_end->timestamp(), 'recurrence' => array('interval' => 1, 'cycle' => 'daily', 'range-type' => 'none')));
     $resource = $this->_getData($objects);
     $start = new Horde_Date('2009-12-13 0:00:00');
     $end = new Horde_Date('2009-12-14 0:00:00');
     $result = $resource->listEvents($start, $end);
     $this->assertInstanceOf('Horde_Kolab_FreeBusy_Object_Event', $result[0]);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:11,代码来源:KolabTest.php


示例9: listTimeObjects

 /**
  *
  * @param Horde_Date $start  The start time of the period
  * @param Horde_Date $end   The end time of the period
  *
  * @return array of listTimeObjects arrays.
  */
 public function listTimeObjects(Horde_Date $start = null, Horde_Date $end = null)
 {
     global $conf, $prefs;
     // No need to continue if the forecast days are not in the current
     // range.
     $forecast_start = new Horde_Date(time());
     $forecast_end = clone $forecast_start;
     $forecast_end->mday += 7;
     if ($end->before($forecast_start) || $start->after($forecast_end)) {
         return array();
     }
     $weather = $this->_create();
     $lengths = $weather->getSupportedForecastLengths();
     try {
         $units = $weather->getUnits($weather->units);
         $forecast = $weather->getForecast($this->_location, max(array_keys($lengths)));
         $current = $weather->getCurrentConditions($this->_location);
     } catch (Horde_Service_Weather_Exception $e) {
         throw new Timeobjects_Exception($e);
     }
     $objects = array();
     foreach ($forecast as $data) {
         $day = $data->date;
         $day->hour = 0;
         $day->min = 0;
         $day->sec = 0;
         $day_end = clone $day;
         $day_end->mday++;
         $title = sprintf('%s %d°%s/%d°%s', $data->conditions, $data->high, $units['temp'], $data->low, $units['temp']);
         // Deterine what information we have to display.
         $pop = $data->precipitation_percent === false ? _("N/A") : $data->precipitation_percent . '%';
         if ($forecast->detail == Horde_Service_Weather::FORECAST_TYPE_STANDARD) {
             if ($data->humidity !== false && $data->wind_direction !== false) {
                 $description = sprintf(_("Conditions: %s\nHigh temperature: %d%s\nPrecipitation: %s\nHumidity: %d%%\nWinds: From the %s at %d%s"), _($data->conditions), $data->high, '°' . $units['temp'], $pop, $data->humidity, $data->wind_direction, $data->wind_speed, $units['wind']);
             } else {
                 $description = sprintf(_("Conditions: %s\nHigh temperature: %d%s\nPrecipitation: %s\n"), _($data->conditions), $data->high, '°' . $units['temp'], $pop);
             }
         } elseif ($forecast->detail == Horde_Service_Weather::FORECAST_TYPE_DETAILED) {
             // @TODO
             // No drivers support this yet. AccuWeather will, and possibly
             // wunderground if they accept my request.
         }
         $station = $weather->getStation();
         $body = sprintf(_("Location: %s"), $weather->getStation()->name);
         if (!empty($weather->getStation()->sunrise)) {
             $body .= sprintf(_("Sunrise: %s\nSunset: %s\n"), $weather->getStation()->sunrise, $weather->getStation()->sunset);
         }
         $body .= "\n" . $description;
         $objects[] = array('id' => $day->timestamp(), 'title' => $title, 'description' => $body, 'start' => $day->strftime('%Y-%m-%dT00:00:00'), 'end' => $day_end->strftime('%Y-%m-%dT00:00:00'), 'recurrence' => Horde_Date_Recurrence::RECUR_NONE, 'params' => array(), 'link' => new Horde_Url('#'), 'icon' => (string) Horde_Themes::img('weather/23x23/' . $data->icon));
         $day->mday++;
     }
     return $objects;
 }
开发者ID:horde,项目名称:horde,代码行数:60,代码来源:Weather.php


示例10: getTile

 /**
  * Outputs the html for a DateGallery tile.
  *
  * @param Ansel_Gallery_Decorator_Date $dgallery  The Ansel_Gallery_Date we are
  *                                     displaying.
  * @param Ansel_Style $style  A style object.
  * @param boolean $mini       Force the use of a mini thumbail?
  * @param array $params       An array containing additional parameters.
  *                            Currently, gallery_view_url and image_view_url
  *                            are used to override the respective urls.
  *                            %g and %i are replaced with image id and
  *                            gallery id, respectively.
  *
  * @return string  The HTML for the tile.
  */
 public function getTile(Ansel_Gallery_Decorator_Date $dgallery, Ansel_Style $style = null, $mini = false, array $params = array())
 {
     $view = $GLOBALS['injector']->createInstance('Horde_View');
     $view->addTemplatePath(ANSEL_TEMPLATES . '/tile');
     // User's preferred date format
     $date_format = $GLOBALS['prefs']->getValue('date_format');
     $date_array = $dgallery->getDate();
     if (empty($date_array['month'])) {
         $date_array['month'] = 1;
     }
     if (empty($date_array['day'])) {
         $date_array['day'] = 1;
     }
     $full_date = new Horde_Date($date_array);
     // Need the unaltered date part array
     $date_array = $dgallery->getDate();
     // Figure out the needed link for the next drill down level. We *must*
     // have at least a year since we are in a date tile.
     if (empty($date_array['month'])) {
         // unit == year
         $view->caption = $full_date->strftime('%Y');
         $next_date = array('year' => (int) $view->caption);
     } elseif (empty($date_array['day'])) {
         // unit == month
         $view->caption = $full_date->strftime('%B %Y');
         $next_date = array('year' => date('Y', $full_date->timestamp()), 'month' => date('n', $full_date->timestamp()));
     } else {
         // unit == day
         $view->caption = $full_date->strftime($date_format);
         $next_date = array('year' => date('Y', $full_date->timestamp()), 'month' => date('n', $full_date->timestamp()), 'day' => date('j', $full_date->timestamp()));
     }
     // Check permissions on the gallery and get appropriate tile image
     if ($dgallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
         if (is_null($style)) {
             $style = $dgallery->getStyle();
         }
         $thumbstyle = $mini ? 'mini' : 'thumb';
         $view->gallery_image = Ansel::getImageUrl($dgallery->getKeyImage(), $thumbstyle, true, $style);
     } else {
         $view->gallery_image = Horde_Themes::img('thumb-error.png');
     }
     /* Check for being called via the api and generate correct view links */
     if (!isset($params['gallery_view_url'])) {
         if (empty($params['style'])) {
             $gstyle = $dgallery->getStyle();
         } else {
             $gstyle = $params['style'];
         }
         $params = array('gallery' => $dgallery->id, 'view' => 'Gallery', 'slug' => $dgallery->get('slug'));
         $view->view_link = Ansel::getUrlFor('view', array_merge($params, $next_date));
     } else {
         $view->view_link = new Horde_Url(str_replace(array('%g', '%s'), array($dgallery->id, $dgallery->get('slug')), urldecode($params['gallery_view_url'])));
         $view->view_link->add($next_date);
     }
     $view->gallery_count = $dgallery->countImages(true);
     return $view->render('dategallery');
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:72,代码来源:DateGallery.php


示例11: getInfo

 public function getInfo(&$vars, &$var, &$info)
 {
     $due_type = $vars->get('due_type');
     $due = $vars->get('due');
     if (is_array($due)) {
         $due_date = !empty($due['date']) ? $due['date'] : null;
         $due_time = !empty($due['time']) ? $due['time'] : null;
         $due_array = Nag::parseDate("{$due_date} {$due_time}");
         $due_dt = new Horde_Date($due_array);
         $due = $due_dt->timestamp();
     }
     $info = strcasecmp($due_type, 'none') ? $due : 0;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:13,代码来源:NagDue.php


示例12: __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();
     $this->_daysInView = Date_Calc::weeksInMonth($this->month, $this->year) * 7;
     if (!$prefs->getValue('week_start_monday')) {
         $this->_startOfView = 1 - $this->_startday;
         // We may need to adjust the number of days in the view if
         // we're starting weeks on Sunday.
         if ($this->_startday == Horde_Date::DATE_SUNDAY) {
             $this->_daysInView -= 7;
         }
         $endday = new Horde_Date(array('mday' => Horde_Date_Utils::daysInMonth($this->month, $this->year), 'month' => $this->month, 'year' => $this->year));
         $endday = $endday->dayOfWeek();
         if ($endday == Horde_Date::DATE_SUNDAY) {
             $this->_daysInView += 7;
         }
     } else {
         if ($this->_startday == Horde_Date::DATE_SUNDAY) {
             $this->_startOfView = -5;
         } else {
             $this->_startOfView = 2 - $this->_startday;
         }
     }
     $startDate = new Horde_Date(array('year' => $this->year, 'month' => $this->month, 'mday' => $this->_startOfView));
     $endDate = new Horde_Date(array('year' => $this->year, 'month' => $this->month, 'mday' => $this->_startOfView + $this->_daysInView));
     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, $endDate);
     } catch (Exception $e) {
         $GLOBALS['notification']->push($e, 'horde.error');
         $this->_events = array();
     }
     if (!is_array($this->_events)) {
         $this->_events = array();
     }
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:57,代码来源:Month.php


示例13: _hours

 protected function _hours()
 {
     global $prefs;
     $hours_html = '';
     $width = round(100 / ($this->_endHour - $this->_startHour + 1));
     $start = new Horde_Date($this->_start);
     $end = new Horde_Date($this->_start);
     $end->min = 59;
     for ($i = $this->_startHour; $i < $this->_endHour; $i++) {
         $start->hour = $end->hour = $i;
         $this->_timeBlocks[] = array(clone $start, clone $end);
         $hours_html .= '<th width="' . $width . '%">' . $start->strftime($prefs->getValue('twentyFour') ? '%H:00' : '%I:00') . '</th>';
     }
     return $hours_html;
 }
开发者ID:horde,项目名称:horde,代码行数:15,代码来源:Day.php


示例14: getInfo

 public function getInfo(&$vars, &$var, &$info)
 {
     $start_type = $vars->get('start_date');
     $start = $vars->get('start');
     if (is_array($start)) {
         if (empty($start['date'])) {
             $start = null;
         } else {
             $start_array = Nag::parseDate($start['date'], false);
             $start_dt = new Horde_Date($start_array);
             $start = $start_dt->timestamp();
         }
     }
     $info = strcasecmp($start_type, 'none') ? $start : 0;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:15,代码来源:NagStart.php


示例15: display

 /**
  */
 public function display(Horde_Core_Prefs_Ui $ui)
 {
     global $browser, $injector, $page_output, $prefs;
     $page_output->addScriptPackage('IMP_Script_Package_Imp');
     $p_css = new Horde_Themes_Element('prefs.css');
     $page_output->addStylesheet($p_css->fs, $p_css->uri);
     $view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/prefs'));
     $view->addHelper('Horde_Core_View_Helper_Help');
     if (!Horde::isConnectionSecure()) {
         $view->notsecure = true;
         return $view->render('smimeprivatekey');
     }
     $smime_url = IMP_Basic_Smime::url();
     $view->has_key = $prefs->getValue('smime_public_key') && $prefs->getValue('smime_private_key');
     $view->has_sign_key = $prefs->getValue('smime_public_sign_key') && $prefs->getValue('smime_private_sign_key');
     if ($browser->allowFileUploads()) {
         $view->import = true;
         $page_output->addInlineScript(array('$("import_smime_personal").observe("click", function(e) { ' . Horde::popupJs($smime_url, array('params' => array('actionID' => 'import_personal_certs', 'reload' => base64_encode($ui->selfUrl()->setRaw(true))), 'height' => 450, 'width' => 750, 'urlencode' => true)) . '; e.stop(); })'), true);
     }
     if (!$view->has_key) {
         return $view->render('smimeprivatekey');
     }
     $smime = $injector->getInstance('IMP_Smime');
     foreach (array('' => false, '_sign' => true) as $suffix => $secondary) {
         if ($secondary && !$view->has_sign_key) {
             continue;
         }
         $cert = $smime->parseCert($smime->getPersonalPublicKey($secondary));
         if (!empty($cert['validity']['notafter'])) {
             $expired = new Horde_Date($cert['validity']['notafter']);
             if ($expired->before(time())) {
                 $view->{'expiredate' . $suffix} = $expired->strftime($prefs->getValue('date_format'));
                 $view->{'expiretime' . $suffix} = $expired->strftime($prefs->getValue('time_format'));
             }
         }
         $view->{'viewpublic' . $suffix} = $smime_url->copy()->add('actionID', 'view_personal_public' . $suffix . '_key')->link(array('title' => $secondary ? _("View Secondary Personal Public Certificate") : _("View Personal Public Certificate"), 'target' => 'view_key')) . _("View") . '</a>';
         $view->{'infopublic' . $suffix} = $smime_url->copy()->add('actionID', 'info_personal_public' . $suffix . '_key')->link(array('title' => _("Information on Personal Public Certificate"), 'target' => 'info_key')) . _("Details") . '</a>';
         if ($smime->getPassphrase($secondary)) {
             $view->{'passphrase' . $suffix} = $ui->selfUrl(array('special' => true, 'token' => true))->add('unset_smime' . $suffix . '_passphrase', 1)->link(array('title' => _("Unload Passphrase"))) . _("Unload Passphrase") . '</a>';
         } else {
             $imple = $injector->getInstance('Horde_Core_Factory_Imple')->create('IMP_Ajax_Imple_PassphraseDialog', array('params' => array('reload' => $ui->selfUrl()->setRaw(true), 'secondary' => intval($secondary)), 'type' => 'smimePersonal'));
             $view->{'passphrase' . $suffix} = Horde::link('#', _("Enter Passphrase"), null, null, null, null, null, array('id' => $imple->getDomId())) . _("Enter Passphrase");
         }
         $view->{'viewprivate' . $suffix} = $smime_url->copy()->add('actionID', 'view_personal_private' . $suffix . '_key')->link(array('title' => _("View Secondary Personal Private Key"), 'target' => 'view_key')) . _("View") . '</a>';
         $page_output->addInlineScript(array('$("delete_smime_personal' . $suffix . '").observe("click", function(e) { if (!window.confirm(' . json_encode(_("Are you sure you want to delete your keypair? (This is NOT recommended!)")) . ')) { e.stop(); } })'), true);
     }
     return $view->render('smimeprivatekey');
 }
开发者ID:horde,项目名称:horde,代码行数:50,代码来源:SmimePrivateKey.php


示例16: _title

 /**
  */
 protected function _title()
 {
     $title = _("All Calendars");
     $url = Horde::url($GLOBALS['registry']->getInitialPage(), true);
     if (isset($this->_params['calendar']) && $this->_params['calendar'] != '__all') {
         $calendars = Kronolith::listCalendars();
         if (isset($calendars[$this->_params['calendar']])) {
             $title = htmlspecialchars($calendars[$this->_params['calendar']]->name());
         } else {
             $title = _("Calendar not found");
         }
         $url->add('display_cal', $this->_params['calendar']);
     }
     $date = new Horde_Date(time());
     return $title . ', ' . $url->link() . $date->strftime('%B, %Y') . '</a>';
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:18,代码来源:Month.php


示例17: __construct

 public function __construct(Horde_Date $date)
 {
     $week = $date->weekOfYear();
     $year = $date->year;
     if (!$GLOBALS['prefs']->getValue('week_start_monday') && $date->dayOfWeek() == Horde_Date::DATE_SUNDAY) {
         ++$week;
     }
     if ($week > 51 && $date->month == 1) {
         --$year;
     } elseif ($week == 1 && $date->month == 12) {
         ++$year;
     }
     $this->year = $year;
     $this->week = $week;
     $day = Horde_Date_Utils::firstDayOfWeek($week, $year);
     if (!isset($this->startDay)) {
         if ($GLOBALS['prefs']->getValue('week_start_monday')) {
             $this->startDay = Horde_Date::DATE_MONDAY;
             $this->endDay = Horde_Date::DATE_SUNDAY + 7;
         } else {
             $day->mday--;
             $this->startDay = Horde_Date::DATE_SUNDAY;
             $this->endDay = Horde_Date::DATE_SATURDAY;
         }
     }
     $this->startDate = new Horde_Date($day);
     for ($i = $this->startDay; $i <= $this->endDay; ++$i) {
         $this->days[$i] = new Kronolith_View_Day($day, array());
         $day->mday++;
     }
     $endDate = new Horde_Date($day);
     try {
         $allevents = Kronolith::listEvents($this->startDate, $endDate);
     } catch (Exception $e) {
         $GLOBALS['notification']->push($e, 'horde.error');
         $allevents = array();
     }
     for ($i = $this->startDay; $i <= $this->endDay; ++$i) {
         $date_stamp = $this->days[$i]->dateString();
         $this->days[$i]->events = isset($allevents[$date_stamp]) ? $allevents[$date_stamp] : array();
     }
     $this->sidebyside = $this->days[$this->startDay]->sidebyside;
     $this->_currentCalendars = $this->days[$this->startDay]->currentCalendars;
     $this->slotsPerHour = $this->days[$this->startDay]->slotsPerHour;
     $this->slotsPerDay = $this->days[$this->startDay]->slotsPerDay;
     $this->slotLength = $this->days[$this->startDay]->slotLength;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:47,代码来源:Week.php


示例18: _listObjects

 /**
  * Returns a list of events or tasks.
  *
  * @param integer $folder    A folder ID. If empty, returns objects of all
  *                           visible resources.
  * @param Horde_Date $start  Start date, defaults to epoch.
  * @param Horde_Date $end    End date, defaults to maximum date possible.
  *
  * @return array  List of object hashes.
  * @throws Horde_OpenXchange_Exception.
  */
 protected function _listObjects($folder = null, $start = null, $end = null)
 {
     $this->_login();
     $data = array('session' => $this->_session, 'columns' => implode(',', array_keys($this->_columns)), 'start' => $start ? $start->timestamp() * 1000 : 0, 'end' => $end ? $end->timestamp() * 1000 : PHP_INT_MAX, 'recurrence_master' => true);
     if ($folder) {
         $data['folder'] = $folder;
     }
     $response = $this->_request('GET', $this->_folderType, array('action' => 'all'), $data);
     $events = array();
     foreach ($response['data'] as $event) {
         $map = array();
         foreach (array_values($this->_columns) as $key => $column) {
             $map[$column] = $event[$key];
         }
         $events[] = $map;
     }
     return $events;
 }
开发者ID:horde,项目名称:horde,代码行数:29,代码来源:EventsAndTasks.php


示例19: 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


示例20: this

 public function this($pointer = 'future')
 {
     parent::this($pointer);
     switch ($pointer) {
         case 'future':
             $hourStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour, 'min' => $this->now->min + 1));
             $hourEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour + 1));
             break;
         case 'past':
             $hourStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour));
             $hourEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour, 'min' => $this->now->min));
             break;
         case 'none':
             $hourStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour));
             $hourEnd = $hourStart->add(array('hour' => 1));
             break;
     }
     return new Horde_Date_Span($hourStart, $hourEnd);
 }
开发者ID:horde,项目名称:horde,代码行数:19,代码来源:Hour.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Horde_Db_Adapter类代码示例发布时间:2022-05-23
下一篇:
PHP Horde_Core_Translation类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap