Esempio n. 1
0
        exit;
    } elseif (($action == 'add' || $action == 'edit') && isset($_POST['formSent']) && $_POST['formSent']) {
        if ($action == 'add') {
            $ret = CourseCategory::addNode($_POST['code'], $_POST['name'], $_POST['auth_course_child'], $category);
            Display::addFlash(Display::return_message(get_lang('Created')));
        } else {
            $ret = CourseCategory::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') {
        CourseCategory::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' => Container::getRouter()->generate('administration'), "name" => get_lang('PlatformAdmin'));
Display::display_header($tool_name);
if ($action == 'add' || $action == 'edit') {
    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)) {
        $form_title .= ' ' . get_lang('Into') . ' ' . Security::remove_XSS($category);