class_add.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.admin
  5. */
  6. /**
  7. * Code
  8. */
  9. // Language files that should be included.
  10. $language_file = 'admin';
  11. // Resetting the course id.
  12. $cidReset = true;
  13. // Including some necessary dokeos files.
  14. require_once '../inc/global.inc.php';
  15. require_once api_get_path(LIBRARY_PATH).'classmanager.lib.php';
  16. // Setting the section (for the tabs).
  17. $this_section = SECTION_PLATFORM_ADMIN;
  18. // Access restrictions.
  19. api_protect_admin_script();
  20. // Setting breadcrumbs.
  21. $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
  22. $interbreadcrumb[] = array ('url' => 'class_list.php', 'name' => get_lang('Classes'));
  23. // Setting the name of the tool.
  24. $tool_name = get_lang("AddClasses");
  25. $form = new FormValidator('add_class');
  26. $form->add_textfield('name', get_lang('ClassName'));
  27. $form->addElement('style_submit_button', 'submit', get_lang('Ok'), 'class="add"');
  28. if ($form->validate()) {
  29. $values = $form->exportValues();
  30. ClassManager::create_class($values['name']);
  31. header('Location: class_list.php');
  32. }
  33. // Displaying the header.
  34. Display :: display_header($tool_name);
  35. // Displaying the form.
  36. $form->display();
  37. // Displaying the footer.
  38. Display :: display_footer();