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


PHP CTimeZone::disable方法代码示例

本文整理汇总了PHP中CTimeZone::disable方法的典型用法代码示例。如果您正苦于以下问题:PHP CTimeZone::disable方法的具体用法?PHP CTimeZone::disable怎么用?PHP CTimeZone::disable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CTimeZone的用法示例。


在下文中一共展示了CTimeZone::disable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getList

 public static function getList($userId, $taskId, array $parameters = array())
 {
     $data = array();
     $task = static::getTask($userId, $taskId);
     if ($task !== null && $task->checkCanRead()) {
         $res = \CTaskLog::GetList(array('CREATED_DATE' => 'DESC'), array('TASK_ID' => $taskId));
         $tzDisabled = !\CTimeZone::enabled();
         if ($tzDisabled) {
             \CTimeZone::enable();
         }
         $tzOffset = \CTimeZone::getOffset();
         if ($tzDisabled) {
             \CTimeZone::disable();
         }
         while (true) {
             if ($parameters['ESCAPE_DATA']) {
                 $item = $res->GetNext();
             } else {
                 $item = $res->fetch();
             }
             if (!$item) {
                 break;
             }
             // Adjust unix timestamps to "bitrix timestamps"
             if (isset(\CTaskLog::$arComparedFields[$item['FIELD']]) && \CTaskLog::$arComparedFields[$item['FIELD']] === 'date') {
                 $item['TO_VALUE'] = $item['TO_VALUE'] + $tzOffset;
                 $item['FROM_VALUE'] = $item['FROM_VALUE'] + $tzOffset;
             }
             $data[] = $item;
         }
     }
     return array('DATA' => $data, 'CAN' => array());
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:33,代码来源:log.php

示例2: getProductData

 /**
  * Returns product data.
  *
  * @param array &$productData			Product data.
  * @param array $entityData				Entity data.
  * @param array $iblockData				Iblock list data.
  * @return void
  */
 protected static function getProductData(&$productData, $entityData, $iblockData)
 {
     if (!empty($iblockData['iblockElement'])) {
         $productList = array_keys($productData);
         if (!empty($entityData['iblockFields'])) {
             $elementIterator = Iblock\ElementTable::getList(array('select' => array_merge(array('ID'), array_keys($entityData['iblockFields'])), 'filter' => array('@ID' => $productList)));
             while ($element = $elementIterator->fetch()) {
                 $element['ID'] = (int) $element['ID'];
                 $fields = array();
                 foreach ($entityData['iblockFields'] as $key => $alias) {
                     $fields[$alias] = $element[$key];
                 }
                 unset($key, $alias);
                 $productData[$element['ID']] = empty($productData[$element['ID']]) ? $fields : array_merge($productData[$element['ID']], $fields);
                 unset($fields);
             }
         }
         if ($entityData['sections']) {
             $productSection = array_fill_keys($productList, array());
             $elementSectionIterator = Iblock\SectionElementTable::getList(array('select' => array('*'), 'filter' => array('@IBLOCK_ELEMENT_ID' => $productList)));
             while ($elementSection = $elementSectionIterator->fetch()) {
                 $elementSection['IBLOCK_ELEMENT_ID'] = (int) $elementSection['IBLOCK_ELEMENT_ID'];
                 $elementSection['IBLOCK_SECTION_ID'] = (int) $elementSection['IBLOCK_SECTION_ID'];
                 $elementSection['ADDITIONAL_PROPERTY_ID'] = (int) $elementSection['ADDITIONAL_PROPERTY_ID'];
                 if ($elementSection['ADDITIONAL_PROPERTY_ID'] > 0) {
                     continue;
                 }
                 $productSection[$elementSection['IBLOCK_ELEMENT_ID']][$elementSection['IBLOCK_SECTION_ID']] = true;
                 $parentSectionIterator = \CIBlockSection::getNavChain(0, $elementSection['IBLOCK_SECTION_ID'], array('ID'));
                 while ($parentSection = $parentSectionIterator->fetch()) {
                     $parentSection['ID'] = (int) $parentSection['ID'];
                     $productSection[$elementSection['IBLOCK_ELEMENT_ID']][$parentSection['ID']] = true;
                 }
                 unset($parentSection, $parentSectionIterator);
             }
             unset($elementSection, $elementSectionIterator);
             foreach ($productSection as $element => $sections) {
                 $productData[$element]['SECTION_ID'] = array_keys($sections);
             }
             unset($element, $sections, $productSection);
         }
         if (!empty($entityData['needProperties'])) {
             $propertyValues = array_fill_keys($productList, array());
             foreach ($entityData['needProperties'] as $iblock => $propertyList) {
                 if (empty($iblockData['iblockElement'][$iblock])) {
                     continue;
                 }
                 $filter = array('ID' => $iblockData['iblockElement'][$iblock], 'IBLOCK_ID' => $iblock);
                 \CTimeZone::disable();
                 \CIBlockElement::getPropertyValuesArray($propertyValues, $iblock, $filter, array('ID' => $propertyList));
                 \CTimeZone::enable();
             }
             unset($filter, $iblock, $propertyList);
             self::convertProperties($productData, $propertyValues, $entityData, $iblockData);
         }
         if (!empty($entityData['catalogFields'])) {
             $productIterator = Catalog\ProductTable::getList(array('select' => array_merge(array('ID'), array_keys($entityData['catalogFields'])), 'filter' => array('@ID' => $productList)));
             while ($product = $productIterator->fetch()) {
                 $product['ID'] = (int) $product['ID'];
                 $fields = array();
                 foreach ($entityData['catalogFields'] as $key => $alias) {
                     $fields[$alias] = $product[$key];
                 }
                 unset($key, $alias);
                 $productData[$product['ID']] = empty($productData[$product['ID']]) ? $fields : array_merge($productData[$product['ID']], $fields);
                 unset($fields);
             }
             unset($product, $productIterator);
         }
         if (!empty($iblockData['skuIblockList'])) {
             self::getParentProducts($productData, $entityData, $iblockData);
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:82,代码来源:discountmanager.php

示例3: convertDateStringToTimestamp

 private static function convertDateStringToTimestamp($operation, $value)
 {
     switch ($operation) {
         case self::OP_DATE_TODAY:
         case self::OP_DATE_YESTERDAY:
         case self::OP_DATE_TOMORROW:
         case self::OP_DATE_CUR_WEEK:
         case self::OP_DATE_PREV_WEEK:
         case self::OP_DATE_NEXT_WEEK:
         case self::OP_DATE_CUR_MONTH:
         case self::OP_DATE_PREV_MONTH:
         case self::OP_DATE_NEXT_MONTH:
             $value = '';
             break;
         case self::OP_DATE_LAST_DAYS:
         case self::OP_DATE_NEXT_DAYS:
             $value = (int) $value;
             break;
         default:
         case self::OP_EQUAL:
         case self::OP_NOT_EQUAL:
         case self::OP_STRICTLY_LESS:
         case self::OP_STRICTLY_GREATER:
         case self::OP_LESS_OR_EQUAL:
         case self::OP_GREATER_OR_EQUAL:
             $bTzWasDisabled = !CTimeZone::enabled();
             if ($bTzWasDisabled) {
                 CTimeZone::enable();
             }
             // get correct UnixTimestamp
             $value = (int) MakeTimeStamp($value) - CTimeZone::getOffset();
             if ($bTzWasDisabled) {
                 CTimeZone::disable();
             }
             break;
     }
     return $value;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:38,代码来源:taskfilterctrl.php

示例4: tasksFormatDate

function tasksFormatDate($in_date)
{
    $date = $in_date;
    $strDate = false;
    if (!is_int($in_date)) {
        $date = MakeTimeStamp($in_date);
    }
    if ($date === false || $date === -1 || $date === 0) {
        $date = MakeTimeStamp($in_date);
    }
    // It can be other date on server (relative to client), ...
    $bTzWasDisabled = !CTimeZone::enabled();
    if ($bTzWasDisabled) {
        CTimeZone::enable();
    }
    $ts = time() + CTimeZone::getOffset();
    // ... so shift cur timestamp to compensate it.
    if ($bTzWasDisabled) {
        CTimeZone::disable();
    }
    $curDateStrAtClient = date('d.m.Y', $ts);
    $yesterdayDateStrAtClient = date('d.m.Y', strtotime('-1 day', $ts));
    if ($curDateStrAtClient === date('d.m.Y', $date)) {
        $strDate = FormatDate("today", $date);
    } elseif ($yesterdayDateStrAtClient === date('d.m.Y', $date)) {
        $strDate = FormatDate("yesterday", $date);
    } else {
        if (defined('FORMAT_DATE')) {
            $strDate = FormatDate(CDatabase::DateFormatToPHP(FORMAT_DATE), $date);
        } else {
            $strDate = FormatDate("d.m.Y", $date);
        }
    }
    return $strDate;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:35,代码来源:tools.php

示例5: CLearnPath

            $arResult['LEARNING_GROUP_CHAPTERS_ACTIVE_FROM'] = $activeFromMap;
        }
        $oPath = new CLearnPath();
        $oPath->ImportUrlencoded($arParams['LESSON_PATH']);
        $arPath = $oPath->GetPathAsArray();
        if (count($arPath) >= 2) {
            $secondLevelLesson = $arPath[1];
            if (isset($arResult['LEARNING_GROUP_CHAPTERS_ACTIVE_FROM'][$secondLevelLesson])) {
                $activeFrom = $arResult['LEARNING_GROUP_CHAPTERS_ACTIVE_FROM'][$secondLevelLesson];
                $bTzWasDisabled = !CTimeZone::enabled();
                if ($bTzWasDisabled) {
                    CTimeZone::enable();
                }
                $tzOffset = CTimeZone::getOffset();
                if ($bTzWasDisabled) {
                    CTimeZone::disable();
                }
                // Adjust unix timestamp to bitrix-timestamp for correct comparision below
                $nowTimestamp = time() + $tzOffset;
                if ($nowTimestamp < MakeTimeStamp($activeFrom)) {
                    $delayed = $activeFrom;
                }
            }
        }
    }
}
$lastDirtyCacheTS = COption::GetOptionString('learning', CLearnCacheOfLessonTreeComponent::OPTION_TS, time());
// was: if($this->StartResultCache(false, $USER->GetGroups()))
$additionalCacheID = CLearnAccess::GetAccessSymbolsHashForSiteUser() . '|' . $ratingTransistor . '|' . $lastDirtyCacheTS . '|' . ($delayed === false ? 'ND' : 'D');
if ($this->StartResultCache(false, $additionalCacheID)) {
    // Module
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例6: UnifyFields

 public static function UnifyFields(&$value, $key)
 {
     if (array_key_exists($key, self::$arComparedFields)) {
         switch (self::$arComparedFields[$key]) {
             case "integer":
                 $value = intval($value);
                 break;
             case "string":
                 $value = trim($value);
                 break;
             case "array":
                 if (!is_array($value)) {
                     $value = explode(",", $value);
                 }
                 $value = array_unique(array_filter(array_map("trim", $value)));
                 sort($value);
                 break;
             case "date":
                 $value = MakeTimeStamp($value);
                 if (!$value) {
                     $value = strtotime($value);
                     // There is correct Unix timestamp in return value
                     // CTimeZone::getOffset() substraction here???
                 } else {
                     // It can be other date on server (relative to client), ...
                     $bTzWasDisabled = !CTimeZone::enabled();
                     if ($bTzWasDisabled) {
                         CTimeZone::enable();
                     }
                     $value -= CTimeZone::getOffset();
                     // get correct UnixTimestamp
                     if ($bTzWasDisabled) {
                         CTimeZone::disable();
                     }
                     // We mustn't store result of MakeTimestamp() in DB,
                     // because it is shifted for time zone offset already,
                     // which can't be restored.
                 }
                 break;
             case "bool":
                 if ($value != "Y") {
                     $value = "N";
                 }
                 break;
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:47,代码来源:tasklog.php

示例7: getSqlForTimestamps

 private static function getSqlForTimestamps($key, $val, $userID, $sAliasPrefix, $bGetZombie)
 {
     static $ts = null;
     // some fixed timestamp of "now" (for consistency)
     if ($ts === null) {
         $ts = CTasksPerHitOption::getHitTimestamp();
     }
     $bTzWasDisabled = !CTimeZone::enabled();
     if ($bTzWasDisabled) {
         CTimeZone::enable();
     }
     // Adjust UNIX TS to "Bitrix timestamp"
     $tzOffset = CTimeZone::getOffset();
     $val += $tzOffset;
     $ts += $tzOffset;
     if ($bTzWasDisabled) {
         CTimeZone::disable();
     }
     $arSqlSearch = array();
     $arFilter = array('::LOGIC' => 'AND');
     $key = ltrim($key);
     $res = CTasks::MkOperationFilter($key);
     $fieldName = substr($res["FIELD"], 5, -3);
     // Cutoff prefix "META:" and suffix "_TS"
     $cOperationType = $res["OPERATION"];
     $operationSymbol = substr($key, 0, -1 * strlen($res["FIELD"]));
     if (substr($cOperationType, 0, 1) !== '#') {
         switch ($operationSymbol) {
             case '<':
                 $operationCode = CTaskFilterCtrl::OP_STRICTLY_LESS;
                 break;
             case '>':
                 $operationCode = CTaskFilterCtrl::OP_STRICTLY_GREATER;
                 break;
             case '<=':
                 $operationCode = CTaskFilterCtrl::OP_LESS_OR_EQUAL;
                 break;
             case '>=':
                 $operationCode = CTaskFilterCtrl::OP_GREATER_OR_EQUAL;
                 break;
             case '!=':
                 $operationCode = CTaskFilterCtrl::OP_NOT_EQUAL;
                 break;
             case '':
             case '=':
                 $operationCode = CTaskFilterCtrl::OP_EQUAL;
                 break;
             default:
                 CTaskAssert::log('Unknown operation code: ' . $operationSymbol . '; $key = ' . $key . '; it will be silently ignored, incorrect results expected', CTaskAssert::ELL_ERROR);
                 return $arSqlSearch;
                 break;
         }
     } else {
         $operationCode = (int) substr($cOperationType, 1);
     }
     $date1 = $date2 = $cOperationType1 = $cOperationType2 = null;
     // Convert cOperationType to format accepted by self::FilterCreate
     switch ($operationCode) {
         case CTaskFilterCtrl::OP_EQUAL:
         case CTaskFilterCtrl::OP_DATE_TODAY:
         case CTaskFilterCtrl::OP_DATE_YESTERDAY:
         case CTaskFilterCtrl::OP_DATE_TOMORROW:
         case CTaskFilterCtrl::OP_DATE_CUR_WEEK:
         case CTaskFilterCtrl::OP_DATE_PREV_WEEK:
         case CTaskFilterCtrl::OP_DATE_NEXT_WEEK:
         case CTaskFilterCtrl::OP_DATE_CUR_MONTH:
         case CTaskFilterCtrl::OP_DATE_PREV_MONTH:
         case CTaskFilterCtrl::OP_DATE_NEXT_MONTH:
         case CTaskFilterCtrl::OP_DATE_NEXT_DAYS:
         case CTaskFilterCtrl::OP_DATE_LAST_DAYS:
             $cOperationType1 = '>=';
             $cOperationType2 = '<=';
             break;
         case CTaskFilterCtrl::OP_LESS_OR_EQUAL:
             $cOperationType1 = '<=';
             break;
         case CTaskFilterCtrl::OP_GREATER_OR_EQUAL:
             $cOperationType1 = '>=';
             break;
         case CTaskFilterCtrl::OP_NOT_EQUAL:
             $cOperationType1 = '<';
             $cOperationType2 = '>';
             break;
         case CTaskFilterCtrl::OP_STRICTLY_LESS:
             $cOperationType1 = '<';
             break;
         case CTaskFilterCtrl::OP_STRICTLY_GREATER:
             $cOperationType1 = '>';
             break;
         default:
             CTaskAssert::log('Unknown operation code: ' . $operationCode . '; $key = ' . $key . '; it will be silently ignored, incorrect results expected', CTaskAssert::ELL_ERROR);
             return $arSqlSearch;
             break;
     }
     // Convert/generate dates
     $ts1 = $ts2 = null;
     switch ($operationCode) {
         case CTaskFilterCtrl::OP_DATE_TODAY:
             $ts1 = $ts2 = $ts;
             break;
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:task.php

示例8: getTimeZoneOffset

 /**
  * Not part of public API, for internal use only.
  * @deprecated
  * @access private
  */
 public static function getTimeZoneOffset($userId = false)
 {
     $bTzWasDisabled = !CTimeZone::enabled();
     if ($bTzWasDisabled) {
         CTimeZone::enable();
     }
     if ($userId === false) {
         $tzOffset = CTimeZone::getOffset();
     } else {
         $tzOffset = CTimeZone::getOffset($userId);
     }
     if ($bTzWasDisabled) {
         CTimeZone::disable();
     }
     return $tzOffset;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:21,代码来源:tasktools.php


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