gradebook_add_link_select_course.php 1.4 KB

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