usergroup_export.php 1017 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. use Chamilo\CoreBundle\Framework\Container;
  4. /**
  5. * @package chamilo.admin
  6. */
  7. $cidReset = true;
  8. $this_section = SECTION_PLATFORM_ADMIN;
  9. api_protect_admin_script();
  10. $tool_name = get_lang('Export');
  11. $interbreadcrumb[] = array('url' => Container::getRouter()->generate('administration') , "name" => get_lang('PlatformAdmin'));
  12. $interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
  13. set_time_limit(0);
  14. $form = new FormValidator('export_users');
  15. $form->addElement('header', $tool_name);
  16. $form->addButtonExport(get_lang('Export'));
  17. if ($form->validate()) {
  18. $userGroup = new UserGroup();
  19. $header = array(array('id', 'name', 'description', 'users'));
  20. $data = $userGroup->getDataToExport();
  21. $data = array_merge($header, $data);
  22. $filename = 'export_classes_'.api_get_local_time();
  23. Export::arrayToCsv($data, $filename);
  24. exit;
  25. }
  26. Display :: display_header($tool_name);
  27. $form->display();
  28. Display::display_footer();