usergroup_export.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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).'export.lib.inc.php';
  16. $tool_name = get_lang('Export');
  17. $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
  18. $interbreadcrumb[] = array ('url' => 'usergroups.php', 'name' => get_lang('Classes'));
  19. set_time_limit(0);
  20. $form = new FormValidator('export_users');
  21. $form->addElement('header', $tool_name);
  22. $form->addElement('style_submit_button', 'submit',get_lang('Export'),'class="save"');
  23. if ($form->validate()) {
  24. $user_group = new UserGroup;
  25. $header = array(array('name', 'description'));
  26. $data = $user_group->get_all_for_export();
  27. $data = array_merge($header, $data);
  28. $filename = 'export_classes_'.api_get_local_time();
  29. Export::export_table_csv($data,$filename);
  30. exit;
  31. }
  32. Display :: display_header($tool_name);
  33. $form->display();
  34. Display :: display_footer();