Ejemplo n.º 1
0
     if (api_get_multiple_access_url()) {
         if (api_get_current_access_url_id() == 1 || isset($_configuration['enable_multiple_url_support_for_course_category']) && $_configuration['enable_multiple_url_support_for_course_category']) {
             CourseCategoryManager::deleteNode($categoryId);
             Display::addFlash(Display::return_message(get_lang('Deleted')));
             header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
             exit;
         }
     } else {
         CourseCategoryManager::deleteNode($categoryId);
         Display::addFlash(Display::return_message(get_lang('Deleted')));
         header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
         exit;
     }
 } 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;