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


PHP DateTime::createFromUserTime方法代码示例

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


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

示例1: array

             $arItem['CATALOG_MEASURE'] = 0;
         }
         if (!isset($arItem['CATALOG_MEASURE_NAME'])) {
             $arItem['CATALOG_MEASURE_NAME'] = '';
         }
         $arItem['CATALOG_MEASURE_NAME'] = $arDefaultMeasure['SYMBOL_RUS'];
         $arItem['~CATALOG_MEASURE_NAME'] = $arDefaultMeasure['~SYMBOL_RUS'];
         if (0 < $arItem['CATALOG_MEASURE']) {
             if (!isset($arMeasureMap[$arItem['CATALOG_MEASURE']])) {
                 $arMeasureMap[$arItem['CATALOG_MEASURE']] = array();
             }
             $arMeasureMap[$arItem['CATALOG_MEASURE']][] = $intKey;
         }
     }
     if ($arParams["SET_LAST_MODIFIED"]) {
         $time = DateTime::createFromUserTime($arItem["TIMESTAMP_X"]);
         if (!isset($arResult["ITEMS_TIMESTAMP_X"]) || $time->getTimestamp() > $arResult["ITEMS_TIMESTAMP_X"]->getTimestamp()) {
             $arResult["ITEMS_TIMESTAMP_X"] = $time;
         }
     }
     $arResult["ITEMS"][$intKey] = $arItem;
     $arResult["ELEMENTS"][$intKey] = $arItem["ID"];
     $arElementLink[$arItem['ID']] =& $arResult["ITEMS"][$intKey];
     $intKey++;
 }
 $arResult['MODULES'] = $arResultModules;
 $navComponentParameters = array();
 if ($arParams["PAGER_BASE_LINK_ENABLE"] === "Y") {
     $pagerBaseLink = trim($arParams["PAGER_BASE_LINK"]);
     if ($pagerBaseLink === "") {
         $pagerBaseLink = $arResult["SECTION_PAGE_URL"];
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php

示例2:

	if ($arParams["ADD_SECTIONS_CHAIN"] && !empty($arResult["SECTION"]["PATH"]) && is_array($arResult["SECTION"]["PATH"]))
	{
		foreach($arResult["SECTION"]["PATH"] as $arPath)
		{
			if ($arPath["IPROPERTY_VALUES"]["SECTION_PAGE_TITLE"] != "")
				$APPLICATION->AddChainItem($arPath["IPROPERTY_VALUES"]["SECTION_PAGE_TITLE"], $arPath["~SECTION_PAGE_URL"]);
			else
				$APPLICATION->AddChainItem($arPath["NAME"], $arPath["~SECTION_PAGE_URL"]);
		}
	}
	if ($arParams["ADD_ELEMENT_CHAIN"])
	{
		if ($arResult["IPROPERTY_VALUES"]["ELEMENT_PAGE_TITLE"] != "")
			$APPLICATION->AddChainItem($arResult["IPROPERTY_VALUES"]["ELEMENT_PAGE_TITLE"]);
		else
			$APPLICATION->AddChainItem($arResult["NAME"]);
	}

	if ($arParams["SET_LAST_MODIFIED"] && $arResult["TIMESTAMP_X"])
	{
		Context::getCurrent()->getResponse()->setLastModified(DateTime::createFromUserTime($arResult["TIMESTAMP_X"]));
	}

	return $arResult["ID"];
}
else
{
	return 0;
}
?>
开发者ID:CheBurashka334,项目名称:zakrepi,代码行数:30,代码来源:component.php

示例3: SearchDateChatMessage

 function SearchDateChatMessage($searchDate, $chatId, $bTimeZone = true)
 {
     global $DB;
     $chatId = IntVal($chatId);
     $sqlHelper = Bitrix\Main\Application::getInstance()->getConnection()->getSqlHelper();
     try {
         $dateStart = \Bitrix\Main\Type\DateTime::createFromUserTime($searchDate);
         $sqlDateStart = $sqlHelper->getCharToDateFunction($dateStart->format("Y-m-d H:i:s"));
         $dateEnd = $dateStart->add('1 DAY');
         $sqlDateEnd = $sqlHelper->getCharToDateFunction($dateEnd->format("Y-m-d H:i:s"));
     } catch (\Bitrix\Main\ObjectException $e) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_HISTORY_SEARCH_DATE_EMPTY"), "ERROR_SEARCH_EMPTY");
         return false;
     }
     $limitById = '';
     $ar = \CIMChat::GetRelationById($chatId, $this->user_id);
     if ($ar && $ar['START_ID'] > 0) {
         $limitById = 'AND M.ID >= ' . intval($ar['START_ID']);
     }
     if (!$bTimeZone) {
         CTimeZone::Disable();
     }
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tM.ID,\n\t\t\t\tM.CHAT_ID,\n\t\t\t\tM.MESSAGE,\n\t\t\t\t" . $DB->DatetimeToTimestampFunction('M.DATE_CREATE') . " DATE_CREATE,\n\t\t\t\tM.AUTHOR_ID\n\t\t\tFROM b_im_relation R1\n\t\t\tINNER JOIN b_im_message M ON M.CHAT_ID = R1.CHAT_ID\n\t\t\tWHERE\n\t\t\t\tR1.USER_ID = " . $this->user_id . "\n\t\t\tAND R1.CHAT_ID = " . $chatId . "\n\t\t\tAND R1.MESSAGE_TYPE <> '" . IM_MESSAGE_PRIVATE . "'\n\t\t\tAND M.DATE_CREATE >= " . $sqlDateStart . " AND M.DATE_CREATE <=  " . $sqlDateEnd . "\n\t\t\t\t" . $limitById . "\n\t\t\tORDER BY M.DATE_CREATE DESC, M.ID DESC\n\t\t";
     if (!$bTimeZone) {
         CTimeZone::Enable();
     }
     $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $arMessages = array();
     $arMessageId = array();
     $arUnreadMessage = array();
     $usersMessage = array();
     $CCTP = new CTextParser();
     $CCTP->MaxStringLen = 200;
     $CCTP->allow = array("HTML" => "N", "ANCHOR" => $this->bHideLink ? "N" : "Y", "BIU" => "Y", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => $this->bHideLink ? "N" : "Y", "NL2BR" => "Y", "VIDEO" => "N", "TABLE" => "N", "CUT_ANCHOR" => "N", "ALIGN" => "N");
     while ($arRes = $dbRes->Fetch()) {
         $arMessages[$arRes['ID']] = array('id' => $arRes['ID'], 'chatId' => $arRes['CHAT_ID'], 'senderId' => $arRes['AUTHOR_ID'], 'recipientId' => $arRes['CHAT_ID'], 'date' => $arRes['DATE_CREATE'], 'text' => $CCTP->convertText(htmlspecialcharsbx($arRes['MESSAGE'])));
         $usersMessage[$arRes['CHAT_ID']][] = $arRes['ID'];
         $arMessageId[] = $arRes['ID'];
     }
     $params = CIMMessageParam::Get($arMessageId);
     $arFiles = array();
     foreach ($params as $messageId => $param) {
         $arMessages[$messageId]['params'] = $param;
         if (isset($param['FILE_ID'])) {
             foreach ($param['FILE_ID'] as $fileId) {
                 $arFiles[$fileId] = $fileId;
             }
         }
     }
     $arMessageFiles = CIMDisk::GetFiles($chatId, $arFiles);
     return array('chatId' => $chatId, 'message' => $arMessages, 'unreadMessage' => $arUnreadMessage, 'usersMessage' => $usersMessage, 'files' => $arMessageFiles);
 }
