private function getItems(NavContainer $container, $parentNavId = 0, $parentGroup = [], $index = 1)
    {
        $navs = $container->getNavs()->andWhere(['parent_nav_id' => $parentNavId])->all();

        foreach ($navs as $nav) {
            $array = $nav->toArray();

            if (empty($nav->activeLanguageItem)) {
                continue;
            }
            $array['title'] = $nav->activeLanguageItem->title;

            foreach ($this->getGroups() as $key => $group) {
                $isInheritedFromParent = false;

                if (isset($parentGroup[$key])) {
                    if ($parentGroup[$key]['isGroupPermissionInheritNode'] || $parentGroup[$key]['isInheritedFromParent']) {
                        $isInheritedFromParent = true;
                    }
                }

                $array['groups'][$key] = [
                    'id' => $group->id,
                    'isGroupPermissionInheritNode' => $nav->isGroupPermissionInheritNode($group),
                    'hasGroupPermission' => $nav->hasGroupPermission($group),
                    'isInheritedFromParent' => $isInheritedFromParent,
                    'permissionCheckbox' => $nav->hasGroupPermissionSelected($group),
                    'groupFullPermission' => $this->groupHasFullPermission($group),
                ];
            }

            $array['nav_level'] = $index;

            self::$_permissionItemData[$container->id][] = $array;

            $this->getItems($container, $nav->id, $array['groups'], $index+1);
        }
    }
private function getItems(NavContainer $container, $parentNavId = 0, $parentGroup = [], $index = 1)
    {
        $navs = $container->getNavs()->andWhere(['parent_nav_id' => $parentNavId])->all();

        foreach ($navs as $nav) {
            $array = $nav->toArray();

            if (empty($nav->activeLanguageItem)) {
                continue;
            }
            $array['title'] = $nav->activeLanguageItem->title;

            foreach ($this->getGroups() as $key => $group) {
                $isInheritedFromParent = false;

                if (isset($parentGroup[$key])) {
                    if ($parentGroup[$key]['isGroupPermissionInheritNode'] || $parentGroup[$key]['isInheritedFromParent']) {
                        $isInheritedFromParent = true;
                    }
                }

                $array['groups'][$key] = [
                    'id' => $group->id,
                    'isGroupPermissionInheritNode' => $nav->isGroupPermissionInheritNode($group),
                    'hasGroupPermission' => $nav->hasGroupPermission($group),
                    'isInheritedFromParent' => $isInheritedFromParent,
                    'permissionCheckbox' => $nav->hasGroupPermissionSelected($group),
                    'groupFullPermission' => $this->groupHasFullPermission($group),
                ];
            }

            $array['nav_level'] = $index;

            self::$_permissionItemData[$container->id][] = $array;

            $this->getItems($container, $nav->id, $array['groups'], $index+1);
        }
    }
private function getItems ( NavContainer $ container , $ parentNavId = 0 , $ parentGroup = [ ] , $ index = 1 ) { $ navs = $ container -> getNavs ( ) -> andWhere ( [ 'parent_nav_id' => $ parentNavId ] ) -> all ( ) ; foreach ( $ navs as $ nav ) { $ array = $ nav -> toArray ( ) ; if ( empty ( $ nav -> activeLanguageItem ) ) { continue ; } $ array [ 'title' ] = $ nav -> activeLanguageItem -> title ; foreach ( $ this -> getGroups ( ) as $ key => $ group ) { $ isInheritedFromParent = false ; if ( isset ( $ parentGroup [ $ key ] ) ) { if ( $ parentGroup [ $ key ] [ 'isGroupPermissionInheritNode' ] || $ parentGroup [ $ key ] [ 'isInheritedFromParent' ] ) { $ isInheritedFromParent = true ; } } $ array [ 'groups' ] [ $ key ] = [ 'id' => $ group -> id , 'isGroupPermissionInheritNode' => $ nav -> isGroupPermissionInheritNode ( $ group ) , 'hasGroupPermission' => $ nav -> hasGroupPermission ( $ group ) , 'isInheritedFromParent' => $ isInheritedFromParent , 'permissionCheckbox' => $ nav -> hasGroupPermissionSelected ( $ group ) , 'groupFullPermission' => $ this -> groupHasFullPermission ( $ group ) , ] ; } $ array [ 'nav_level' ] = $ index ; self :: $ _permissionItemData [ $ container -> id ] [ ] = $ array ; $ this -> getItems ( $ container , $ nav -> id , $ array [ 'groups' ] , $ index + 1 ) ; } }
Build a trree with items for a given NavContainer.

@param NavContainer $container
@param int $parentNavId
@param array $parentGroup
@param int $index
Build a trree with items for a given NavContainer .