當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CTimeHelper::getOffsetByTimezone方法代碼示例

本文整理匯總了PHP中CTimeHelper::getOffsetByTimezone方法的典型用法代碼示例。如果您正苦於以下問題:PHP CTimeHelper::getOffsetByTimezone方法的具體用法?PHP CTimeHelper::getOffsetByTimezone怎麽用?PHP CTimeHelper::getOffsetByTimezone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CTimeHelper的用法示例。


在下文中一共展示了CTimeHelper::getOffsetByTimezone方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: save

 /**
  * Method to save the group
  * @return false if create fail, return the group id if create is successful
  * */
 public function save($event, $isDuplicate = false)
 {
     // Check for request forgeries
     JSession::checkToken('post') or jexit(JText::_('COM_COMMUNITY_INVALID_TOKEN'));
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $viewName = $jinput->get('view', $this->getName(), 'String');
     $view = $this->getView($viewName, '', $viewType);
     if (JString::strtoupper($jinput->getMethod()) != 'POST') {
         $view->addWarning(JText::_('COM_COMMUNITY_PERMISSION_DENIED_WARNING'));
         return false;
     }
     // Get my current data.
     $my = CFactory::getUser();
     $validated = true;
     $model = $this->getModel('events');
     $eventId = $jinput->get->get('eventid', 0, 'Int');
     $isNew = $eventId == 0 ? true : false;
     $postData = JRequest::get('post');
     $repeataction = $jinput->get('repeataction', null, 'NONE');
     $inviteAllMembers = $jinput->get('invitegroupmembers', 0, 'INT');
     if (!isset($postData['allday'])) {
         $postData['allday'] = 0;
     }
     //format startdate and eendate with time before we bind into event object
     $postData = $this->_formatStartEndDate($postData);
     $event->load($eventId);
     // record event original start and end date
     $postData['oldstartdate'] = $event->startdate;
     $postData['oldenddate'] = $event->enddate;
     $postData['unlisted'] = JRequest::getVar('unlisted', 0, 'post', 'int', JREQUEST_ALLOWRAW);
     if (CFactory::getConfig()->get('eventshowtimezone')) {
         $timezoneName = $postData['offset'];
         $postData['offset'] = CTimeHelper::getOffsetByTimezone($postData['offset']);
         //update offset before binding
     }
     $event->bind($postData);
     if (!array_key_exists('permission', $postData)) {
         $event->permission = 0;
     }
     if (!array_key_exists('allowinvite', $postData)) {
         $event->allowinvite = 0;
     } elseif (isset($postData['endtime-ampm']) && $postData['endtime-ampm'] == 'AM' && $postData['endtime-hour'] == 12) {
         $postData['endtime-hour'] = 00;
     }
     $inputFilter = CFactory::getInputFilter(true);
     // Despite the bind, we would still need to capture RAW description
     $event->description = JRequest::getVar('description', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $event->description = $inputFilter->clean($event->description);
     // binding the params
     $params = new CParameter('');
     $photoPermissionAdmin = $jinput->get('photopermission-admin', 0, 'STRING');
     $photoPermissionMember = $jinput->get('photopermission-member', 0, 'STRING');
     $videoPermissionAdmin = $jinput->get('videopermission-admin', 0, 'STRING');
     $videoPermissionMember = $jinput->get('videopermission-member', 0, 'STRING');
     $eventRecentPhotos = $jinput->get('eventrecentphotos', 6, 'STRING');
     $eventRecentVideos = $jinput->get('eventrecentvideos', 6, 'STRING');
     $params->set('eventrecentphotos', $eventRecentPhotos);
     $params->set('eventrecentvideos', $eventRecentVideos);
     $params->set('timezone', $timezoneName);
     if ($photoPermissionAdmin) {
         $params->set('photopermission', EVENT_PHOTO_PERMISSION_ADMINS);
         if ($photoPermissionMember) {
             $params->set('photopermission', EVENT_PHOTO_PERMISSION_ALL);
         }
     } else {
         $params->set('photopermission', EVENT_PHOTO_PERMISSION_DISABLE);
     }
     if ($videoPermissionAdmin) {
         $params->set('videopermission', EVENT_VIDEO_PERMISSION_ADMINS);
         if ($videoPermissionMember) {
             $params->set('videopermission', EVENT_VIDEO_PERMISSION_ALL);
         }
     } else {
         $params->set('videopermission', EVENT_VIDEO_PERMISSION_DISABLE);
     }
     $event->params = $params->toString();
     // @rule: Test for emptyness
     if (empty($event->title)) {
         $validated = false;
         $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_EVENTS_TITLE_ERROR'), 'error');
     }
     if (empty($event->location)) {
         $validated = false;
         $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_EVENTS_LOCATION_ERR0R'), 'error');
     }
     // @rule: Test if the event is exists
     if ($model->isEventExist($event->title, $event->location, $event->startdate, $event->enddate, $eventId, $event->parent)) {
         $validated = false;
         $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_EVENTS_TAKEN_ERROR'), 'error');
     }
     // @rule: Start date cannot be empty
     if (empty($event->startdate)) {
         $validated = false;
//.........這裏部分代碼省略.........
開發者ID:joshjim27,項目名稱:jobsglobal,代碼行數:101,代碼來源:events.php


注:本文中的CTimeHelper::getOffsetByTimezone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。