gradebook_add_link_select_course.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Script.
  5. *
  6. * @package chamilo.gradebook
  7. */
  8. require_once __DIR__.'/../inc/global.inc.php';
  9. $current_course_tool = TOOL_GRADEBOOK;
  10. api_protect_course_script(true);
  11. api_block_anonymous_users();
  12. GradebookUtils::block_students();
  13. $selectCat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
  14. $catadd = new Category();
  15. $catadd->set_user_id(api_get_user_id());
  16. $catadd->set_parent_id($selectCat);
  17. $catcourse = Category :: load($selectCat);
  18. $form = new CatForm(
  19. CatForm :: TYPE_SELECT_COURSE,
  20. $catadd,
  21. 'add_cat_form',
  22. null,
  23. api_get_self().'?selectcat='.$selectCat.'&'.api_get_cidreq()
  24. );
  25. if ($form->validate()) {
  26. $values = $form->exportValues();
  27. $cat = new Category();
  28. $cat->set_course_code($values['select_course']);
  29. $cat->set_name($values['name']);
  30. header('Location: gradebook_add_link.php?selectcat='.$selectCat.'&course_code='.Security::remove_XSS($values['select_course']).'&'.api_get_cidreq());
  31. exit;
  32. }
  33. $interbreadcrumb[] = [
  34. 'url' => Category::getUrl().'selectcat='.$selectCat,
  35. 'name' => get_lang('Gradebook'),
  36. ];
  37. Display :: display_header(get_lang('NewCategory'));
  38. $form->display();
  39. Display :: display_footer();