get_item_id_from_field_variable_and_field_value(
'group_id',
$groupId,
false,
false,
true
);
if (!empty($surveyList)) {
$exportList = [];
foreach ($surveyList as $data) {
$surveyId = $data['item_id'];
$surveyData = SurveyManager::get_survey($surveyId, 0, api_get_course_id());
if (!empty($surveyData)) {
$filename = $surveyData['code'].'.xlsx';
$exportList[] = @SurveyUtil::export_complete_report_xls($surveyData, $filename, 0, true);
}
}
throw new Exception('export_surveys');
/*if (!empty($exportList)) {
$tempZipFile = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().'.zip';
$zip = new PclZip($tempZipFile);
foreach ($exportList as $file) {
$zip->add($file, PCLZIP_OPT_REMOVE_ALL_PATH);
}
DocumentManager::file_send_for_download(
$tempZipFile,
true,
get_lang('Surveys').'-'.api_get_course_id().'-'.api_get_local_time().'.zip'
);
unlink($tempZipFile);
exit;
}*/
}
Display::addFlash(Display::return_message(get_lang('NoSurveyAvailable')));
header('Location: '.api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq());
exit;
break;
case 'export_all':
$data = GroupManager::exportCategoriesAndGroupsToArray(null, true);
Export::arrayToCsv($data);
exit;
break;
case 'export_pdf':
$content = GroupManager::getOverview($course, $keyword);
$pdf = new PDF();
$extra = '
'.get_lang('Groups list').'
';
$extra .= ''.get_lang('Course').': '.$course->getTitle().' ('.$course->getCode().')';
$content = $extra.$content;
$pdf->content_to_pdf($content, null, null, api_get_course_id());
break;
case 'export':
$data = GroupManager::exportCategoriesAndGroupsToArray($groupId, true);
switch ($_GET['type']) {
case 'csv':
Export::arrayToCsv($data);
exit;
break;
case 'xls':
if (!empty($data)) {
Export::arrayToXls($data);
exit;
}
break;
}
break;
}
}
$interbreadcrumb[] = ['url' => 'group.php?'.api_get_cidreq(), 'name' => get_lang('Groups')];
$origin = api_get_origin();
if ('learnpath' !== $origin) {
// So we are not in learnpath tool
if (!api_is_allowed_in_course()) {
api_not_allowed(true);
}
if (!api_is_allowed_to_edit(false, true)) {
api_not_allowed(true);
} else {
Display::display_header($nameTools, 'Group');
Display::display_introduction_section(TOOL_GROUP);
}
} else {
Display::display_reduced_header();
}
$actions = ''.
Display::getMdiIcon(ActionIcon::ADD, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Create new group(s)')).'';
if ('true' === api_get_setting('allow_group_categories')) {
$actions .= ''.
Display::getMdiIcon(ActionIcon::CREATE_CATEGORY, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Add category')).'';
} else {
$actions .= ''.
Display::getMdiIcon(ActionIcon::CONFIGURE, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Edit settings')).'';
}
$actions .= ''.
Display::getMdiIcon(ActionIcon::IMPORT_ARCHIVE, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Import')).'';
$actions .= ''.
Display::getMdiIcon(ActionIcon::EXPORT_CSV, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Export')).'';
$actions .= ''.
Display::getMdiIcon(ActionIcon::EXPORT_SPREADSHEET, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Excel export')).'';
$actions .= ''.
Display::getMdiIcon(ActionIcon::EXPORT_PDF, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Export to PDF')).'';
$actions .= ''.
Display::getMdiIcon(ToolIcon::GROUP, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Groups')).'';
$actions .= ''.
Display::getMdiIcon(ToolIcon::MEMBER, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Go to').' '.get_lang('Users')).'';
// Action links
echo Display::toolbarAction('actions', [$actions, GroupManager::getSearchForm()]);
echo GroupManager::getOverview($course, $keyword);
if ('learnpath' !== $origin) {
Display::display_footer();
}