usergroup_export.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.admin
  5. */
  6. /**
  7. * Code
  8. */
  9. // name of the language file that needs to be included
  10. $language_file = 'admin';
  11. $cidReset = true;
  12. require_once '../inc/global.inc.php';
  13. $this_section = SECTION_PLATFORM_ADMIN;
  14. api_protect_admin_script();
  15. require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
  16. require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
  17. $tool_name = get_lang('Export');
  18. $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
  19. $interbreadcrumb[] = array ('url' => 'usergroups.php', 'name' => get_lang('Classes'));
  20. set_time_limit(0);
  21. $form = new FormValidator('export_users');
  22. $form->addElement('header', $tool_name);
  23. $form->addElement('style_submit_button', 'submit',get_lang('Export'),'class="save"');
  24. if ($form->validate()) {
  25. $user_group = new UserGroup;
  26. $header = array(array('name', 'description'));
  27. $data = $user_group->get_all_for_export();
  28. $data = array_merge($header, $data);
  29. $filename = 'export_classes_'.date('Y-m-d_H-i-s');
  30. Export::export_table_csv($data,$filename);
  31. }
  32. Display :: display_header($tool_name);
  33. $form->display();
  34. Display :: display_footer();