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


PHP LocationTable::getPathToNode方法代码示例

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


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

示例1: reInitData

 public static function reInitData()
 {
     static::cleanUp();
     $offset = 0;
     $stat = array();
     $types = array();
     $typeSort = array();
     $res = Location\TypeTable::getList(array('select' => array('ID', 'CODE', 'SORT')));
     while ($item = $res->fetch()) {
         if ($item['CODE'] == 'CITY' || $item['CODE'] == 'VILLAGE' || $item['CODE'] == 'STREET') {
             $types[$item['CODE']] = $item['ID'];
         }
         $typeSort[$item['ID']] = $item['SORT'];
     }
     $typesBack = array_flip($types);
     //_print_r($types);
     //_print_r($typeSort);
     while (true) {
         $res = Location\LocationTable::getList(array('select' => array('ID', 'TYPE_ID'), 'filter' => array('=TYPE_ID' => array_values($types)), 'limit' => self::STEP_SIZE, 'offset' => $offset));
         $cnt = 0;
         while ($item = $res->fetch()) {
             $resPath = Location\LocationTable::getPathToNode($item['ID'], array('select' => array('ID', 'TYPE_ID'), 'filter' => array('=TYPE_ID' => array_values($types))));
             $path = array();
             while ($pItem = $resPath->fetch()) {
                 $path[$typesBack[$pItem['TYPE_ID']]] = $pItem['ID'];
             }
             //_print_r($path);
             $data = array('CITY_ID' => isset($path['CITY']) ? $path['CITY'] : 0, 'VILLAGE_ID' => isset($path['VILLAGE']) ? $path['VILLAGE'] : 0, 'STREET_ID' => isset($path['STREET']) ? $path['STREET'] : 0, 'TYPE_SORT' => $typeSort[$item['TYPE_ID']], 'LOCATION_ID' => $item['ID']);
             //_print_r($data);
             foreach ($data as &$value) {
                 $value = "'" . $value . "'";
             }
             //static::add($data);
             $GLOBALS['DB']->query("insert into " . static::getTableName() . " (CITY_ID, VILLAGE_ID, STREET_ID, TYPE_SORT, LOCATION_ID) values (" . implode(', ', $data) . ")");
             $cnt++;
         }
         if (!$cnt) {
             break;
         }
         $offset += self::STEP_SIZE;
     }
 }
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:42,代码来源:chain.php

