class_add.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. // name of the language file that needs to 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('submit','submit',get_lang('Ok'));
  45. if($form->validate())
  46. {
  47. $values = $form->exportValues();
  48. ClassManager :: create_class($values['name']);
  49. header('Location: class_list.php');
  50. }
  51. // Displaying the header
  52. Display :: display_header($tool_name);
  53. // Displaying the form
  54. $form->display();
  55. /*
  56. ==============================================================================
  57. FOOTER
  58. ==============================================================================
  59. */
  60. Display :: display_footer();
  61. ?>