當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。