本文整理汇总了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;
//.........这里部分代码省略.........