class_edit.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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('AdminClasses'));
  23. // Setting the name of the tool.
  24. $tool_name = get_lang('AddClasses');
  25. $tool_name = get_lang('ModifyClassInfo');
  26. $class_id = intval($_GET['idclass']);
  27. $class = ClassManager :: get_class_info($class_id);
  28. $form = new FormValidator('edit_class', 'post', 'class_edit.php?idclass='.$class_id);
  29. $form->add_textfield('name',get_lang('ClassName'));
  30. $form->addElement('style_submit_button', 'submit', get_lang('Ok'), 'class="add"');
  31. $form->setDefaults(array('name'=>$class['name']));
  32. if($form->validate())
  33. {
  34. $values = $form->exportValues();
  35. ClassManager :: set_name($values['name'], $class_id);
  36. header('Location: class_list.php');
  37. }
  38. Display :: display_header($tool_name);
  39. //api_display_tool_title($tool_name);
  40. $form->display();
  41. // Displaying the footer.
  42. Display :: display_footer();