usergroup_export.php 1.2 KB

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