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


PHP Location\LocationTable类代码示例

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


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

示例1: getRegionsList

 /**
  * getRegionsList
  * @return array regions (locations) list
  */
 public static function getRegionsList($countryId = 0, $bFlip = false)
 {
     static $arRegions = array();
     $flipIndex = intval($bFlip);
     if (isset($arRegions[$countryId][$flipIndex])) {
         return $arRegions[$countryId][$flipIndex];
     }
     if (CSaleLocation::isLocationProMigrated()) {
         $types = array();
         $res = \Bitrix\Sale\Location\TypeTable::getList(array('select' => array('ID', 'CODE')));
         while ($item = $res->fetch()) {
             $types[$item['CODE']] = $item['ID'];
         }
         $filter = array(array('LOGIC' => 'OR', array('=TYPE_ID' => $types['CITY'], '=NAME.LANGUAGE_ID' => LANGUAGE_ID, array('LOGIC' => 'OR', array('=PARENT.TYPE_ID' => $types['COUNTRY']), array('=PARENT.TYPE_ID' => $types['COUNTRY_DISTRICT']), array('=PARENT_ID' => '0'))), array('=TYPE_ID' => $types['REGION'])));
         if (intval($countryId)) {
             $filter['=PARENTS.TYPE_ID'] = $types['COUNTRY'];
             $filter['=PARENTS.ID'] = $countryId;
         }
         $dbRegionList = \Bitrix\Sale\Location\LocationTable::getList(array('filter' => $filter, 'select' => array('ID', 'CODE', 'NAME_LANG' => 'NAME.NAME'), 'order' => array('NAME.NAME' => 'asc')));
     } else {
         $arFilterRegion = array();
         if (intval($countryId) > 0) {
             $arFilterRegion["COUNTRY_ID"] = $countryId;
         }
         $dbRegionList = CSaleLocation::GetRegionList(array("NAME_LANG" => "ASC"), $arFilterRegion, LANGUAGE_ID);
     }
     $key = 'ID';
     while ($arRegionList = $dbRegionList->Fetch()) {
         if ($key == 'ID' && isset($arRegionList['CODE'])) {
             $key = 'CODE';
         }
         if ($key == 'CODE' && strlen($arRegionList['CODE']) <= 0) {
             continue;
         }
         $arRegions[$countryId][0][$arRegionList[$key]] = $arRegionList["NAME_LANG"];
         // $bFlip == false
         $arRegions[$countryId][1][$arRegionList["NAME_LANG"]] = $arRegionList[$key];
         // $bFlip == true
     }
     return isset($arRegions[$countryId][$flipIndex]) ? $arRegions[$countryId][$flipIndex] : array();
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:45,代码来源:delivery_helper.php

示例2: initializeData

 public static function initializeData()
 {
     $locationTable = Location\LocationTable::getTableName();
     $groupLocationTable = Location\GroupLocationTable::getTableName();
     $siteLocationTable = Location\SiteLocationTable::getTableName();
     // ORACLE: OK, MSSQL: OK
     $sql = "\n\t\t\tinsert into " . static::getTableName() . " \n\t\t\t\t(LOCATION_ID, SITE_ID) \n\t\t\tselect LC.ID, LS.SITE_ID\n\t\t\t\tfrom " . $siteLocationTable . " LS\n\t\t\t\t\tinner join " . $locationTable . " L on LS.LOCATION_ID = L.ID and LS.LOCATION_TYPE = 'L'\n\t\t\t\t\tinner join " . $locationTable . " LC on LC.LEFT_MARGIN >= L.LEFT_MARGIN and LC.RIGHT_MARGIN <= L.RIGHT_MARGIN\n\t\t\tunion \n\t\t\tselect LC.ID, LS.SITE_ID\n\t\t\t\tfrom " . $siteLocationTable . " LS\n\t\t\t\t\tinner join " . $groupLocationTable . " LG on LS.LOCATION_ID = LG.LOCATION_GROUP_ID and LS.LOCATION_TYPE = 'G'\n\t\t\t\t\tinner join " . $locationTable . " L on LG.LOCATION_ID = L.ID\n\t\t\t\t\tinner join " . $locationTable . " LC on LC.LEFT_MARGIN >= L.LEFT_MARGIN and LC.RIGHT_MARGIN <= L.RIGHT_MARGIN\n\t\t";
     Main\HttpApplication::getConnection()->query($sql);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:9,代码来源:sitelink.php

示例3: getUpperCityId

 protected static function getUpperCityId($locationId)
 {
     if (strlen($locationId) <= 0) {
         return 0;
     }
     $res = LocationTable::getList(array('filter' => array(array('LOGIC' => 'OR', '=CODE' => $locationId, '=ID' => $locationId), '=PARENTS.TYPE.CODE' => 'CITY'), 'select' => array('ID', 'CODE', 'PID' => 'PARENTS.ID')));
     if ($loc = $res->fetch()) {
         return $loc['PID'];
     }
     return 0;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:11,代码来源:adapter.php

示例4: isLocationsCreated

 public static function isLocationsCreated()
 {
     if (CSaleLocation::isLocationProMigrated()) {
         $res = Location\LocationTable::getList(array('select' => array('CNT')))->fetch();
         return $res['CNT'] > 0;
     }
     $dbResultList = CSaleLocation::GetList();
     if ($dbResultList->Fetch()) {
         return true;
     }
     return false;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:12,代码来源:crm_locations.php

示例5: 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

示例6: 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

示例7: calculatePackPrice

 private static function calculatePackPrice($arPackage, $profile, $arConfig, $arLocationTo)
 {
     $arDebug = array();
     /*1 Land price
     		1.1 Base Price less 10 kg*/
     $code = self::getRegionCodeByOldName($arLocationTo['REGION_NAME_LANG']);
     // old location
     if (strlen($code) <= 0 && CSaleLocation::isLocationProMigrated()) {
         $dbRes = Location\LocationTable::getList(array('filter' => array('=TYPE.CODE' => 'REGION', '=REGION_ID' => intval($arLocationTo["REGION_ID"]), '=CITY_ID' => false), 'select' => array('ID', 'CODE', 'NAME')));
         if ($locReg = $dbRes->fetch()) {
             $code = $locReg["CODE"];
         }
     }
     if (strlen($code) <= 0) {
         throw new \Bitrix\Main\SystemException(GetMessage("SALE_DH_RP_ERROR_LOCATION_NOT_FOUND"));
     }
     $zoneTo = self::getConfValue($arConfig, 'REG_' . $code);
     $basePrice = floatval(self::getConfValue($arConfig, 'ZONE_RATE_MAIN_' . $zoneTo));
     $arDebug[] = 'Base Price less 500 g: ' . $basePrice;
     if ($arPackage['WEIGHT'] > self::$BASE_WEIGHT) {
         $addWeight = ceil($arPackage['WEIGHT'] / self::$BASE_WEIGHT - 1);
         $addPrice = floatval(self::getConfValue($arConfig, 'ZONE_RATE_ADD_' . $zoneTo));
         $arDebug[] = 'Price for additional weight more than 500 g: ' . $addWeight * $addPrice;
         $basePrice += $addWeight * $addPrice;
     }
     $totalPrice = $basePrice;
     /* 1.2 Service "heavy weight" 10 - 20 kg*/
     $hwPrice = 0;
     if ($arPackage['WEIGHT'] >= self::$MAX_WEIGHT) {
         $hwTarif = floatval(self::getConfValue($arConfig, 'service_' . self::$TARIF_HEAVY_WEIGHT . '_value'));
         $hwPrice += $totalPrice * $hwTarif / 100;
         $arDebug[] = 'Heavy weight: ' . $hwPrice;
         $totalPrice += $hwPrice;
     }
     /* 1.5 Service "fragile" */
     $fPrice = 0;
     if (self::isConfCheckedVal($arConfig, 'service_' . self::$TARIF_FRAGILE . '_enabled')) {
         $fTarif = floatval(self::getConfValue($arConfig, 'service_' . self::$TARIF_FRAGILE . '_value'));
         $fPrice += $totalPrice * $fTarif / 100;
         $arDebug[] = 'Fragile: ' . $fPrice;
         $totalPrice += $fPrice;
     }
     /* 4. Service "declared value" */
     $dvPrice = 0;
     if (self::isConfCheckedVal($arConfig, 'service_' . self::$TARIF_DECLARED_VAL . '_enabled')) {
         $dvTarif = floatval(self::getConfValue($arConfig, 'service_' . self::$TARIF_DECLARED_VAL . '_value'));
         $dvPrice += ($arPackage['PRICE'] + $totalPrice) * $dvTarif;
         $arDebug[] = 'Declared value: ' . $dvPrice;
         $totalPrice += $dvPrice;
     }
     if ($profile == 'avia') {
         $aviaPrice = 0;
         $aviaPrice = floatval(self::getConfValue($arConfig, 'tarif_avia_' . self::$TARIF_AVIA_STANDART . '_value'));
         $arDebug[] = 'avia price: ' . $aviaPrice;
         $totalPrice += $aviaPrice;
         $aviaHeavyPrice = 0;
         if ($arPackage['WEIGHT'] > self::$MAX_WEIGHT) {
             $aviaHeavyPrice = floatval(self::getConfValue($arConfig, 'tarif_avia_' . self::$TARIF_AVIA_HEAVY . '_value'));
             $arDebug[] = 'avia heavy price: ' . $aviaHeavyPrice;
             $totalPrice += $aviaHeavyPrice;
         }
     }
     return $totalPrice;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:64,代码来源:delivery_rus_post.php

示例8: DeleteAll

	function DeleteAll()
	{
		global $DB;

		foreach (GetModuleEvents("sale", "OnBeforeLocationDeleteAll", true) as $arEvent)
			if (ExecuteModuleEventEx($arEvent)===false)
				return false;

		if(self::isLocationProMigrated())
		{
			//main
			$DB->Query("DELETE FROM ".Location\LocationTable::getTableName());
			$DB->Query("DELETE FROM ".Location\GroupTable::getTableName());
			$DB->Query("DELETE FROM ".Location\TypeTable::getTableName());

			//names
			$DB->Query("DELETE FROM ".Location\Name\LocationTable::getTableName());
			$DB->Query("DELETE FROM ".Location\Name\GroupTable::getTableName());
			$DB->Query("DELETE FROM ".Location\Name\TypeTable::getTableName());

			//links
			$DB->Query("DELETE FROM ".Location\GroupLocationTable::getTableName());
			$DB->Query("DELETE FROM ".Location\SiteLocationTable::getTableName());
			$DB->Query("DELETE FROM ".Delivery\DeliveryLocationTable::getTableName());
			
			//other
			$DB->Query("DELETE FROM ".Location\DefaultSiteTable::getTableName());
			$DB->Query("DELETE FROM ".Location\ExternalTable::getTableName());
			$DB->Query("DELETE FROM ".Location\ExternalServiceTable::getTableName());
		}

		$DB->Query("DELETE FROM b_sale_location2location_group");
		$DB->Query("DELETE FROM b_sale_location_group_lang");
		$DB->Query("DELETE FROM b_sale_location_group");

		$DB->Query("DELETE FROM b_sale_delivery2location");
		$DB->Query("DELETE FROM b_sale_location");

		$DB->Query("DELETE FROM b_sale_location_city_lang");
		$DB->Query("DELETE FROM b_sale_location_city");

		$DB->Query("DELETE FROM b_sale_location_country_lang");
		$DB->Query("DELETE FROM b_sale_location_country");

		$DB->Query("DELETE FROM b_sale_location_region_lang");
		$DB->Query("DELETE FROM b_sale_location_region");

		$DB->Query("DELETE FROM b_sale_location_zip");

		foreach (GetModuleEvents("sale", "OnLocationDeleteAll", true) as $arEvent)
			ExecuteModuleEventEx($arEvent);

	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:53,代码来源:location.php

示例9: reInitData

 public static function reInitData($parameters = array())
 {
     static::createTables();
     $offset = 0;
     $stat = array();
     $types = array();
     $typeSort = array();
     $res = Location\TypeTable::getList(array('select' => array('ID', 'CODE', 'SORT')));
     $allowedTypes = array('REGION', 'SUBREGION', 'CITY', 'VILLAGE', 'STREET');
     while ($item = $res->fetch()) {
         if (in_array($item['CODE'], $allowedTypes)) {
             $types[$item['CODE']] = $item['ID'];
         }
         $typeSort[$item['ID']] = $item['SORT'];
     }
     $typesBack = array_flip($types);
     //print_r($types);
     //_print_r($typeSort);
     $wordChain = array();
     $pathChain = array();
     //_dump_r('GO!');
     $prevDepth = 0;
     while (true) {
         $res = Location\LocationTable::getList(array('select' => array('ID', 'TYPE_ID', 'LNAME' => 'NAME.NAME', 'DEPTH_LEVEL', 'SORT'), 'filter' => array('=TYPE_ID' => array_values($types), '=NAME.LANGUAGE_ID' => LANGUAGE_ID), 'order' => array('LEFT_MARGIN' => 'asc'), 'limit' => self::STEP_SIZE, 'offset' => $offset));
         $cnt = 0;
         while ($item = $res->fetch()) {
             if ($item['DEPTH_LEVEL'] < $prevDepth) {
                 //print('DROP to '.$item['DEPTH_LEVEL'].'<br />');
                 // drop chain to DEPTH_LEVEL inclusively
                 $newWC = array();
                 $newPC = array();
                 foreach ($wordChain as $dl => $name) {
                     if ($dl >= $item['DEPTH_LEVEL']) {
                         break;
                     }
                     $newWC[$dl] = $name;
                 }
                 $wordChain = $newWC;
                 foreach ($pathChain as $dl => $id) {
                     if ($dl >= $item['DEPTH_LEVEL']) {
                         break;
                     }
                     $newPC[$dl] = $id;
                 }
                 $pathChain = $newPC;
             }
             $wordChain[$item['DEPTH_LEVEL']] = $item['LNAME'];
             $pathChain[$item['DEPTH_LEVEL']] = array('TYPE' => $item['TYPE_ID'], 'ID' => $item['ID']);
             $prevDepth = $item['DEPTH_LEVEL'];
             //print($item['DEPTH_LEVEL'].' - '.implode(' ', WordStatTable::parseQuery(implode(' ', $wordChain))).'<br />');
             $parsed = WordStatTable::parseQuery(implode(' ', $wordChain));
             $wordMap = array();
             $i = 1;
             foreach ($parsed as $word) {
                 $wordMap['W_' . $i] = $word;
                 $i++;
             }
             $pathMap = array();
             foreach ($pathChain as $elem) {
                 $pathMap[$typesBack[$elem['TYPE']] . '_ID'] = $elem['ID'];
             }
             $data = array_merge($wordMap, $pathMap, array('LOCATION_ID' => $item['ID'], 'TYPE_ID' => $item['TYPE_ID'], 'TYPE_SORT' => $typeSort[$item['TYPE_ID']], 'SORT' => $item['SORT'], 'WORD_COUNT' => count($wordMap)));
             //print('<pre>');
             //print('</pre>');
             try {
                 static::add($data);
             } catch (\Exception $e) {
                 _dump_r('Cant add ' . implode(' ', $wordChain) . ' (' . count($wordMap) . ')<br />');
                 // duplicate or smth
             }
             $cnt++;
         }
         if (!$cnt) {
             break;
         }
         $offset += self::STEP_SIZE;
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:78,代码来源:wordchain.php

示例10: stageConvertTree

	protected function stageConvertTree()
	{
		if($this->getStep() == 0)
		{
			$this->migrator->convertTree();
			$this->nextStep();
		}
		else
		{
			Location\LocationTable::resetLegacyPath();
			$this->nextStage();
		}
	}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:13,代码来源:migration.php

示例11: getLocationStringByCondition

 protected static function getLocationStringByCondition($condition, $behaviour = array('INVERSE' => false, 'DELIMITER' => ', ', 'LANGUAGE_ID' => LANGUAGE_ID))
 {
     if (isset($behaviour) && !is_array($behaviour)) {
         $behaviour = array();
     }
     if (!isset($behaviour['DELIMITER'])) {
         $behaviour['DELIMITER'] = ', ';
     }
     if (!isset($behaviour['LANGUAGE_ID'])) {
         $behaviour['LANGUAGE_ID'] = LANGUAGE_ID;
     }
     try {
         $res = Location\LocationTable::getPathToNodeByCondition($condition, array('select' => array('LNAME' => 'NAME.NAME'), 'filter' => array('=NAME.LANGUAGE_ID' => $behaviour['LANGUAGE_ID'])));
         $path = array();
         while ($item = $res->fetch()) {
             $path[] = $item['LNAME'];
         }
         if ($behaviour['INVERSE']) {
             $path = array_reverse($path);
         }
         return implode($behaviour['DELIMITER'], $path);
     } catch (\Bitrix\Main\SystemException $e) {
         return '';
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:25,代码来源:locationhelper.php

示例12: insertTreeInfo

 private function insertTreeInfo()
 {
     // We make temporal table, place margins, parent and lang data into it, then perform an update of the old table from the temporal one.
     $this->createTemporalTable(self::TABLE_TEMP_TREE, array('ID' => array('TYPE' => array(self::DB_TYPE_MYSQL => 'int', self::DB_TYPE_MSSQL => 'int', self::DB_TYPE_ORACLE => 'NUMBER(18)')), 'PARENT_ID' => array('TYPE' => array(self::DB_TYPE_MYSQL => 'int', self::DB_TYPE_MSSQL => 'int', self::DB_TYPE_ORACLE => 'NUMBER(18)')), 'TYPE_ID' => array('TYPE' => array(self::DB_TYPE_MYSQL => 'int', self::DB_TYPE_MSSQL => 'int', self::DB_TYPE_ORACLE => 'NUMBER(18)')), 'DEPTH_LEVEL' => array('TYPE' => array(self::DB_TYPE_MYSQL => 'int', self::DB_TYPE_MSSQL => 'int', self::DB_TYPE_ORACLE => 'NUMBER(18)')), 'LEFT_MARGIN' => array('TYPE' => array(self::DB_TYPE_MYSQL => 'int', self::DB_TYPE_MSSQL => 'int', self::DB_TYPE_ORACLE => 'NUMBER(18)')), 'RIGHT_MARGIN' => array('TYPE' => array(self::DB_TYPE_MYSQL => 'int', self::DB_TYPE_MSSQL => 'int', self::DB_TYPE_ORACLE => 'NUMBER(18)'))));
     $handle = new BlockInserter(array('tableName' => self::TABLE_TEMP_TREE, 'exactFields' => array('ID' => array('data_type' => 'integer'), 'PARENT_ID' => array('data_type' => 'integer'), 'TYPE_ID' => array('data_type' => 'integer'), 'DEPTH_LEVEL' => array('data_type' => 'integer'), 'LEFT_MARGIN' => array('data_type' => 'integer'), 'RIGHT_MARGIN' => array('data_type' => 'integer')), 'parameters' => array('mtu' => 9999)));
     // fill temporal table
     if (is_array($this->data['TREE'])) {
         foreach ($this->data['TREE'] as $id => $node) {
             $handle->insert(array('ID' => $id, 'PARENT_ID' => $node['PARENT_ID'], 'TYPE_ID' => $node['TYPE_ID'], 'DEPTH_LEVEL' => $node['DEPTH_LEVEL'], 'LEFT_MARGIN' => $node['LEFT_MARGIN'], 'RIGHT_MARGIN' => $node['RIGHT_MARGIN']));
         }
     }
     $handle->flush();
     // merge temp table with location table
     Location\LocationTable::mergeRelationsFromTemporalTable(self::TABLE_TEMP_TREE, array('TYPE_ID', 'PARENT_ID'));
     $this->dropTable(self::TABLE_TEMP_TREE);
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:16,代码来源:migrate.php

示例13: 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

示例14: RebindLocationTriplet

 protected static function RebindLocationTriplet($fields = array())
 {
     $country = intval($fields['COUNTRY_ID']);
     $region = intval($fields['REGION_ID']);
     $city = intval($fields['CITY_ID']);
     foreach (GetModuleEvents('sale', 'OnBeforeLocationAdd', true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($fields)) === false) {
             return false;
         }
     }
     if ($region && $country) {
         $uRes = \Bitrix\Sale\Location\LocationTable::update($region, array('PARENT_ID' => $country));
     }
     if ($city) {
         if ($region) {
             $uRes = \Bitrix\Sale\Location\LocationTable::update($city, array('PARENT_ID' => $region));
         } elseif ($country) {
             $uRes = \Bitrix\Sale\Location\LocationTable::update($city, array('PARENT_ID' => $country));
         }
     }
     if (intval($fields['SORT'])) {
         $loc2Update = $city ? $city : ($region ? $region : ($country ? $country : false));
         if ($loc2Update) {
             $uRes = \Bitrix\Sale\Location\LocationTable::update($loc2Update, array('SORT' => $fields['SORT']));
         }
     }
     foreach (GetModuleEvents('sale', 'OnLocationAdd', true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($loc2Update, $fields));
     }
     return $loc2Update;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:31,代码来源:location.php

示例15: convertOldToNew

 static function convertOldToNew(array $property)
 {
     if (isset($property['REQUIED']) && !empty($property['REQUIED'])) {
         $property['REQUIRED'] = $property['REQUIED'];
     }
     $size1 = intval($property['SIZE1']);
     $size2 = intval($property['SIZE2']);
     $settings = array();
     // TODO remove sale/include.php - $GLOBALS["SALE_FIELD_TYPES"]
     switch ($property['TYPE']) {
         case 'TEXT':
             $property['TYPE'] = 'STRING';
             if ($size1 > 0) {
                 $settings['SIZE'] = $size1;
             }
             break;
         case 'TEXTAREA':
             $property['TYPE'] = 'STRING';
             $settings['MULTILINE'] = 'Y';
             if ($size1 > 0) {
                 $settings['COLS'] = $size1;
             }
             if ($size2 > 0) {
                 $settings['ROWS'] = $size2;
             }
             break;
         case 'CHECKBOX':
             $property['TYPE'] = 'Y/N';
             break;
         case 'RADIO':
             $property['TYPE'] = 'ENUM';
             $settings['MULTIELEMENT'] = 'Y';
             break;
         case 'SELECT':
             $property['TYPE'] = 'ENUM';
             if ($size1 > 0) {
                 $settings['SIZE'] = $size1;
             }
             break;
         case 'MULTISELECT':
             $property['TYPE'] = 'ENUM';
             $property['MULTIPLE'] = 'Y';
             if ($size1 > 0) {
                 $settings['SIZE'] = $size1;
             }
             break;
         case 'LOCATION':
             // ID came, should store CODE
             if (intval($property['DEFAULT_VALUE'])) {
                 $res = \Bitrix\Sale\Location\LocationTable::getList(array('filter' => array('=ID' => intval($property['DEFAULT_VALUE'])), 'select' => array('CODE')))->fetch();
                 if (is_array($res) && (string) $res['CODE'] != '') {
                     $property['DEFAULT_VALUE'] = $res['CODE'];
                 }
             }
             if ($size1 > 0) {
                 $settings['SIZE'] = $size1;
             }
             break;
     }
     $property['SETTINGS'] = $settings;
     return $property;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:62,代码来源:order_props.php


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