$exercise['iid'], 'text' => html_entity_decode($exercise['title'])]; } } echo json_encode($data); exit; break; } $userId = api_get_user_id(); $origin = api_get_origin(); $TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); $TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $TBL_TRACK_ATTEMPT_RECORDING = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); $TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW); $allowCoachFeedbackExercises = api_get_setting('allow_coach_feedback_exercises') === 'true'; $documentPath = null; if (!empty($_GET['path'])) { $parameters['path'] = Security::remove_XSS($_GET['path']); } if (!empty($_REQUEST['export_report']) && $_REQUEST['export_report'] == '1') { if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_session_general_coach() || api_is_session_admin() ) { $loadExtraData = false; if (isset($_REQUEST['extra_data']) && $_REQUEST['extra_data'] == 1) { $loadExtraData = true; } $includeAllUsers = false; if (isset($_REQUEST['include_all_users']) && $_REQUEST['include_all_users'] == 1 ) { $includeAllUsers = true; } $onlyBestAttempts = false; if (isset($_REQUEST['only_best_attempts']) && $_REQUEST['only_best_attempts'] == 1 ) { $onlyBestAttempts = true; } require_once 'exercise_result.class.php'; $export = new ExerciseResult(); $export->setIncludeAllUsers($includeAllUsers); $export->setOnlyBestAttempts($onlyBestAttempts); switch ($_GET['export_format']) { case 'xls': $export->exportCompleteReportXLS( $documentPath, null, $loadExtraData, null, $exerciseId ); exit; break; case 'csv': default: $export->exportCompleteReportCSV( $documentPath, null, $loadExtraData, null, $exerciseId ); exit; break; } } else { api_not_allowed(true); } } $htmlHeadXtra[] = ''; if ($exportXls) { ExerciseLib::exportPendingAttemptsToExcel($_REQUEST); } Display::display_header(get_lang('PendingAttempts')); $actions = ''; $actions .= Display::url( Display::return_icon('excel.png', get_lang('ExportAsXLS'), [], ICON_SIZE_MEDIUM), '#', ['id' => 'export-xls'] ); echo Display::div($actions, ['class' => 'actions']); $token = Security::get_token(); $extra = ''; $extra .= '
'; $form = new FormValidator( 'report', 'post', null, null, ['class' => 'form-vertical'] ); $form->addElement( 'radio', 'export_format', null, get_lang('ExportAsCSV'), 'csv', ['id' => 'export_format_csv_label'] ); $form->addElement( 'radio', 'export_format', null, get_lang('ExportAsXLS'), 'xls', ['id' => 'export_format_xls_label'] ); $form->addElement( 'checkbox', 'load_extra_data', null, get_lang('LoadExtraData'), '0', ['id' => 'export_format_xls_label'] ); $form->addElement( 'checkbox', 'include_all_users', null, get_lang('IncludeAllUsers'), '0' ); $form->addElement( 'checkbox', 'only_best_attempts', null, get_lang('OnlyBestAttempts'), '0' ); $form->setDefaults(['export_format' => 'csv']); $extra .= $form->returnForm(); $extra .= '
'; echo $extra; $showAttemptsInSessions = api_get_configuration_value('show_exercise_attempts_in_all_user_sessions'); $courses = CourseManager::get_courses_list_by_user_id($userId, $showAttemptsInSessions, false, false); $form = new FormValidator('pending', 'GET'); $courses = array_column($courses, 'title', 'real_id'); $form->addSelect('course_id', get_lang('Course'), $courses, ['placeholder' => get_lang('All'), 'id' => 'course_id']); $form->addSelect( 'exercise_id', get_lang('Exercise'), [], [ 'placeholder' => get_lang('All'), 'id' => 'exercise_id', ] ); $status = [ 1 => get_lang('All'), 2 => get_lang('Validated'), 3 => get_lang('NotValidated'), 4 => get_lang('Unclosed'), 5 => get_lang('Ongoing'), ]; $form->addSelect('status', get_lang('Status'), $status); $questionType = [ 0 => get_lang('All'), 1 => get_lang('QuestionsWithNoAutomaticCorrection'), ]; $form->addSelect('questionTypeId', get_lang('QuestionType'), $questionType); $form->addButtonSearch(get_lang('Search'), 'pendingSubmit'); $content = $form->returnForm(); echo $content; if (empty($statusId)) { Display::display_footer(); exit; } $url = api_get_path(WEB_AJAX_PATH). 'model.ajax.php?a=get_exercise_pending_results&filter_by_user='.$filter_user. '&course_id='.$courseId.'&exercise_id='.$exerciseId.'&status='.$statusId.'&questionType='.$questionTypeId.'&showAttemptsInSessions='.$showAttemptsInSessions; $action_links = ''; $officialCodeInList = api_get_setting('show_official_code_exercise_result_list'); // The order is important you need to check the the $column variable in the model.ajax.php file $columns = [ get_lang('Course'), get_lang('Exercise'), get_lang('FirstName'), get_lang('LastName'), get_lang('LoginName'), get_lang('Duration').' ('.get_lang('MinMinute').')', get_lang('StartDate'), get_lang('EndDate'), get_lang('Score'), get_lang('IP'), get_lang('Status'), get_lang('Corrector'), get_lang('CorrectionDate'), get_lang('Actions'), ]; if ($officialCodeInList === 'true') { $columns = array_merge([get_lang('OfficialCode')], $columns); } // Column config $column_model = [ ['name' => 'course', 'index' => 'course', 'width' => '50', 'align' => 'left', 'search' => 'false', 'sortable' => 'false'], ['name' => 'exercise', 'index' => 'exercise', 'width' => '50', 'align' => 'left', 'search' => 'false', 'sortable' => 'false'], ['name' => 'firstname', 'index' => 'firstname', 'width' => '50', 'align' => 'left', 'search' => 'true'], [ 'name' => 'lastname', 'index' => 'lastname', 'width' => '50', 'align' => 'left', 'formatter' => 'action_formatter', 'search' => 'true', ], [ 'name' => 'login', 'index' => 'username', 'width' => '40', 'align' => 'left', 'search' => 'true', 'hidden' => api_get_configuration_value('exercise_attempts_report_show_username') ? 'false' : 'true', ], ['name' => 'duration', 'index' => 'exe_duration', 'width' => '30', 'align' => 'left', 'search' => 'true'], ['name' => 'start_date', 'index' => 'start_date', 'width' => '60', 'align' => 'left', 'search' => 'true'], ['name' => 'exe_date', 'index' => 'exe_date', 'width' => '60', 'align' => 'left', 'search' => 'true'], ['name' => 'score', 'index' => 'exe_result', 'width' => '50', 'align' => 'center', 'search' => 'true'], ['name' => 'ip', 'index' => 'user_ip', 'width' => '40', 'align' => 'center', 'search' => 'true'], [ 'name' => 'status', 'index' => 'revised', 'width' => '40', 'align' => 'left', 'search' => 'false', 'sortable' => 'false', //'stype' => 'select', //for the bottom bar /*'searchoptions' => [ 'defaultValue' => '', 'value' => ':'.get_lang('All').';1:'.get_lang('Validated').';0:'.get_lang('NotValidated'), ],*/ //for the top bar /*'editoptions' => [ 'value' => ':'.get_lang('All').';1:'.get_lang('Validated').';0:'.get_lang('NotValidated'), ],*/ ], [ 'name' => 'qualificator_fullname', 'index' => 'qualificator_fullname', 'width' => '20', 'align' => 'left', 'search' => 'true', ], [ 'name' => 'date_of_qualification', 'index' => 'date_of_qualification', 'width' => '20', 'align' => 'left', 'search' => 'true', ], [ 'name' => 'actions', 'index' => 'actions', 'width' => '60', 'align' => 'left', 'search' => 'false', 'sortable' => 'false', ], ]; if ('true' === $officialCodeInList) { $officialCodeRow = [ 'name' => 'official_code', 'index' => 'official_code', 'width' => '50', 'align' => 'left', 'search' => 'true', ]; $column_model = array_merge([$officialCodeRow], $column_model); } $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('LoginX'), ':::'), ENT_QUOTES).'"; var tabLoginx = loginx.split(/:::/); // tabLoginx[0] is before and tabLoginx[1] is after ::: // may be empty string but is defined return ""+cellvalue+""; }'; $extra_params['autowidth'] = 'true'; $extra_params['height'] = 'auto'; $gridJs = Display::grid_js( 'results', $url, $columns, $column_model, $extra_params, [], $action_links, true ); ?>