示例2: processSearchGetAdditional

	protected static function processSearchGetAdditional($result)
	{
		$result = parent::processSearchGetAdditional($result);

		// get common path of parent
		if(isset($_REQUEST['FILTER']['PARENT_ID']))
		{
			$path = array();
			$result['ETC']['PATH_NAMES'] = array();

			if($pId = intval($_REQUEST['FILTER']['PARENT_ID']))
			{
				$res = Location\LocationTable::getPathToNode($pId, array(
					'select' => array(
						'ID',
						'CODE',
						'TYPE_ID',
						'LNAME' => 'NAME.NAME'
					),
					'filter' => array(
						'NAME.LANGUAGE_ID' => static::processSearchRequestGetLang()
					)
				));
				$res->addReplacedAliases(array('LNAME' => 'NAME'));

				$node = array();
				while($item = $res->fetch())
				{
					$path[] = intval($item['ID']);
					$result['ETC']['PATH_NAMES'][$item['ID']] = $item['NAME'];

					$node = $item;
				}

				$node['PATH'] = array_reverse($path);
				$result['ETC']['PARENT_ITEM'] = $node;
			}
		}

		return $result;
	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:41,代码来源:class.php

示例3: processSearchRequestV2GetAdditional

 protected static function processSearchRequestV2GetAdditional(&$data, $parameters)
 {
     if (!empty($data['ITEMS']) && is_array($parameters['additionals'])) {
         if (in_array('PATH', $parameters['additionals'])) {
             // show path to each found node
             static::processSearchRequestV2GetAdditionalPathNodes($data, $parameters);
         }
         // show common count of items by current filter
         if (in_array('CNT_BY_FILTER', $parameters['additionals']) && is_array($parameters['filter'])) {
             $item = Location\LocationTable::getList(array('select' => array('CNT'), 'filter' => $parameters['filter']))->fetch();
             $data['ETC']['CNT_BY_FILTER'] = $item['CNT'];
         }
         // show parent item in case of PARENT_ID condition in filter
         if (in_array('PARENT_ITEM', $parameters['additionals'])) {
             $id = false;
             if (intval($parameters['filter']['=PARENT_ID'])) {
                 $id = intval($parameters['filter']['=PARENT_ID']);
             } elseif (intval($parameters['filter']['PARENT_ID'])) {
                 $id = intval($parameters['filter']['PARENT_ID']);
             }
             if ($id !== false) {
                 $path = array();
                 $data['ETC']['PATH_ITEMS'] = array();
                 $res = Location\LocationTable::getPathToNode($id, array('select' => array('VALUE' => 'ID', 'CODE', 'TYPE_ID', 'DISPLAY' => 'NAME.NAME'), 'filter' => array('=NAME.LANGUAGE_ID' => strlen($parameters['filter']['=NAME.LANGUAGE_ID']) ? $parameters['filter']['=NAME.LANGUAGE_ID'] : LANGUAGE_ID)));
                 $node = array();
                 while ($item = $res->fetch()) {
                     $path[] = intval($item['VALUE']);
                     $data['ETC']['PATH_ITEMS'][$item['VALUE']] = $item;
                     $node = $item;
                 }
                 $node['PATH'] = array_reverse($path);
                 $data['ETC']['PARENT_ITEM'] = $node;
             }
         }
     }
     return $data;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:37,代码来源:class.php

示例4: GetRealValue

 function GetRealValue($propertyID, $propertyCode, $propertyType, $value, $lang = false)
 {
     $propertyID = IntVal($propertyID);
     $propertyCode = Trim($propertyCode);
     $propertyType = Trim($propertyType);
     if ($lang === false) {
         $lang = LANGUAGE_ID;
     }
     $arResult = array();
     $curKey = strlen($propertyCode) > 0 ? $propertyCode : $propertyID;
     if ($propertyType == "SELECT" || $propertyType == "RADIO") {
         $arValue = CSaleOrderPropsVariant::GetByValue($propertyID, $value);
         $arResult[$curKey] = $arValue["NAME"];
     } elseif ($propertyType == "MULTISELECT") {
         $curValue = "";
         if (!is_array($value)) {
             $value = explode(",", $value);
         }
         for ($i = 0, $max = count($value); $i < $max; $i++) {
             if ($arValue1 = CSaleOrderPropsVariant::GetByValue($propertyID, $value[$i])) {
                 if ($i > 0) {
                     $curValue .= ",";
                 }
                 $curValue .= $arValue1["NAME"];
             }
         }
         $arResult[$curKey] = $curValue;
     } elseif ($propertyType == "LOCATION") {
         if (CSaleLocation::isLocationProMigrated()) {
             $curValue = '';
             if (strlen($value)) {
                 $arValue = array();
                 if (intval($value)) {
                     try {
                         $locationStreetPropertyValue = '';
                         $res = \Bitrix\Sale\Location\LocationTable::getPathToNode($value, array('select' => array('LNAME' => 'NAME.NAME', 'TYPE_ID'), 'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID)));
                         $types = \Bitrix\Sale\Location\Admin\TypeHelper::getTypeCodeIdMapCached();
                         $path = array();
                         while ($item = $res->fetch()) {
                             // copy street to STREET property
                             if ($types['ID2CODE'][$item['TYPE_ID']] == 'STREET') {
                                 $arResult[$curKey . "_STREET"] = $item['LNAME'];
                             }
                             if ($types['ID2CODE'][$item['TYPE_ID']] == 'COUNTRY') {
                                 $arValue["COUNTRY_NAME"] = $item['LNAME'];
                             }
                             if ($types['ID2CODE'][$item['TYPE_ID']] == 'REGION') {
                                 $arValue["REGION_NAME"] = $item['LNAME'];
                             }
                             if ($types['ID2CODE'][$item['TYPE_ID']] == 'CITY') {
                                 $arValue["CITY_NAME"] = $item['LNAME'];
                             }
                             if ($types['ID2CODE'][$item['TYPE_ID']] == 'VILLAGE') {
                                 $arResult[$curKey . "_VILLAGE"] = $item['LNAME'];
                             }
                             $path[] = $item['LNAME'];
                         }
                         $curValue = implode(' - ', $path);
                     } catch (\Bitrix\Main\SystemException $e) {
                     }
                 }
             }
         } else {
             $arValue = CSaleLocation::GetByID($value, $lang);
             $curValue = $arValue["COUNTRY_NAME"] . (strlen($arValue["COUNTRY_NAME"]) <= 0 || strlen($arValue["REGION_NAME"]) <= 0 ? "" : " - ") . $arValue["REGION_NAME"] . (strlen($arValue["COUNTRY_NAME"]) <= 0 || strlen($arValue["CITY_NAME"]) <= 0 ? "" : " - ") . $arValue["CITY_NAME"];
         }
         $arResult[$curKey] = $curValue;
         $arResult[$curKey . "_COUNTRY"] = $arValue["COUNTRY_NAME"];
         $arResult[$curKey . "_REGION"] = $arValue["REGION_NAME"];
         $arResult[$curKey . "_CITY"] = $arValue["CITY_NAME"];
     } else {
         $arResult[$curKey] = $value;
     }
     return $arResult;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:75,代码来源:order_props.php

示例5: ExportOrders2Xml


//.........这里部分代码省略.........
            }
            if (IntVal($arOrder["PAY_SYSTEM_ID"]) > 0) {
                $arProp["ORDER"]["PAY_SYSTEM_NAME"] = $paySystems[$arOrder["PAY_SYSTEM_ID"]];
            }
            if (strlen($arOrder["DELIVERY_ID"]) > 0) {
                $arProp["ORDER"]["DELIVERY_NAME"] = $delivery[$arOrder["DELIVERY_ID"]];
            }
            $dbOrderPropVals = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $arOrder["ID"]), false, false, array("ID", "CODE", "VALUE", "ORDER_PROPS_ID", "PROP_TYPE"));
            $locationStreetPropertyValue = '';
            while ($arOrderPropVals = $dbOrderPropVals->Fetch()) {
                if ($arOrderPropVals["PROP_TYPE"] == "CHECKBOX") {
                    if ($arOrderPropVals["VALUE"] == "Y") {
                        $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = "true";
                    } else {
                        $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = "false";
                    }
                } elseif ($arOrderPropVals["PROP_TYPE"] == "TEXT" || $arOrderPropVals["PROP_TYPE"] == "TEXTAREA") {
                    $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arOrderPropVals["VALUE"];
                } elseif ($arOrderPropVals["PROP_TYPE"] == "SELECT" || $arOrderPropVals["PROP_TYPE"] == "RADIO") {
                    $arVal = CSaleOrderPropsVariant::GetByValue($arOrderPropVals["ORDER_PROPS_ID"], $arOrderPropVals["VALUE"]);
                    $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arVal["NAME"];
                } elseif ($arOrderPropVals["PROP_TYPE"] == "MULTISELECT") {
                    $curVal = explode(",", $arOrderPropVals["VALUE"]);
                    foreach ($curVal as $vm) {
                        $arVal = CSaleOrderPropsVariant::GetByValue($arOrderPropVals["ORDER_PROPS_ID"], $vm);
                        $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] .= ", " . $arVal["NAME"];
                    }
                    $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = substr($arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]], 2);
                } elseif ($arOrderPropVals["PROP_TYPE"] == "LOCATION") {
                    $arVal = CSaleLocation::GetByID($arOrderPropVals["VALUE"], LANGUAGE_ID);
                    if (CSaleLocation::isLocationProEnabled()) {
                        if (intval($arVal['ID'])) {
                            try {
                                $res = \Bitrix\Sale\Location\LocationTable::getPathToNode($arVal['ID'], array('select' => array('LNAME' => 'NAME.NAME', 'TYPE_ID'), 'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID)));
                                $types = \Bitrix\Sale\Location\Admin\TypeHelper::getTypeCodeIdMapCached();
                                $path = array();
                                while ($item = $res->fetch()) {
                                    // copy street to STREET property
                                    if ($types['ID2CODE'][$item['TYPE_ID']] == 'STREET') {
                                        $locationStreetPropertyValue = $item['LNAME'];
                                    }
                                    $path[] = $item['LNAME'];
                                }
                                $locationString = implode(' - ', $path);
                            } catch (\Bitrix\Main\SystemException $e) {
                                $locationString = '';
                            }
                        } else {
                            $locationString = '';
                        }
                    } else {
                        $locationString = $arVal["COUNTRY_NAME"] . (strlen($arVal["COUNTRY_NAME"]) <= 0 || strlen($arVal["REGION_NAME"]) <= 0 ? "" : " - ") . $arVal["REGION_NAME"] . (strlen($arVal["COUNTRY_NAME"]) <= 0 || strlen($arVal["CITY_NAME"]) <= 0 ? "" : " - ") . $arVal["CITY_NAME"];
                    }
                    $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $locationString;
                    $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"] . "_CITY"] = $arVal["CITY_NAME"];
                    $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"] . "_COUNTRY"] = $arVal["COUNTRY_NAME"];
                    $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"] . "_REGION"] = $arVal["REGION_NAME"];
                } else {
                    $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arOrderPropVals["VALUE"];
                }
            }
            $resShipment = \Bitrix\Sale\Internals\ShipmentTable::getList(array('select' => array('DELIVERY_ID', 'ALLOW_DELIVERY', 'DEDUCTED', 'DATE_ALLOW_DELIVERY', 'DATE_DEDUCTED'), 'filter' => array('ORDER_ID' => $arOrder['ID'], '=SYSTEM' => 'N'), 'limit' => array(1)));
            $arShipment = $resShipment->fetch();
            $resPayment = \Bitrix\Sale\Internals\PaymentTable::getList(array('select' => array('PAY_VOUCHER_NUM', 'PAY_SYSTEM_ID', 'PAY_VOUCHER_DATE'), 'filter' => array('ORDER_ID' => $arOrder['ID'], '!PAY_SYSTEM_ID' => \Bitrix\Sale\Internals\PaySystemInner::getId()), 'limit' => array(1)));
            $arPayment = $resPayment->fetch();
            foreach ($agentParams as $k => $v) {
开发者ID:Satariall,项目名称:izurit,代码行数:67,代码来源:export.php

示例6: getSaleProperties


//.........这里部分代码省略.........
     }
     if (IntVal($arOrder["PAY_SYSTEM_ID"]) > 0) {
         $arProp["ORDER"]["PAY_SYSTEM_NAME"] = $paySystems[$arOrder["PAY_SYSTEM_ID"]];
     }
     if (strlen($arOrder["DELIVERY_ID"]) > 0) {
         $arProp["ORDER"]["DELIVERY_NAME"] = $delivery[$arOrder["DELIVERY_ID"]];
     }
     $dbOrderPropVals = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $arOrder["ID"]), false, false, array("ID", "CODE", "VALUE", "ORDER_PROPS_ID", "PROP_TYPE"));
     $locationStreetPropertyValue = '';
     while ($arOrderPropVals = $dbOrderPropVals->Fetch()) {
         if ($arOrderPropVals["PROP_TYPE"] == "CHECKBOX") {
             if ($arOrderPropVals["VALUE"] == "Y") {
                 $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = "true";
             } else {
                 $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = "false";
             }
         } elseif ($arOrderPropVals["PROP_TYPE"] == "TEXT" || $arOrderPropVals["PROP_TYPE"] == "TEXTAREA") {
             $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arOrderPropVals["VALUE"];
         } elseif ($arOrderPropVals["PROP_TYPE"] == "SELECT" || $arOrderPropVals["PROP_TYPE"] == "RADIO") {
             $arVal = CSaleOrderPropsVariant::GetByValue($arOrderPropVals["ORDER_PROPS_ID"], $arOrderPropVals["VALUE"]);
             $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arVal["NAME"];
         } elseif ($arOrderPropVals["PROP_TYPE"] == "MULTISELECT") {
             $curVal = explode(",", $arOrderPropVals["VALUE"]);
             foreach ($curVal as $vm) {
                 $arVal = CSaleOrderPropsVariant::GetByValue($arOrderPropVals["ORDER_PROPS_ID"], $vm);
                 $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] .= ", " . $arVal["NAME"];
             }
             $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = substr($arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]], 2);
         } elseif ($arOrderPropVals["PROP_TYPE"] == "LOCATION") {
             $arVal = CSaleLocation::GetByID($arOrderPropVals["VALUE"], LANGUAGE_ID);
             if (CSaleLocation::isLocationProEnabled()) {
                 if (intval($arVal['ID'])) {
                     try {
                         $res = \Bitrix\Sale\Location\LocationTable::getPathToNode($arVal['ID'], array('select' => array('LNAME' => 'NAME.NAME', 'TYPE_ID'), 'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID)));
                         $types = \Bitrix\Sale\Location\Admin\TypeHelper::getTypeCodeIdMapCached();
                         $path = array();
                         while ($item = $res->fetch()) {
                             // copy street to STREET property
                             if ($types['ID2CODE'][$item['TYPE_ID']] == 'STREET') {
                                 $locationStreetPropertyValue = $item['LNAME'];
                             }
                             $path[] = $item['LNAME'];
                         }
                         $locationString = implode(' - ', $path);
                     } catch (\Bitrix\Main\SystemException $e) {
                         $locationString = '';
                     }
                 } else {
                     $locationString = '';
                 }
             } else {
                 $locationString = $arVal["COUNTRY_NAME"] . (strlen($arVal["COUNTRY_NAME"]) <= 0 || strlen($arVal["REGION_NAME"]) <= 0 ? "" : " - ") . $arVal["REGION_NAME"] . (strlen($arVal["COUNTRY_NAME"]) <= 0 || strlen($arVal["CITY_NAME"]) <= 0 ? "" : " - ") . $arVal["CITY_NAME"];
             }
             $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $locationString;
             $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"] . "_CITY"] = $arVal["CITY_NAME"];
             $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"] . "_COUNTRY"] = $arVal["COUNTRY_NAME"];
             $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"] . "_REGION"] = $arVal["REGION_NAME"];
         } else {
             $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arOrderPropVals["VALUE"];
         }
     }
     foreach ($agentParams as $k => $v) {
         if (strpos($k, "REKV_") !== false) {
             //params
             if (!is_array($v)) {
                 $agent["REKV"][$k] = $v;
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:67,代码来源:export.php

示例7: obtainDataLocation

	protected function obtainDataLocation()
	{
		$parameters = $this->getLocationListParameters();

		$this->dbResult['PATH'] = array();
		$this->dbResult['LOCATION'] = array();

		$toBeFound = false;
		$res = false;
		try
		{
			if($this->arParams['ID'])
			{
				$toBeFound = true;
				$res = Location\LocationTable::getPathToNode($this->arParams['ID'], $parameters);
			}
			elseif(strlen($this->arParams['CODE']))
			{
				$toBeFound = true;
				$res = Location\LocationTable::getPathToNodeByCode($this->arParams['CODE'], $parameters);
			}

			if($res)
			{
				$res->addReplacedAliases(array('LNAME' => 'NAME'));

				while($item = $res->Fetch())
					$this->dbResult['PATH'][intval($item['ID'])] = $this->forceToType($item);

				end($this->dbResult['PATH']);
				$this->dbResult['LOCATION'] = current($this->dbResult['PATH']);
			}
		}
		catch(Main\SystemException $e)
		{
		}

		if(empty($this->dbResult['PATH']) && $toBeFound)
			$this->errors['NONFATAL'][] = Loc::getMessage('SALE_SLS_SELECTED_NODE_NOT_FOUND');
	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:40,代码来源:class.php


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