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


PHP CTimeHelper::getTimezoneList方法代码示例

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


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

示例1: _displayForm

 /**
  * Method to display the create / edit event's form.
  * Both views share the same template file.	 
  **/
 function _displayForm($event)
 {
     $mainframe = JFactory::getApplication();
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $model = CFactory::getModel('events');
     $categories = $model->getCategories();
     $now = JFactory::getDate();
     $now->setOffset($mainframe->getCfg('offset'));
     jimport('joomla.html.editor');
     $editorType = $config->get('allowhtml') ? $config->get('htmleditor', 'none') : 'none';
     $editor = new JEditor($editorType);
     $totalEventCount = $model->getEventsCreationCount($my->id);
     $event->startdatetime = JRequest::getVar('startdatetime', '00:01', 'POST');
     $event->enddatetime = JRequest::getVar('enddatetime', '23:59', 'POST');
     CFactory::load('helpers', 'time');
     $timezones = CTimeHelper::getTimezoneList();
     CFactory::load('helpers', 'event');
     $helper = CEventHelper::getHandler($event);
     $startDate = $event->getStartDate(false);
     $endDate = $event->getEndDate(false);
     $hours = array();
     $startAmPmSelect = "";
     $endAmPmSelect = "";
     if ($config->get('eventshowampm')) {
         for ($i = 1; $i <= 12; $i++) {
             $hours[] = JHTML::_('select.option', $i, "{$i}");
         }
         // Cannot user ->toFormat('%p') since it is dependent on current locale
         // and would return a null if the system is configured for 24H
         $startAmPm = $startDate->toFormat('%H') >= 12 ? 'PM' : 'AM';
         $endAmPm = $endDate->toFormat('%H') >= 12 ? 'PM' : 'AM';
         $amPmSelect = array();
         $amPmSelect[] = JHTML::_('select.option', 'AM', "am");
         $amPmSelect[] = JHTML::_('select.option', 'PM', "pm");
         $startAmPmSelect = JHTML::_('select.genericlist', $amPmSelect, 'starttime-ampm', array('class' => 'required inputbox'), 'value', 'text', $startAmPm, false);
         $endAmPmSelect = JHTML::_('select.genericlist', $amPmSelect, 'endtime-ampm', array('class' => 'required inputbox'), 'value', 'text', $endAmPm, false);
         $selectedStartHour = intval($startDate->toFormat('%I'));
         $selectedEndHour = intval($endDate->toFormat('%I'));
     } else {
         for ($i = 0; $i <= 23; $i++) {
             $hours[] = JHTML::_('select.option', $i, sprintf("%02d", $i));
         }
         $selectedStartHour = intval($startDate->toFormat('%H'));
         $selectedEndHour = intval($endDate->toFormat('%H'));
     }
     $startHourSelect = JHTML::_('select.genericlist', $hours, 'starttime-hour', array('class' => 'required inputbox'), 'value', 'text', $selectedStartHour, false);
     $endHourSelect = JHTML::_('select.genericlist', $hours, 'endtime-hour', array('class' => 'required inputbox'), 'value', 'text', $selectedEndHour, false);
     $minutes = array();
     $minutes[] = JHTML::_('select.option', 0, "00");
     $minutes[] = JHTML::_('select.option', 15, "15");
     $minutes[] = JHTML::_('select.option', 30, "30");
     $minutes[] = JHTML::_('select.option', 45, "45");
     $startMinSelect = JHTML::_('select.genericlist', $minutes, 'starttime-min', array('class' => 'required inputbox'), 'value', 'text', $startDate->toFormat('%M'), false);
     $endMinSelect = JHTML::_('select.genericlist', $minutes, 'endtime-min', array('class' => 'required inputbox'), 'value', 'text', $endDate->toFormat('%M'), false);
     // Load category tree
     CFactory::load('helpers', 'category');
     $cTree = CCategoryHelper::getCategories($categories);
     $lists['categoryid'] = JHTML::_('select.genericlist', $cTree, 'catid', 'size="1"', 'id', 'nodeText', $event->catid);
     $tmpl = new CTemplate();
     $tmpl->set('startDate', $startDate);
     $tmpl->set('endDate', $endDate);
     $tmpl->set('startHourSelect', $startHourSelect);
     $tmpl->set('endHourSelect', $endHourSelect);
     $tmpl->set('startMinSelect', $startMinSelect);
     $tmpl->set('endMinSelect', $endMinSelect);
     $tmpl->set('startAmPmSelect', $startAmPmSelect);
     $tmpl->set('endAmPmSelect', $endAmPmSelect);
     $tmpl->set('timezones', $timezones);
     $tmpl->set('config', $config);
     $tmpl->set('lists', $lists);
     $tmpl->set('categories', $categories);
     $tmpl->set('event', $event);
     $tmpl->set('editor', $editor);
     $tmpl->set('helper', $helper);
     $tmpl->set('now', $now->toFormat('%Y-%m-%d'));
     $tmpl->set('eventCreated', $totalEventCount);
     $tmpl->set('eventcreatelimit', $config->get('eventcreatelimit'));
     echo $tmpl->fetch('events.forms');
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:84,代码来源:view.html.php

示例2: import

 /**
  * Display the form of the event import and the listing of events users can import
  * from the calendar file.
  * */
 public function import($data)
 {
     $events = $data['events'];
     $config = JFactory::getConfig();
     $offset = $config->get('offset');
     if (isset($data['icalParser'])) {
         $parser = $data['icalParser'];
         if (isset($parser->cal['VTIMEZONE']['TZID'])) {
             $offset = $parser->cal['VTIMEZONE']['TZID'];
         }
     }
     $groupId = JRequest::getInt('groupid', 0);
     $groupLink = $groupId > 0 ? '&groupid=' . $groupId : '';
     $saveImportLink = CRoute::_('index.php?option=com_community&view=events&task=saveImport' . $groupLink);
     if (!$this->accessAllowed('registered')) {
         return;
     }
     //$this->showSubmenu();
     /**
      * Opengraph
      */
     CHeadHelper::setType('website', JText::_('COM_COMMUNITY_EVENTS_IMPORT_ICAL'));
     $model = CFactory::getModel('events');
     $categories = $model->getCategories();
     //CFactory::load( 'helpers' , 'event' );
     $event = JTable::getInstance('Event', 'CTable');
     //CFactory::load( 'helpers' , 'time' );
     $timezones = CTimeHelper::getTimezoneList();
     $offsetValue = new DateTime('now', new DateTimeZone($offset));
     $offsetValue = (int) $offsetValue->format('P');
     $tmpl = new CTemplate();
     echo CMiniHeader::showEventMiniHeader($event->id);
     echo $tmpl->set('events', $events)->set('categories', $categories)->set('timezones', $timezones)->set('offset', $offset)->set('saveimportlink', $saveImportLink)->set('offsetValue', $offsetValue)->set('submenu', $this->showSubmenu(false))->set('pageTitle', $groupId ? JText::_('COM_COMMUNITY_EVENTS_IMPORT_GROUP_EVENT') : JText::_('COM_COMMUNITY_IMPORT_EVENTS'))->set('canCreate', CFactory::getUser()->authorise('community.create', 'events'))->fetch('events.import');
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:38,代码来源:view.html.php

示例3: getTimezone

 /**
  * Retrieve timezone.
  * 
  * @param	int	$offset	The current offset
  * @return	string	The current time zone for the given offset.
  **/
 public static function getTimezone($offset)
 {
     $timezone = CTimeHelper::getTimezoneList();
     return $timezone[$offset];
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:11,代码来源:time.php

示例4: import

 /**
  * Display the form of the event import and the listing of events users can import
  * from the calendar file.	 
  **/
 public function import($events)
 {
     if (!$this->accessAllowed('registered')) {
         return;
     }
     $document = JFactory::getDocument();
     $config = CFactory::getConfig();
     $document->setTitle(JText::_('COM_COMMUNITY_EVENTS_IMPORT_ICAL'));
     $this->showSubmenu();
     $model = CFactory::getModel('events');
     $categories = $model->getCategories();
     CFactory::load('helpers', 'time');
     $timezones = CTimeHelper::getTimezoneList();
     $tmpl = new CTemplate();
     echo $tmpl->set('events', $events)->set('categories', $categories)->set('timezones', $timezones)->fetch('events.import');
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:20,代码来源:view.html.php


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