class_add.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. // Setting the section (for the tabs).
  16. $this_section = SECTION_PLATFORM_ADMIN;
  17. // Access restrictions.
  18. api_protect_admin_script();
  19. // Setting breadcrumbs.
  20. $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
  21. $interbreadcrumb[] = array ('url' => 'class_list.php', 'name' => get_lang('Classes'));
  22. // Setting the name of the tool.
  23. $tool_name = get_lang("AddClasses");
  24. $form = new FormValidator('add_class');
  25. $form->add_textfield('name', get_lang('ClassName'));
  26. $form->addElement('style_submit_button', 'submit', get_lang('Ok'), 'class="add"');
  27. if ($form->validate()) {
  28. $values = $form->exportValues();
  29. ClassManager::create_class($values['name']);
  30. header('Location: class_list.php');
  31. }
  32. // Displaying the header.
  33. Display :: display_header($tool_name);
  34. // Displaying the form.
  35. $form->display();
  36. // Displaying the footer.
  37. Display :: display_footer();