class_add.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. // $Id: class_add.php 10215 2006-11-27 13:57:17Z pcool $
  3. /*
  4. ==============================================================================
  5. Dokeos - elearning and course management software
  6. Copyright (c) 2004 Dokeos S.A.
  7. Copyright (c) 2003 Ghent University (UGent)
  8. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  9. Copyright (c) Olivier Brouckaert
  10. Copyright (c) Bart Mollet, Hogeschool Gent
  11. For a full list of contributors, see "credits.txt".
  12. The full license can be read in "license.txt".
  13. This program is free software; you can redistribute it and/or
  14. modify it under the terms of the GNU General Public License
  15. as published by the Free Software Foundation; either version 2
  16. of the License, or (at your option) any later version.
  17. See the GNU General Public License for more details.
  18. Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  19. ==============================================================================
  20. */
  21. /**
  22. ==============================================================================
  23. * @package dokeos.admin
  24. ==============================================================================
  25. */
  26. // Language files that should be included.
  27. $language_file = 'admin';
  28. // Resetting the course id.
  29. $cidReset = true;
  30. // Including some necessary dokeos files.
  31. require_once '../inc/global.inc.php';
  32. require_once api_get_path(LIBRARY_PATH).'classmanager.lib.php';
  33. require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
  34. // Setting the section (for the tabs).
  35. $this_section = SECTION_PLATFORM_ADMIN;
  36. // Access restrictions.
  37. api_protect_admin_script();
  38. // Setting breadcrumbs.
  39. $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
  40. // Setting the name of the tool.
  41. $tool_name = get_lang("AddClasses");
  42. $form = new FormValidator('add_class');
  43. $form->add_textfield('name', get_lang('ClassName'));
  44. $form->addElement('style_submit_button', 'submit', get_lang('Ok'), 'class="add"');
  45. if ($form->validate()) {
  46. $values = $form->exportValues();
  47. ClassManager::create_class($values['name']);
  48. header('Location: class_list.php');
  49. }
  50. // Displaying the header.
  51. Display :: display_header($tool_name);
  52. // Displaying the form.
  53. $form->display();
  54. // Displaying the footer.
  55. Display :: display_footer();