本文整理汇总了PHP中TBGSettings::getUserTimezone方法的典型用法代码示例。如果您正苦于以下问题:PHP TBGSettings::getUserTimezone方法的具体用法?PHP TBGSettings::getUserTimezone怎么用?PHP TBGSettings::getUserTimezone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBGSettings
的用法示例。
在下文中一共展示了TBGSettings::getUserTimezone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tbg_formatTime
/**
* Returns a formatted string of the given timestamp
*
* @param integer $tstamp the timestamp to format
* @param integer $format[optional] the format
* @param integer $skiptimestamp
*/
function tbg_formatTime($tstamp, $format = 0)
{
// offset the timestamp properly
if (TBGSettings::getGMToffset() > 0) {
$tstamp += TBGSettings::getGMToffset() * 60 * 60;
} elseif (TBGSettings::getGMToffset() < 0) {
$tstamp -= TBGSettings::getGMToffset() * 60 * 60;
}
if (TBGSettings::getUserTimezone() > 0) {
$tstamp += TBGSettings::getUserTimezone() * 60 * 60;
} elseif (TBGSettings::getUserTimezone() < 0) {
$tstamp -= TBGSettings::getUserTimezone() * 60 * 60;
}
switch ($format) {
case 1:
$tstring = strftime(TBGContext::getI18n()->getDateTimeFormat(1), $tstamp);
break;
case 2:
$tstring = strftime(TBGContext::getI18n()->getDateTimeFormat(2), $tstamp);
break;
case 3:
$tstring = strftime(TBGContext::getI18n()->getDateTimeFormat(3), $tstamp);
break;
case 4:
$tstring = strftime(TBGContext::getI18n()->getDateTimeFormat(4), $tstamp);
break;
case 5:
$tstring = strftime(TBGContext::getI18n()->getDateTimeFormat(5), $tstamp);
break;
case 6:
$tstring = strftime(TBGContext::getI18n()->getDateTimeFormat(6), $tstamp);
break;
case 7:
$tstring = strftime(TBGContext::getI18n()->getDateTimeFormat(7), $tstamp);
break;
case 8:
$tstring = strftime(TBGContext::getI18n()->getDateTimeFormat(8), $tstamp);
break;
case 9:
$tstring = strftime(TBGContext::getI18n()->getDateTimeFormat(9), $tstamp);
break;
case 10:
$tstring = strftime(TBGContext::getI18n()->getDateTimeFormat(10), $tstamp);
break;
case 11:
$tstring = strftime(TBGContext::getI18n()->getDateTimeFormat(9), $tstamp);
break;
case 12:
$tstring = '';
if (date('dmY', $tstamp) == date('dmY')) {
$tstring .= __('Today') . ', ';
} elseif (date('dmY', $tstamp) == date('dmY', mktime(0, 0, 0, date('m'), date('d') - 1))) {
$tstring .= __('Yesterday') . ', ';
} elseif (date('dmY', $tstamp) == date('dmY', mktime(0, 0, 0, date('m'), date('d') + 1))) {
$tstring .= __('Tomorrow') . ', ';
} else {
$tstring .= strftime(TBGContext::getI18n()->getDateTimeFormat(12) . ', ', $tstamp);
}
$tstring .= strftime(TBGContext::getI18n()->getDateTimeFormat(14), $tstamp);
break;
case 13:
$tstring = '';
if (date('dmY', $tstamp) == date('dmY')) {
//$tstring .= __('Today') . ', ';
} elseif (date('dmY', $tstamp) == date('dmY', mktime(0, 0, 0, date('m'), date('d') - 1))) {
$tstring .= __('Yesterday') . ', ';
} elseif (date('dmY', $tstamp) == date('dmY', mktime(0, 0, 0, date('m'), date('d') + 1))) {
$tstring .= __('Tomorrow') . ', ';
} else {
$tstring .= strftime(TBGContext::getI18n()->getDateTimeFormat(12) . ', ', $tstamp);
}
$tstring .= strftime(TBGContext::getI18n()->getDateTimeFormat(14), $tstamp);
break;
case 14:
$tstring = '';
if (date('dmY', $tstamp) == date('dmY')) {
$tstring .= __('Today');
} elseif (date('dmY', $tstamp) == date('dmY', mktime(0, 0, 0, date('m'), date('d') - 1))) {
$tstring .= __('Yesterday');
} elseif (date('dmY', $tstamp) == date('dmY', mktime(0, 0, 0, date('m'), date('d') + 1))) {
$tstring .= __('Tomorrow');
} else {
$tstring .= strftime(TBGContext::getI18n()->getDateTimeFormat(12), $tstamp);
}
break;
case 15:
$tstring = strftime(TBGContext::getI18n()->getDateTimeFormat(11), $tstamp);
break;
case 16:
$tstring = strftime(TBGContext::getI18n()->getDateTimeFormat(12), $tstamp);
break;
case 17:
$tstring = strftime(TBGContext::getI18n()->getDateTimeFormat(13), $tstamp);
//.........这里部分代码省略.........
示例2: loadUser
/**
* Load the user object into the user property
*
* @return TBGUser
*/
public static function loadUser($user = null)
{
try {
self::$_user = $user === null ? TBGUser::loginCheck(self::getRequest()->getParameter('tbg3_username'), self::getRequest()->getParameter('tbg3_password')) : $user;
if (self::$_user->isAuthenticated()) {
if (self::$_user->isOffline() || self::$_user->isAway()) {
self::$_user->setOnline();
}
self::$_user->updateLastSeen();
self::$_user->setTimezone(TBGSettings::getUserTimezone());
self::$_user->setLanguage(TBGSettings::getUserLanguage());
self::$_user->save();
if (!self::$_user->getGroup() instanceof TBGGroup) {
throw new Exception('This user account belongs to a group that does not exist anymore. <br>Please contact the system administrator.');
}
}
} catch (Exception $e) {
throw $e;
}
return self::$_user;
}