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


PHP TBGSettings::getUserTimezone方法代码示例

本文整理汇总了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);
//.........这里部分代码省略.........
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:101,代码来源:common.inc.php

示例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;
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:26,代码来源:TBGContext.class.php


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