exportCompleteReportCSV($documentPath, $hotpotatoes_path); exit; } else { api_not_allowed(true); } } $actions = null; if ($is_allowedToEdit && $origin != 'learnpath') { // the form if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_session_general_coach()) { $actions .= ''. Display::return_icon('save.png', get_lang('Export'), '', ICON_SIZE_MEDIUM).''; } } else { $actions .= ''. Display::return_icon('back.png', get_lang('Go back to the questions list'), '', ICON_SIZE_MEDIUM).''; } if ($is_allowedToEdit) { $action = isset($_GET['action']) ? $_GET['action'] : null; switch ($action) { case 'delete': $fileToDelete = isset($_GET['id']) ? $_GET['id'] : null; deleteAttempt($fileToDelete); Display::addFlash(Display::return_message(get_lang('Item deleted'))); $url = api_get_self().'?'.api_get_cidreq().'&path='.$hotpotatoes_path; header("Location: $url"); exit; break; } } $nameTools = get_lang('Results and feedback'); if ($is_allowedToEdit || $is_tutor) { $nameTools = get_lang('Learner score'); $interbreadcrumb[] = ["url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Tests')]; $objExerciseTmp = new Exercise(); } else { $interbreadcrumb[] = ["url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Tests')]; $objExerciseTmp = new Exercise(); } Display :: display_header($nameTools); $actions = Display::div($actions, ['class' => 'actions']); $extra = ''; $extra .= '
'; $form = new FormValidator('report', 'post', null, null, ['class' => 'form-vertical']); $form->addElement('radio', 'export_format', null, get_lang('CSV export'), 'csv', ['id' => 'export_format_csv_label']); //$form->addElement('radio', 'export_format', null, get_lang('Excel export'), 'xls', array('id' => 'export_format_xls_label')); //$form->addElement('checkbox', 'load_extra_data', null, get_lang('Load extra user fields data (have to be marked as 'Filter' to appear).'), '0', array('id' => 'export_format_xls_label')); $form->setDefaults(['export_format' => 'csv']); $extra .= $form->returnForm(); $extra .= '
'; if ($is_allowedToEdit) { echo $extra; } echo $actions; $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_hotpotatoes_exercise_results&path='.$hotpotatoes_path.'&filter_by_user='.$filter_user; $action_links = ''; // Generating group list $group_list = GroupManager::get_group_list(); $group_parameters = ['group_all:'.get_lang('All'), 'group_none:'.get_lang('none')]; foreach ($group_list as $group) { $group_parameters[] = $group['id'].':'.$group['name']; } if (!empty($group_parameters)) { $group_parameters = implode(';', $group_parameters); } if ($is_allowedToEdit || $is_tutor) { // The order is important you need to check the the $column variable in the model.ajax.php file $columns = [ get_lang('First name'), get_lang('Last name'), get_lang('Login'), get_lang('Group'), get_lang('Start Date'), get_lang('Score'), get_lang('Detail'), ]; // Column config // @todo fix search firstname/lastname that doesn't work. rmove search for the moment $column_model = [ ['name' => 'firstname', 'index' => 'firstname', 'width' => '50', 'align' => 'left', 'search' => 'false'], [ 'name' => 'lastname', 'index' => 'lastname', 'width' => '50', 'align' => 'left', 'formatter' => 'action_formatter', 'search' => 'false', ], [ 'name' => 'login', 'hidden' => 'true', 'index' => 'username', 'width' => '40', 'align' => 'left', 'search' => 'false', ], ['name' => 'group_name', 'index' => 'group_id', 'width' => '40', 'align' => 'left', 'search' => 'false'], ['name' => 'exe_date', 'index' => 'exe_date', 'width' => '60', 'align' => 'left', 'search' => 'false'], ['name' => 'score', 'index' => 'score', 'width' => '50', 'align' => 'left', 'search' => 'false'], ['name' => 'actions', 'index' => 'actions', 'width' => '60', 'align' => 'left', 'search' => 'false'], ]; $action_links = ' // add username as title in lastname filed - ref 4226 function action_formatter(cellvalue, options, rowObject) { // rowObject is firstname,lastname,login,... get the third word var loginx = "'.api_htmlentities(sprintf(get_lang("Login: %s"), ":::"), ENT_QUOTES).'"; var tabLoginx = loginx.split(/:::/); // tabLoginx[0] is before and tabLoginx[1] is after ::: // may be empty string but is defined return ""+cellvalue+""; }'; } else { //The order is important you need to check the the $column variable in the model.ajax.php file $columns = [ get_lang('Start Date'), get_lang('Score'), get_lang('Detail'), ]; //Column config // @todo fix search firstname/lastname that doesn't work. rmove search for the moment $column_model = [ ['name' => 'exe_date', 'index' => 'exe_date', 'width' => '60', 'align' => 'left', 'search' => 'false'], ['name' => 'score', 'index' => 'score', 'width' => '50', 'align' => 'left', 'search' => 'false'], ['name' => 'actions', 'index' => 'actions', 'width' => '60', 'align' => 'left', 'search' => 'false'], ]; } //Autowidth $extra_params['autowidth'] = 'true'; //height auto $extra_params['height'] = 'auto'; ?>