开发者ID:Satariall,项目名称:izurit,代码行数:52,代码来源:im_history.php

示例4: checkFilter

 public static function checkFilter(Main\HttpRequest $request)
 {
     $filter = array();
     if (!empty($request['filter']['filter_type'])) {
         switch ($request['filter']['filter_type']) {
             case 'id':
                 if (isset($request['filter']['order_id_from']) && (int) $request['filter']['order_id_from'] > 0) {
                     $filter['>=ID'] = (int) $request['filter']['order_id_from'];
                 }
                 if (isset($request['filter']['order_id_to']) && (int) $request['filter']['order_id_to'] > 0) {
                     $filter['<=ID'] = (int) $request['filter']['order_id_to'];
                 }
                 break;
             case 'date':
                 CTimeZone::Disable();
                 if (isset($request['filter']['order_date_from']) && is_string($request['filter']['order_date_from'])) {
                     $date = trim($request['filter']['order_date_from']);
                     if ($date != '') {
                         try {
                             $filter['>=DATE_INSERT'] = Main\Type\DateTime::createFromUserTime($date);
                         } catch (Main\ObjectException $e) {
                         }
                     }
                     unset($date);
                 }
                 if (isset($request['filter']['order_date_to']) && is_string($request['filter']['order_date_to'])) {
                     $date = trim($request['filter']['order_date_to']);
                     if ($date != '') {
                         try {
                             $filter['<=DATE_INSERT'] = Main\Type\DateTime::createFromUserTime($date);
                         } catch (Main\ObjectException $e) {
                         }
                     }
                     unset($date);
                 }
                 CTimeZone::Enable();
                 break;
         }
     }
     return $filter;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:41,代码来源:step_operations.php

示例5: update

 public static function update($primary, array $data)
 {
     $entityName = static::getEntity()->getName();
     $hlblock = HighloadBlockTable::getList(array('select' => array('ID'), 'filter' => array('=NAME' => $entityName)))->fetch();
     // add other fields
     $fields = $GLOBALS['USER_FIELD_MANAGER']->getUserFields('HLBLOCK_' . $hlblock['ID']);
     foreach ($data as $k => $v) {
         $arUserField = $fields[$k];
         if (is_callable(array($arUserField["USER_TYPE"]["CLASS_NAME"], "onbeforesave"))) {
             if ($arUserField["USER_TYPE"]['BASE_TYPE'] == 'file' && !empty($v['old_id']) && $v['error'] === 4) {
                 // no files changed. dear uf manager, please keep current file
                 $arUserField['VALUE'] = $v;
             }
             $data[$k] = call_user_func_array(array($arUserField["USER_TYPE"]["CLASS_NAME"], "onbeforesave"), array($arUserField, $data[$k]));
         }
         if (strlen($data[$k]) <= 0) {
             $data[$k] = false;
         } else {
             // convert string datetime to DateTime object
             if ($arUserField['USER_TYPE_ID'] == 'datetime') {
                 try {
                     $data[$k] = Type\DateTime::createFromUserTime($v);
                 } catch (Main\ObjectException $e) {
                     $data[$k] = '';
                 }
             }
         }
     }
     return parent::update($primary, $data);
 }
开发者ID:spas-viktor,项目名称:books,代码行数:30,代码来源:highloadblock.php

示例6: onBeforeSave

 /**
  * Returns  time object in server timezone
  *
  * @param $userfield
  * @param $value
  *
  * @return Type\DateTime|string
  */
 public static function onBeforeSave($userfield, $value)
 {
     if (strlen($value) && !$value instanceof Type\DateTime) {
         $value = Type\DateTime::createFromUserTime($value);
     }
     return $value;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:15,代码来源:usertypetime.php


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