本文整理汇总了PHP中ModuleUser_EntityUser::setSettingsTimezone方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleUser_EntityUser::setSettingsTimezone方法的具体用法?PHP ModuleUser_EntityUser::setSettingsTimezone怎么用?PHP ModuleUser_EntityUser::setSettingsTimezone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModuleUser_EntityUser
的用法示例。
在下文中一共展示了ModuleUser_EntityUser::setSettingsTimezone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: EventTuning
/**
* Дополнительные настройки сайта
*/
protected function EventTuning()
{
$this->sMenuItemSelect = 'settings';
$this->sMenuSubItemSelect = 'tuning';
$this->Viewer_AddHtmlTitle($this->Lang_Get('settings_menu_tuning'));
$aTimezoneList = array('-12', '-11', '-10', '-9.5', '-9', '-8', '-7', '-6', '-5', '-4.5', '-4', '-3.5', '-3', '-2', '-1', '0', '1', '2', '3', '3.5', '4', '4.5', '5', '5.5', '5.75', '6', '6.5', '7', '8', '8.75', '9', '9.5', '10', '10.5', '11', '11.5', '12', '12.75', '13', '14');
$this->Viewer_Assign('aTimezoneList', $aTimezoneList);
/**
* Если отправили форму с настройками - сохраняем
*/
if (isPost('submit_settings_tuning')) {
$this->Security_ValidateSendForm();
if (in_array(getRequestStr('settings_general_timezone'), $aTimezoneList)) {
$this->oUserCurrent->setSettingsTimezone(getRequestStr('settings_general_timezone'));
}
$this->oUserCurrent->setSettingsNoticeNewTopic(getRequest('settings_notice_new_topic') ? 1 : 0);
$this->oUserCurrent->setSettingsNoticeNewComment(getRequest('settings_notice_new_comment') ? 1 : 0);
$this->oUserCurrent->setSettingsNoticeNewTalk(getRequest('settings_notice_new_talk') ? 1 : 0);
$this->oUserCurrent->setSettingsNoticeReplyComment(getRequest('settings_notice_reply_comment') ? 1 : 0);
$this->oUserCurrent->setSettingsNoticeNewFriend(getRequest('settings_notice_new_friend') ? 1 : 0);
$this->oUserCurrent->setProfileDate(date("Y-m-d H:i:s"));
/**
* Запускаем выполнение хуков
*/
$this->Hook_Run('settings_tuning_save_before', array('oUser' => $this->oUserCurrent));
if ($this->User_Update($this->oUserCurrent)) {
$this->Message_AddNoticeSingle($this->Lang_Get('settings_tuning_submit_ok'));
$this->Hook_Run('settings_tuning_save_after', array('oUser' => $this->oUserCurrent));
} else {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'));
}
} else {
if (is_null($this->oUserCurrent->getSettingsTimezone())) {
$_REQUEST['settings_general_timezone'] = (strtotime(date("Y-m-d H:i:s")) - strtotime(gmdate("Y-m-d H:i:s"))) / 3600 - date('I');
} else {
$_REQUEST['settings_general_timezone'] = $this->oUserCurrent->getSettingsTimezone();
}
}
}
示例2: EventTuning
/**
* Дополнительные настройки сайта
*/
protected function EventTuning()
{
$this->sMenuItemSelect = 'settings';
$this->sMenuSubItemSelect = 'tuning';
$this->Viewer_AddHtmlTitle($this->Lang_Get('user.settings.nav.tuning'));
$aTimezoneList = DateTimeZone::listIdentifiers();
$this->Viewer_Assign('aTimezoneList', $aTimezoneList);
/**
* Если отправили форму с настройками - сохраняем
*/
if (isPost()) {
$this->Security_ValidateSendForm();
if (in_array(getRequestStr('settings_general_timezone'), $aTimezoneList)) {
$this->oUserCurrent->setSettingsTimezone(getRequestStr('settings_general_timezone'));
}
$this->oUserCurrent->setSettingsNoticeNewTopic(getRequest('settings_notice_new_topic') ? 1 : 0);
$this->oUserCurrent->setSettingsNoticeNewComment(getRequest('settings_notice_new_comment') ? 1 : 0);
$this->oUserCurrent->setSettingsNoticeNewTalk(getRequest('settings_notice_new_talk') ? 1 : 0);
$this->oUserCurrent->setSettingsNoticeReplyComment(getRequest('settings_notice_reply_comment') ? 1 : 0);
$this->oUserCurrent->setSettingsNoticeNewFriend(getRequest('settings_notice_new_friend') ? 1 : 0);
$this->oUserCurrent->setProfileDate(date("Y-m-d H:i:s"));
/**
* Запускаем выполнение хуков
*/
$this->Hook_Run('settings_tuning_save_before', array('oUser' => $this->oUserCurrent));
if ($this->User_Update($this->oUserCurrent)) {
$this->Message_AddNoticeSingle($this->Lang_Get('common.success.save'));
$this->Hook_Run('settings_tuning_save_after', array('oUser' => $this->oUserCurrent));
} else {
$this->Message_AddErrorSingle($this->Lang_Get('common.error.system.base'));
}
} else {
if (is_null($this->oUserCurrent->getSettingsTimezone())) {
$_REQUEST['settings_general_timezone'] = date_default_timezone_get();
} else {
$_REQUEST['settings_general_timezone'] = $this->oUserCurrent->getSettingsTimezone();
}
}
}