當前位置: 首頁>>代碼示例>>PHP>>正文


PHP LocationTable::getParentTree方法代碼示例

本文整理匯總了PHP中Bitrix\Sale\Location\LocationTable::getParentTree方法的典型用法代碼示例。如果您正苦於以下問題:PHP LocationTable::getParentTree方法的具體用法?PHP LocationTable::getParentTree怎麽用?PHP LocationTable::getParentTree使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Bitrix\Sale\Location\LocationTable的用法示例。


在下文中一共展示了LocationTable::getParentTree方法的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;
 }
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:48,代碼來源:locationhelper.php


注:本文中的Bitrix\Sale\Location\LocationTable::getParentTree方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。