Ejemplo n.º 1
0
        }
    } elseif (($action == 'add' || $action == 'edit') && isset($_POST['formSent']) && $_POST['formSent']) {
        if ($action == 'add') {
            $ret = CourseCategoryManager::addNode($_POST['code'], $_POST['name'], $_POST['auth_course_child'], $category);
            Display::addFlash(Display::return_message(get_lang('Created')));
        } else {
            $ret = CourseCategoryManager::editNode($_POST['code'], $_POST['name'], $_POST['auth_course_child'], $categoryId);
            Display::addFlash(Display::return_message(get_lang('Updated')));
        }
        if ($ret) {
            $action = '';
        } else {
            $errorMsg = get_lang('CatCodeAlreadyUsed');
        }
    } elseif ($action == 'moveUp') {
        CourseCategoryManager::moveNodeUp($categoryId, $_GET['tree_pos'], $category);
        header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
        Display::addFlash(Display::return_message(get_lang('Updated')));
        exit;
    }
}
$tool_name = get_lang('AdminCategories');
$interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('PlatformAdmin'));
Display::display_header($tool_name);
if ($action == 'add' || $action == 'edit') {
    if (api_get_multiple_access_url() && api_get_current_access_url_id() == 1 || !api_get_multiple_access_url() || isset($_configuration['enable_multiple_url_support_for_course_category']) && $_configuration['enable_multiple_url_support_for_course_category']) {
        echo '<div class="actions">';
        echo Display::url(Display::return_icon('folder_up.png', get_lang("Back"), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . 'admin/course_category.php?category=' . Security::remove_XSS($category));
        echo '</div>';
        $form_title = $action == 'add' ? get_lang('AddACategory') : get_lang('EditNode');
        if (!empty($category)) {