本文整理汇总了PHP中Bitrix\Sale\Location\LocationTable::getPathToMultipleNodes方法的典型用法代码示例。如果您正苦于以下问题:PHP LocationTable::getPathToMultipleNodes方法的具体用法?PHP LocationTable::getPathToMultipleNodes怎么用?PHP LocationTable::getPathToMultipleNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Sale\Location\LocationTable
的用法示例。
在下文中一共展示了LocationTable::getPathToMultipleNodes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPathToNodes
protected static function getPathToNodes($list)
{
$res = Location\LocationTable::getPathToMultipleNodes(
$list,
array(
'select' => (
!!$_REQUEST['BEHAVIOUR']['PREFORMAT'] ?
array('ID', 'VALUE' => 'ID', 'DISPLAY' => 'NAME.NAME', 'CODE') :
array('ID', 'LNAME' => 'NAME.NAME', 'CODE')
),
'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID)
)
);
$pathItems = array();
$result = array();
while($path = $res->fetch())
{
// format path as required for JSON responce
$chain = array();
$itemId = false;
$i = -1;
foreach($path['PATH'] as $id => $pItem)
{
$i++;
if(!$i) // we dont need for an item itself in the path chain
{
$itemId = $id;
continue;
}
$pathItems[$pItem['ID']] = $pItem;
$chain[] = intval($pItem['ID']);
}
$result['PATH'][$itemId] = $chain;
}
$result['PATH_ITEMS'] = $pathItems;
return $result;
}
示例2: obtainDataConnectors
protected function obtainDataConnectors()
{
if(!$this->arParams['LINK_ENTITY_NAME'])
{
$this->errors['FATAL'][] = Loc::getMessage('SALE_SLSS_LINK_ENTITY_NAME_NOT_SET');
return;
}
$class = $this->entityClass;
$parameters = array(
'select' => array(
'ID',
'CODE',
'LEFT_MARGIN',
'RIGHT_MARGIN',
'SORT',
'TYPE_ID',
'LNAME' => 'NAME.NAME'
),
'filter' => array(
'NAME.LANGUAGE_ID' => LANGUAGE_ID
)
);
$linkFld = $this->useCodes ? 'CODE' : 'ID';
$res = false;
$points = array();
// get locations to display
if($this->locationsFromRequest !== false) // get from request when form save fails or smth
$res = self::getEntityListByListOfPrimary(self::LOCATION_ENTITY_NAME, $this->locationsFromRequest, $parameters, $linkFld);
elseif(strlen($this->arParams['ENTITY_PRIMARY'])) // get from database, if entity exists
$res = $class::getConnectedLocations($this->arParams['ENTITY_PRIMARY'], $parameters);
if($res !== false)
{
$res->addReplacedAliases(array('LNAME' => 'NAME'));
while($item = $res->fetch())
$points[$item['ID']] = $item;
}
if(!empty($points))
{
// same algorythm repeated on client side - fetch PATH for only visible items
if((count($points) - static::PAGE_SIZE) > static::HUGE_TAIL_LEN)
$pointsToGetPath = array_slice($points, 0, static::PAGE_SIZE);
else
$pointsToGetPath = $points;
$res = Location\LocationTable::getPathToMultipleNodes($pointsToGetPath, array(
'select' => array(
//'ID',
//'CODE',
'LNAME' => 'NAME.NAME'
),
'filter' => array(
'NAME.LANGUAGE_ID' => LANGUAGE_ID
)
));
while($item = $res->Fetch())
{
$item['ID'] = intval($item['ID']);
foreach($item['PATH'] as &$node)
{
$node['NAME'] = $node['LNAME'];
unset($node['LNAME']);
}
$points[$item['ID']]['PATH'] = $item['PATH'];
}
foreach($points as &$location)
{
unset($location['LEFT_MARGIN']); // system fields should not figure in $arResult
unset($location['RIGHT_MARGIN']); // same
}
unset($location);
}
$this->dbResult['CONNECTIONS']['LOCATION'] = $points;
if($this->useGroups)
{
$parameters = array('select' => array(
'ID',
'CODE',
'LNAME' => 'NAME.NAME'
),
'filter' => array(
'NAME.LANGUAGE_ID' => LANGUAGE_ID
)
);
$res = false;
$points = array();
//.........这里部分代码省略.........
示例3: getPathToNodes
protected static function getPathToNodes($list)
{
$res = Location\LocationTable::getPathToMultipleNodes(
$list,
array(
'select' => array('ID', 'LNAME' => 'NAME.NAME'),
'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID)
)
);
$pathNames = array();
$result = array();
while($path = $res->fetch())
{
// format path as required for JSON responce
$chain = array();
$itemId = false;
$i = -1;
foreach($path['PATH'] as $id => $pItem)
{
$i++;
if(!$i) // we dont need for an item itself in the path chain
{
$itemId = $id;
continue;
}
$pathNames[$pItem['ID']] = $pItem['LNAME'];
$chain[] = intval($pItem['ID']);
}
$result['PATH'][$itemId] = $chain;
}
$result['PATH_NAMES'] = $pathNames;
return $result;
}