class_add.php 1.0 KB

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