Adding export user-class to csv see BT#8157

1.9.x
Julio Montoya 11 years ago
parent cb1df90ba8
commit fbda6e234d
  1. 23
      main/admin/add_users_to_usergroup.php

@ -87,7 +87,7 @@ function change_select(val) {
$form_sent = 0;
$errorMsg = '';
$extra_field_list= UserManager::get_extra_fields();
$extra_field_list = UserManager::get_extra_fields();
$new_field_list = array();
if (is_array($extra_field_list)) {
foreach ($extra_field_list as $extra_field) {
@ -125,6 +125,24 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
}
}
if (isset($_GET['action']) && $_GET['action'] == 'export') {
$groupInfo = $usergroup->get($id);
$users = $usergroup->getUserListByUserGroup($id);
if (!empty($users)) {
require_once api_get_path(LIBRARY_PATH) . 'export.lib.inc.php';
$data = array(
array('UserName', 'ClassName')
);
foreach ($users as $user) {
$data[] = array($user['username'], $groupInfo['name']);
}
$filename = 'export_user_class_' . api_get_local_time();
Export::export_table_csv($data, $filename);
exit;
}
}
//Filter by Extra Fields
$use_extra_fields = false;
@ -280,6 +298,9 @@ echo Display::url(get_lang('AdvancedSearch'), '#', array('class' => 'advanced_op
echo '<a href="usergroup_user_import.php">'.
Display::return_icon('import_csv.png', get_lang('Import'), array(), ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_self().'?id='.$id.'&action=export">'.
Display::return_icon('export_csv.png', get_lang('Export'), array(), ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
echo '<div id="advanced_search_options" style="display:none">';

Loading…
Cancel
Save