本文整理汇总了PHP中Bitrix\Sale\Location\LocationTable::getChildren方法的典型用法代码示例。如果您正苦于以下问题:PHP LocationTable::getChildren方法的具体用法?PHP LocationTable::getChildren怎么用?PHP LocationTable::getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Sale\Location\LocationTable
的用法示例。
在下文中一共展示了LocationTable::getChildren方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLocationSubMenu
public static function getLocationSubMenu()
{
// how it works: every time when we call for the next sub-level, we must
// obtain not sublevel itself, but a whole parent-tree of it
$queryParams = self::unPackItemsQueryString();
$requiredToShow = false;
// three situations:
// 1) node id comes in $_REQUEST['admin_mnu_menu_id'] parameter when user walks along left menu tree
$id = false;
if (self::checkRequestIsMenuRequest()) {
$requiredToShow = true;
$id = $queryParams['ID'];
}
if (!$id) {
// 2) node id comes in $_REQUEST['id'] or in $_REQUEST['parent_id'] when user enters self::LIST_PAGE_URL or self::EDIT_PAGE_URL page
$page = $GLOBALS['APPLICATION']->GetCurPage();
if ($page == '/bitrix/admin/' . self::LIST_PAGE_URL || $page == '/bitrix/admin/' . self::EDIT_PAGE_URL) {
$requiredToShow = true;
/*
if(intval($_REQUEST['id']))
$id = intval($_REQUEST['id']);
*/
if (intval($_REQUEST['find_PARENT_ID'])) {
$id = intval($_REQUEST['find_PARENT_ID']);
} elseif (intval($_REQUEST['parent_id'])) {
$id = intval($_REQUEST['parent_id']);
}
}
}
// 3) there is no node id at all
$tree = array();
if ($requiredToShow) {
$parameters = array('select' => array('ID', 'LOCATION_NAME' => 'NAME.NAME', 'DEPTH_LEVEL', 'PARENT_ID', 'CHILD_CNT'), 'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID), 'order' => array('LOCATION_NAME' => 'asc'));
if ($id) {
$res = Location\LocationTable::getParentTree($id, $parameters, array('SHOW_CHILDREN' => true));
} else {
$res = Location\LocationTable::getChildren(false, $parameters);
}
$index = array();
while ($item = $res->Fetch()) {
$index[$item['PARENT_ID']][$item['ID']] = array('NAME' => htmlspecialcharsbx($item['LOCATION_NAME']), 'PARENT_ID' => intval($item['PARENT_ID']), 'CHILD_CNT' => intval($item['CHILD_CNT']));
}
unset($res);
unset($item);
self::appendMenuChildren($tree, 0, $index, $queryParams);
}
return $tree;
}