• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Location\LocationTable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


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


示例17: checkConnectionExists

 public static function checkConnectionExists($entityPrimary, $locationPrimary)
 {
     $entityPrimary = Assert::expectStringNotNull($entityPrimary, Loc::getMessage('SALE_LOCATION_CONNECTOR_ENTITY_PRIMARY_FLD_NAME'));
     $locationPrimary = Assert::expectIntegerPositive($locationPrimary, Loc::getMessage('SALE_LOCATION_CONNECTOR_ENTITY_LOCATION_PRIMARY_FLD_NAME'));
     if (!static::checkLinkUsageAny($entityPrimary)) {
         // if there are no links at all, connection virtually exists
         return true;
     }
     // todo: here we can rewrite this to make it to do just one query
     $node = LocationTable::getById($locationPrimary)->fetch();
     $result = static::getLinkStatusForMultipleNodes(array($node), $entityPrimary);
     return $result[$locationPrimary] == self::LSTAT_IS_CONNECTOR || $result[$locationPrimary] == self::LSTAT_BELOW_CONNECTOR;
 }
开发者ID:akniyev,项目名称:arteva.ru,代码行数:13,代码来源:connector.php


示例18: findNoIndex

 /**
  *
  *
  * @param
  *
  * @return
  */
 protected static function findNoIndex($parameters)
 {
     $dbConnection = Main\HttpApplication::getConnection();
     $dbHelper = $dbConnection->getSqlHelper();
     // tables
     $locationTable = Location\LocationTable::getTableName();
     $locationNameTable = Location\Name\LocationTable::getTableName();
     $locationGroupTable = Location\GroupLocationTable::getTableName();
     $locationSiteTable = Location\SiteLocationTable::getTableName();
     $locationTypeTable = Location\TypeTable::getTableName();
     //////////////////////////////////
     // sql parameters prepare
     //////////////////////////////////
     $filter = static::parseFilter($parameters['filter']);
     if (strlen($filter['SITE_ID']['VALUE'])) {
         $filterSite = $dbHelper->forSql(substr($filter['SITE_ID']['VALUE'], 0, 2));
         $hasLocLinks = Location\SiteLocationTable::checkLinkUsage($filterSite, Location\SiteLocationTable::DB_LOCATION_FLAG);
         $hasGrpLinks = Location\SiteLocationTable::checkLinkUsage($filterSite, Location\SiteLocationTable::DB_GROUP_FLAG);
         $doFilterBySite = true;
     }
     if (strlen($filter['PHRASE']['VALUE'])) {
         $doFilterByName = true;
         $filterName = ToUpper($dbHelper->forSql($filter['PHRASE']['VALUE']));
     }
     if (intval($filter['ID']['VALUE'])) {
         $doFilterById = true;
         $filterId = intval($filter['ID']['VALUE']);
     }
     if (intval($filter['CODE']['VALUE'])) {
         $doFilterByCode = true;
         $filterCode = $dbHelper->forSql($filter['CODE']['VALUE']);
     }
     $doFilterByLang = true;
     if (strlen($filter['NAME.LANGUAGE_ID']['VALUE'])) {
         $filterLang = $dbHelper->forSql(substr($filter['NAME.LANGUAGE_ID']['VALUE'], 0, 2));
     } else {
         $filterLang = LANGUAGE_ID;
     }
     if (isset($filter['PARENT_ID']) && intval($filter['PARENT_ID']['VALUE']) >= 0) {
         $doFilterByParent = true;
         $filterParentId = intval($filter['PARENT_ID']['VALUE']);
     }
     if (intval($filter['TYPE_ID']['VALUE'])) {
         $doFilterByType = true;
         $filterTypeId = intval($filter['TYPE_ID']['VALUE']);
     }
     // filter select fields
     if (!is_array($parameters['select'])) {
         $parameters['select'] = array();
     }
     $map = Location\LocationTable::getMap();
     $nameAlias = false;
     foreach ($parameters['select'] as $alias => $field) {
         if ($field == 'CHILD_CNT') {
             $doCountChildren = true;
         }
         if ($field == 'NAME.NAME') {
             $nameAlias = $alias;
         }
         if (!isset($map[$field]) || !in_array($map[$field]['data_type'], array('integer', 'string', 'float', 'boolean')) || isset($map[$field]['expression'])) {
             unset($parameters['select'][$alias]);
         }
     }
     //////////////////////////////////
     // sql query build
     //////////////////////////////////
     // mandatory fields to be selected anyway
     // alias => field
     $fields = array('L.ID' => 'L.ID', 'L.CODE' => 'L.CODE', 'L.SORT' => 'L.SORT', 'LT_SORT' => 'LT.DISPLAY_SORT');
     if ($nameAlias === false || !preg_match('#^[a-zA-Z0-9]+$#', $nameAlias)) {
         $fields['NAME'] = 'LN.NAME';
     } else {
         $fields[$nameAlias] = 'LN.NAME';
     }
     $fields = array_merge($fields, array('L.LEFT_MARGIN' => 'L.LEFT_MARGIN', 'L.RIGHT_MARGIN' => 'L.RIGHT_MARGIN'));
     $groupFields = $fields;
     // additional fields to select
     foreach ($parameters['select'] as $alias => $fld) {
         $lFld = 'L.' . $fld;
         // check if field is already selected
         if ((string) $alias === (string) intval($alias)) {
             // already selected
             if (in_array($lFld, $fields)) {
                 continue;
             }
             $fields[$lFld] = $lFld;
             //$groupFields[$lFld] = $lFld;
         } else {
             if (isset($fields[$alias])) {
                 continue;
             }
             $fields[$alias] = $lFld;
             //$groupFields[$alias] = $lFld;
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:finder.php


示例19: foreach

foreach ($fields as $field) {
    $select[] = $field['FIELD_NAME'];
}
$params = array('select' => $select, 'filter' => $filter, 'order' => array($by => $order));
$company = CompanyTable::getList($params);
$dbResultList = new CAdminResult($company, $sTableID);
$dbResultList->NavStart();
$lAdmin->NavText($dbResultList->GetNavPrint(Loc::getMessage("SALE_COMPANY")));
$headers = array(array("id" => "ID", "content" => "ID", "sort" => "ID", "default" => true), array("id" => "ACTIVE", "content" => Loc::getMessage("SALE_COMPANY_ACTIVE"), "sort" => "ACTIVE", "default" => true), array("id" => "NAME", "content" => Loc::getMessage("SALE_COMPANY_NAME"), "sort" => "NAME", "default" => true), array("id" => "LOCATION_ID", "content" => Loc::getMessage("SALE_COMPANY_LOCATION_ID"), "sort" => "LOCATION_ID", " 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Bitcoin\Bitcoin类代码示例发布时间:2022-05-23
下一篇:
PHP Sale\Order类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap