public function BuildList()
    {
        global $USER;
        $filterParams = GetFilterParams('filter_');
        // list's footer
        $this->oList->AddFooter(array(array('title' => GetMessage('MAIN_ADMIN_LIST_SELECTED'), 'value' => $this->rsData->SelectedRowsCount()), array('counter' => true, 'title' => GetMessage('MAIN_ADMIN_LIST_CHECKED'), 'value' => '0')));
        $oParentPath = new CLearnPath();
        if (isset($_GET['LESSON_PATH'])) {
            $oParentPath->ImportUrlencoded($_GET['LESSON_PATH']);
        }
        $arParentPath = $oParentPath->GetPathAsArray();
        // building list
        while ($arRes = $this->rsData->NavNext(false)) {
            $oCurPath = new CLearnPath();
            $oCurPath->SetPathFromArray(array_merge($arParentPath, array($arRes['LESSON_ID'])));
            $urlCurPath = $oCurPath->ExportUrlencoded();
            unset($oCurPath);
            // PUBLISH_PROHIBITED available in context of most parent course only
            if ($this->contextCourseLessonId !== false) {
                $arRes['PUBLISH_PROHIBITED'] = 'N';
                if (CLearnLesson::IsPublishProhibited($arRes['LESSON_ID'], $this->contextCourseLessonId)) {
                    $arRes['PUBLISH_PROHIBITED'] = 'Y';
                }
            }
            $arRes['SITE_ID'] = '';
            $courseId = CLearnLesson::GetLinkedCourse($arRes['LESSON_ID']);
            if ($courseId !== false) {
                $hrefPrefix = 'learn_course_edit.php?COURSE_ID=' . $courseId;
                $resCourseSites = CCourse::GetSite($courseId);
                while ($arCourseSites = $resCourseSites->Fetch()) {
                    if ($arRes['SITE_ID'] != '') {
                        $arRes['SITE_ID'] .= ' / ';
                    }
                    $arRes['SITE_ID'] .= htmlspecialcharsbx($arCourseSites['LID']);
                }
            } else {
                $hrefPrefix = 'learn_unilesson_edit.php?LESSON_ID=' . $arRes['LESSON_ID'] . '&LESSON_PATH=' . urlencode($urlCurPath);
            }
            $actionEditLesson = $hrefPrefix . '&lang=' . LANG . $filterParams;
            $rowAction = false;
            $rowTitle = '';
            if (!$this->IsSearchMode()) {
                $rowAction = 'learn_unilesson_admin.php?lang=' . LANG . '&set_filter=Y' . '&PARENT_LESSON_ID=' . ($arRes['LESSON_ID'] + 0) . '&LESSON_PATH=' . $urlCurPath . '&' . $this->hrefSearchRetPoint;
                $rowTitle = GetMessage('LEARNING_TRAVERSE');
                // "Traverse list of immediate childs"
                if (!$arRes['IS_CHILDS']) {
                    $rowAction = $actionEditLesson;
                    $rowTitle = GetMessage('LEARNING_EDIT_TITLE');
                }
            }
            $row =& $this->oList->AddRow($arRes['LESSON_ID'], $arRes, $rowAction, $rowTitle);
            $arParents = $arChilds = array();
            $htmlParents = $htmlChilds = '';
            $rsParents = CLearnLesson::GetListOfImmediateParents($arRes['LESSON_ID'], array(), array('CHECK_PERMISSIONS' => 'N'));
            while ($arParent = $rsParents->Fetch()) {
                $arParents[] = $arParent['NAME'];
            }
            $arParents = array_map('htmlspecialcharsbx', $arParents);
            if (count($arParents) > 0) {
                $htmlParents = implode('<hr width="100%" size="1">', $arParents);
            } else {
                $htmlParents = '&nbsp;';
            }
            $rsChilds = CLearnLesson::GetListOfImmediateChilds($arRes['LESSON_ID'], array(), array('CHECK_PERMISSIONS' => 'N'));
            while ($arChild = $rsChilds->Fetch()) {
                $arChilds[] = $arChild['NAME'];
            }
            $arChilds = array_map('htmlspecialcharsbx', $arChilds);
            if (count($arChilds) > 0) {
                $htmlChilds = implode('<hr width="100%" size="1">', $arChilds);
            } else {
                $htmlChilds = '&nbsp;';
            }
            if (isset($arRes['LINKED_LESSON_ID']) && $arRes['LINKED_LESSON_ID'] > 0) {
                $icon = 'learning_icon_courses';
            } elseif (count($arChilds) > 0) {
                $icon = 'learning_icon_chapters';
            } else {
                $icon = 'learning_icon_lessons';
            }
            if (!$this->IsSearchMode()) {
                $row->AddViewField('NAME', '<span class="adm-list-table-icon-link"><span class="adm-submenu-item-link-icon adm-list-table-icon ' . $icon . '"></span>' . ($rowAction === false ? '<span class="adm-list-table-link">' . htmlspecialcharsbx($arRes['NAME']) . '</span>' : '<a href="' . $rowAction . '" class="adm-list-table-link">' . htmlspecialcharsbx($arRes['NAME']) . '</a>') . '</span>');
            } else {
                $actionUseLesson = "(function()\n\t\t\t\t\t{\n\t\t\t\t\t\tvar fnName = '" . str_replace(array("'", ';', ',', "\n", "\r"), '', htmlspecialcharsbx($this->search_retpoint)) . "';\n\t\t\t\t\t\tif ( ! (window.opener && window.opener[fnName]) )\n\t\t\t\t\t\t\treturn;\n\n\t\t\t\t\t\twindow.opener[fnName]('" . (int) $arRes['LESSON_ID'] . "', '" . CUtil::JSEscape(htmlspecialcharsbx($arRes['NAME'])) . "');\n\t\t\t\t\t\twindow.close();\n\t\t\t\t\t})();\n\t\t\t\t\t";
                $row->AddViewField('NAME', '<a href="javascript:void(0);" class="adm-list-table-icon-link" onclick="' . $actionUseLesson . '"><span class="adm-submenu-item-link-icon adm-list-table-icon ' . $icon . '"></span><span class="adm-list-table-link">' . htmlspecialcharsbx($arRes['NAME']) . '</span></a>');
            }
            $row->AddViewField('PARENTS', $htmlParents);
            $row->AddEditField('PARENTS', '&nbsp;');
            $row->AddViewField('CHILDS', $htmlChilds);
            $row->AddEditField('CHILDS', '&nbsp;');
            // this is very heavy statistic, so will be a good idea to add settings to the module, which turn off this statistics
            $oLearnTree = CLearnLesson::GetTree($arRes['LESSON_ID']);
            $arTree = $oLearnTree->GetTreeAsList();
            $depth = -1;
            $chapterCount = 0;
            $lessonsCount = 0;
            $questionsCount = CLQuestion::GetCount(array('LESSON_ID' => (int) $arRes['LESSON_ID']));
            foreach ($arTree as $arLessonData) {
                if ($arLessonData['IS_CHILDS']) {
                    ++$chapterCount;
                } else {
                    ++$lessonsCount;
                }
                if ((int) $arLessonData['#DEPTH_IN_TREE'] > $depth) {
                    $depth = (int) $arLessonData['#DEPTH_IN_TREE'];
                }
                $questionsCount += CLQuestion::GetCount(array('LESSON_ID' => (int) $arLessonData['LESSON_ID']));
            }
            // PUBLISH_PROHIBITED available in context of most parent course only
            if ($this->contextCourseLessonId !== false) {
                if ($this->IsLessonUpdateAccess($arRes['LESSON_ID']) === true) {
                    $row->AddInputField('PUBLISH_PROHIBITED', array('size' => '35'));
                    $row->AddCheckField('PUBLISH_PROHIBITED');
                } else {
                    $row->AddCheckField('PUBLISH_PROHIBITED', true);
                }
            }
            // Render CARDINALITY fields
            $htmlDepth = (int) ($depth + 1);
            $htmlChapters = (string) (int) $chapterCount . '&nbsp;[<a href="learn_unilesson_edit.php?lang=' . LANG . '&PROPOSE_RETURN_LESSON_PATH=' . $urlCurPath . '" title="' . GetMessage('LEARNING_UNILESSON_ADD') . '"' . '>+</a>]';
            $htmlLessons = (string) (int) $lessonsCount . '&nbsp;[<a href="learn_unilesson_edit.php?lang=' . LANG . '&PROPOSE_RETURN_LESSON_PATH=' . $urlCurPath . '" title="' . GetMessage('LEARNING_UNILESSON_ADD') . '"' . '>+</a>]';
            $htmlQuestions = '<a href="learn_question_admin.php?lang=' . LANG . '&filter=Y&set_filter=Y' . '&PARENT_LESSON_ID=' . ($arRes['LESSON_ID'] + 0) . '&LESSON_PATH=' . $urlCurPath . '" title="' . GetMessage('LEARNING_QUESTION_ALT') . '">' . (int) $questionsCount . '</a>' . '&nbsp;[' . '<a href="learn_question_edit.php?lang=' . LANG . '&LESSON_PATH=' . $urlCurPath . '&QUESTION_TYPE=S' . '&filter=Y&set_filter=Y' . '&from=learn_menu"' . ' title="' . GetMessage('LEARNING_QUESTION_ADD') . '">+</a>' . ']';
            $row->AddViewField('CARDINALITY_DEPTH', $htmlDepth);
            $row->AddViewField('CARDINALITY_CHAPTERS', $htmlChapters);
            $row->AddViewField('CARDINALITY_LESSONS', $htmlLessons);
            $row->AddViewField('CARDINALITY_QUESTIONS', $htmlQuestions);
            if ($courseId !== false) {
                $testsCount = (int) CTest::GetCount(array('COURSE_ID' => $courseId));
                $htmlTests = '<a href="learn_test_admin.php?lang=' . LANG . '&COURSE_ID=' . $courseId . '&PARENT_LESSON_ID=' . (int) $arRes['LESSON_ID'] . '&LESSON_PATH=' . $urlCurPath . '&filter=Y&set_filter=Y"' . '>' . $testsCount . '</a>' . '&nbsp;[<a href="learn_test_edit.php?lang=' . LANG . '&COURSE_ID=' . $courseId . '&PARENT_LESSON_ID=' . (int) $arRes['LESSON_ID'] . '&LESSON_PATH=' . $urlCurPath . '&filter=Y&set_filter=Y"
					title="' . GetMessage('LEARNING_QUESTION_ADD') . '"' . '>+</a>]';
                $row->AddViewField('CARDINALITY_TESTS', $htmlTests);
            }
            if (!$this->IsSearchMode() && $this->IsLessonUpdateAccess($arRes['LESSON_ID']) === true) {
                $row->AddInputField('NAME', array('size' => '35'));
                // SORT field editing possibly only for courses and for lessons in relation to parent lesson
                if ($this->IsListChildLessonsMode() || $this->IsListAnyCoursesMode()) {
                    $row->AddInputField('SORT', array('size' => '3'));
                }
                $row->AddCheckField('ACTIVE');
                $row->AddInputField('CODE');
            } else {
                $row->AddCheckField('ACTIVE', false);
            }
            $row->AddViewField('CREATED_USER_NAME', $arRes['CREATED_USER_NAME']);
            $arActions = array();
            if (!$this->IsSearchMode()) {
                if ($this->IsLessonUpdateAccess($arRes['LESSON_ID']) === true) {
                    $editTxt = GetMessage('MAIN_ADMIN_MENU_EDIT');
                } else {
                    $editTxt = GetMessage('MAIN_ADMIN_MENU_OPEN');
                }
                // Actions
                $arActions[] = array('ICON' => 'edit', 'TEXT' => $editTxt, 'ACTION' => $this->oList->ActionRedirect($actionEditLesson));
                $arActions[] = array("SEPARATOR" => true);
                $arActions[] = array('ICON' => 'list', 'TEXT' => GetMessage('LEARNING_QUESTION_ALT') . ' (' . ($questionsCount + 0) . ')', 'ACTION' => $this->oList->ActionRedirect('learn_question_admin.php?lang=' . LANG . '&filter=Y&set_filter=Y' . '&PARENT_LESSON_ID=' . ($arRes['LESSON_ID'] + 0) . '&LESSON_PATH=' . urlencode($urlCurPath)));
                /*
                $arActions[] = array(
                	"ICON"=>"copy",
                	"TEXT"=>GetMessage("MAIN_ADMIN_ADD_COPY"),
                	"ACTION"=>$this->oList->ActionRedirect("learn_course_edit.php?COPY_ID=".$f_ID));
                */
                $isDeleteCmdDisabled = true;
                $isDisbandCmdDisabled = true;
                $deleteMSG = '';
                $disbandMSG = '';
                $actionDisband = '';
                $action = '';
                if ($arRes['CHILDS_CNT'] > 0) {
                    $deleteMSG = GetMessage('LEARNING_ADMIN_MENU_DELETE_RECURSIVE') . ' (' . (string) (int) $arRes['CHILDS_CNT'] . ')';
                } else {
                    $deleteMSG = GetMessage("MAIN_ADMIN_MENU_DELETE");
                }
                $disbandMSG = GetMessage('LEARNING_ADMIN_MENU_DISBAND');
                $isEnoughRightsForDisbandLesson = false;
                try {
                    $this->EnsureLessonDisbandAccess($arRes['LESSON_ID']);
                    $isEnoughRightsForDisbandLesson = true;
                } catch (CLearnRenderAdminUnilessonListException $e) {
                    if ($e->GetCode() & CLearnRenderAdminUnilessonListException::C_ACCESS_DENIED) {
                    } else {
                        // bubble exception
                        throw new CLearnRenderAdminUnilessonListException($e->GetMessage(), $e->GetCode());
                    }
                }
                // If we can unlink all neighbours and remove lesson
                if ($isEnoughRightsForDisbandLesson) {
                    $arOPathes = CLearnLesson::GetListOfParentPathes($arRes['LESSON_ID']);
                    $parentPathesCnt = count($arOPathes);
                    // prepare "Disband" command
                    $isDisbandCmdDisabled = false;
                    $actionDisband = $this->oList->ActionDoGroup($arRes['LESSON_ID'], 'disband', 'PARENT_LESSON_ID=' . ($this->requestedParentLessonId + 0));
                    if ($parentPathesCnt >= 1) {
                        $actionDisband = "if(confirm('" . str_replace('#CNT#', $parentPathesCnt, GetMessageJS('LEARNING_CONFIRM_DISBAND_LESSON_WITH_PARENT_PATHES')) . "')) " . '{ ' . $actionDisband . ' }';
                    }
                    $actionDisband = "if(confirm('" . GetMessageJS('LEARNING_ADMIN_MENU_DISBAND_QUESTION') . "')) " . '{ ' . $actionDisband . ' }';
                    // prepare "Remove" command
                    $isDeleteCmdDisabled = false;
                    if ($arRes['CHILDS_CNT'] > 0) {
                        $action = $this->oList->ActionDoGroup($arRes['LESSON_ID'], 'recursive_delete', 'PARENT_LESSON_ID=' . ($this->requestedParentLessonId + 0));
                    } else {
                        // If no childs => "delete" is equal to "disband"
                        $action = $this->oList->ActionDoGroup($arRes['LESSON_ID'], 'disband', 'PARENT_LESSON_ID=' . ($this->requestedParentLessonId + 0));
                    }
                    if ($parentPathesCnt >= 1) {
                        $deleteMSG .= ' [' . $parentPathesCnt . ']';
                        $action = "if(confirm('" . str_replace('#CNT#', $parentPathesCnt, GetMessageJS("LEARNING_CONFIRM_DEL_LESSON_WITH_PARENT_PATHES")) . "')) " . $action;
                    } else {
                        $action = "if(confirm('" . GetMessageJS('LEARNING_CONFIRM_DEL_MESSAGE') . "')) " . $action;
                    }
                }
                // We can "disband" only lessons, that contains childs
                $arActions[] = array("SEPARATOR" => true);
                if ($arRes['CHILDS_CNT'] > 0) {
                    $arActions[] = array('ICON' => 'delete', 'TEXT' => $disbandMSG, 'ACTION' => $actionDisband, 'DISABLED' => $isDisbandCmdDisabled, 'TITLE' => GetMessage('LEARNING_ADMIN_MENU_DISBAND_TITLE'));
                }
                $arActions[] = array('ICON' => 'delete', 'TEXT' => $deleteMSG, 'ACTION' => $action, 'DISABLED' => $isDeleteCmdDisabled);
            } else {
                $arActions[] = array('ICON' => 'list', 'TEXT' => GetMessage('LEARNING_SELECT'), 'ACTION' => $actionUseLesson);
            }
            $row->AddActions($arActions);
        }
        return $this;
    }
Example #2
0
function __learning_admin_get_menu($THIS, $arPath = array(), $deep = 0, &$immediateChildsIds, $loadOnlySpecialEntities = false)
{
    $immediateChildsIds = array();
    // puts here ids of all immediate childs
    $deep = (int) $deep;
    // Index in path for current parentLessonId
    $indexInPath = $deep - 1;
    // Path doesn't include top root element ('all courses' or 'all unilessons')
    $arMenu = array();
    //$urlPath = $oPath->ExportUrlencoded();
    // current lesson id (not exists only for top root)
    if (isset($arPath[$deep])) {
        $currentLessonIdInPath = (int) $arPath[$deep];
    } else {
        $currentLessonIdInPath = false;
    }
    // Path to current element
    $arCurrentDeepPath = array();
    foreach ($arPath as $key => $value) {
        if ($key === $deep) {
            break;
        }
        $arCurrentDeepPath[] = $value;
    }
    if ($deep === 0) {
        // We are at the top level, so we must get list of all courses
        $CDBResult = CCourse::GetList(array('COURSE_SORT' => 'ASC'));
    } else {
        // If not parent with such indexInPath => we are deep too much.
        if (!isset($arPath[$indexInPath])) {
            return $arMenu;
        }
        // no items
        $parentLessonId = $arPath[$indexInPath];
        $oCurrentDeepPath = new CLearnPath();
        $oCurrentDeepPath->SetPathFromArray(array_merge($arCurrentDeepPath));
        $urlPath = $oCurrentDeepPath->ExportUrlencoded();
        $arMenu[] = array("text" => GetMessage("LEARNING_QUESTION"), "url" => "learn_question_admin.php?lang=" . LANG . '&PARENT_LESSON_ID=' . ($parentLessonId + 0) . '&LESSON_PATH=' . $urlPath . "&from=learn_menu", "icon" => "learning_icon_question", "more_url" => array("learn_question_admin.php?lang=" . LANG . '&PARENT_LESSON_ID=' . ($parentLessonId + 0) . '&LESSON_PATH=' . $urlPath . "&from=learn_menu", "learn_question_edit.php?lang=" . LANG . '&LESSON_PATH=' . $urlPath . "&from=learn_menu", "learn_question_admin.php?lang=" . LANG . '&PARENT_LESSON_ID=' . ($parentLessonId + 0) . '&LESSON_PATH=' . $urlPath, "learn_question_edit.php?lang=" . LANG . '&LESSON_PATH=' . $urlPath, "learn_question_admin.php?lang=" . LANG . '&LESSON_PATH=' . $urlPath), "title" => GetMessage("LEARNING_QUESTION_LIST"));
        $CDBResult = CLearnLesson::GetListOfImmediateChilds($parentLessonId, array('EDGE_SORT' => 'ASC'));
        // determine, is parent a course (only for courses in subroot level)?
        if ($deep === 1) {
            $immediateParentCourse = CLearnLesson::GetLinkedCourse($parentLessonId);
            if ($immediateParentCourse !== false) {
                // immediate parent is a course, so we must add entity 'Tests'
                $arMenu[] = array('text' => GetMessage('LEARNING_TESTS'), 'url' => 'learn_test_admin.php?lang=' . LANG . '&filter=Y&set_filter=Y' . '&COURSE_ID=' . ($immediateParentCourse + 0) . '&PARENT_LESSON_ID=' . ($parentLessonId + 0) . '&LESSON_PATH=' . $urlPath, 'icon' => 'learning_icon_tests', 'more_url' => array('learn_test_admin.php?lang=' . LANG . '&set_filter=Y' . '&COURSE_ID=' . ($immediateParentCourse + 0) . '&PARENT_LESSON_ID=' . ($parentLessonId + 0) . '&LESSON_PATH=' . $urlPath, 'learn_test_edit.php?lang=' . LANG . '&filter=Y&set_filter=Y' . '&COURSE_ID=' . ($immediateParentCourse + 0) . '&PARENT_LESSON_ID=' . ($parentLessonId + 0) . '&LESSON_PATH=' . $urlPath), 'title' => GetMessage('LEARNING_TESTS_LIST'));
                unset($urlPath);
                unset($oCurrentDeepPath);
            }
        }
    }
    if ($loadOnlySpecialEntities) {
        return $arMenu;
    }
    // When listing courses, limit it's count
    if ($deep === 0) {
        $items = 0;
        $learning_menu_max_courses = (int) COption::GetOptionString("learning", "menu_max_courses", "10");
    }
    while ($arData = $CDBResult->GetNext()) {
        // When listing courses, limit it's count
        if ($deep === 0) {
            if ($items >= $learning_menu_max_courses) {
                // add element 'other courses'
                $arMenu[] = array('text' => GetMessage('LEARNING_MENU_COURSES_OTHER'), 'url' => 'learn_unilesson_admin.php?lang=' . LANG . '&PARENT_LESSON_ID=-1', 'title' => GetMessage('LEARNING_MENU_COURSES_ALT'), 'more_url' => array('learn_test_admin.php', 'learn_test_edit.php', 'learn_unilesson_admin.php', 'learn_unilesson_edit.php', 'learn_question_admin.php', 'learn_question_edit.php'));
                // stop adding courses to menu
                break;
            }
            $items++;
        }
        $arSubImmediateChildsIds = false;
        $arCurItemPath = $arCurrentDeepPath;
        $arCurItemPath[] = $arData['LESSON_ID'] + 0;
        // Remember all immediate childs
        $immediateChildsIds[] = $arData['LESSON_ID'] + 0;
        $oCurItemPath = new CLearnPath();
        $oCurItemPath->SetPathFromArray($arCurItemPath);
        $urlCurItemPath = $oCurItemPath->ExportUrlencoded();
        $arItem = array('text' => $arData['NAME'], 'url' => 'learn_unilesson_admin.php?lang=' . LANG . '&PARENT_LESSON_ID=' . ($arData['LESSON_ID'] + 0) . '&LESSON_PATH=' . $oCurItemPath->ExportUrlencoded(), 'title' => $arData['NAME'], 'items_id' => 'menu_learning_courses_new_' . implode('_', $arCurItemPath), "icon" => "learning_icon_courses", 'module_id' => 'learning', 'more_url' => array('learn_unilesson_admin.php?lang=' . LANG . '&set_filter=Y' . '&PARENT_LESSON_ID=' . ($arData['LESSON_ID'] + 0) . '&LESSON_PATH=' . $urlCurItemPath, 'learn_unilesson_admin.php?lang=' . LANG . '&PARENT_LESSON_ID=' . ($arData['LESSON_ID'] + 0) . '&LESSON_PATH=' . $urlCurItemPath, 'learn_unilesson_admin.php?lang=' . LANG . '&set_filter=Y' . '&LESSON_PATH=' . $urlCurItemPath, 'learn_question_admin.php?lang=' . LANG . '&filter=Y&set_filter=Y' . '&LESSON_PATH=' . $urlCurItemPath, 'learn_question_edit.php?lang=' . LANG . '&set_filter=Y' . '&LESSON_PATH=' . $urlCurItemPath, 'learn_unilesson_edit.php?lang=' . LANG . '&LESSON_ID=' . ($arData['LESSON_ID'] + 0) . '&LESSON_PATH=' . $urlCurItemPath, 'learn_unilesson_edit.php?lang=' . LANG . '&PARENT_LESSON_ID=' . ($arData['LESSON_ID'] + 0) . '&LESSON_PATH=' . $urlCurItemPath));
        $arItem['items'] = array();
        if ($deep === 0 && isset($arData['LINKED_LESSON_ID']) && $arData['LINKED_LESSON_ID'] > 0) {
            $arItem['page_icon'] = $arItem['icon'] = 'learning_icon_courses';
            $arItem['dynamic'] = true;
            $loadOnlySpecialEntities = false;
            // Load child items only for lesson in current path
            if ($arData['LESSON_ID'] == $currentLessonIdInPath) {
                $arItem['items'] = __learning_admin_get_menu($THIS, $arPath, $deep + 1, $arSubImmediateChildsIds);
            }
        } else {
            $loadOnlySpecialEntities = false;
            $childsCnt = CLearnLesson::CountImmediateChilds($arData['LESSON_ID']);
            $questionsCnt = CLQuestion::GetCount(array('LESSON_ID' => (int) $arData['LESSON_ID']));
            if ($childsCnt > 0) {
                $arItem['page_icon'] = $arItem['icon'] = 'learning_icon_chapters';
            } else {
                $arItem['page_icon'] = $arItem['icon'] = 'learning_icon_lessons';
            }
            $arItem['dynamic'] = true;
            // Load child items only for lesson in current path
            if ($arData['LESSON_ID'] == $currentLessonIdInPath) {
                $arItem['items'] = __learning_admin_get_menu($THIS, $arPath, $deep + 1, $arSubImmediateChildsIds);
            }
        }
        // now, adds items into more_url (it needs when edit form for childs opened)
        if (is_array($arSubImmediateChildsIds)) {
            $oSubItemPath = new CLearnPath();
            foreach ($arSubImmediateChildsIds as $k => $v) {
                // determine path for every child
                $arSubItemPath = $arCurItemPath;
                $arSubItemPath[] = $v;
                // child id added to current path
                $oSubItemPath->SetPathFromArray($arSubItemPath);
                $arItem['more_url'][] = 'learn_unilesson_edit.php?lang=' . LANG . '&filter=Y&set_filter=Y' . '&LESSON_ID=' . ($v + 0) . '&LESSON_PATH=' . $oSubItemPath->ExportUrlencoded();
            }
            unset($oSubItemPath);
            $arSubImmediateChildsIds = false;
        }
        $arMenu[] = $arItem;
        unset($oCurItemPath, $arCurItemPath, $urlCurItemPath, $arItem);
    }
    return $arMenu;
}