gradebook_add_link_select_course.php 1.3 KB

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