} if (isset($csv)) { header("Content-type: application/csv"); header('Content-Disposition: attachment; filename="' . $csvFileName . '.csv"'); echo $csv; exit; } } $out = ''; // display title $titleTab['mainTitle'] = $nameTools; $titleTab['subTitle'] = $exercise->getTitle(); $out .= claro_html_tool_title($titleTab); if (get_conf('is_trackingEnabled')) { // get global infos about scores in the exercise $sql = "SELECT MIN(TEX.`result`) AS `minimum`,\n MAX(TEX.`result`) AS `maximum`,\n AVG(TEX.`result`) AS `average`,\n MAX(TEX.`weighting`) AS `weighting` ,\n COUNT(DISTINCT TEX.`user_id`) AS `users`,\n COUNT(TEX.`user_id`) AS `tusers`,\n AVG(`TEX`.`time`) AS `avgTime`\n FROM `" . $tbl_qwz_tracking . "` AS TEX\n WHERE TEX.`exo_id` = " . (int) $exercise->getId() . "\n AND TEX.`user_id` IS NOT NULL"; $exo_scores_details = claro_sql_query_get_single_row($sql); if (!isset($exo_scores_details['minimum'])) { $exo_scores_details['minimum'] = 0; $exo_scores_details['maximum'] = 0; $exo_scores_details['average'] = 0; } else { // round average number for a better display $exo_scores_details['average'] = round($exo_scores_details['average'] * 100) / 100; } if (isset($exo_score_details['weighting']) || $exo_scores_details['weighting'] != '') { $displayedWeighting = '/' . $exo_scores_details['weighting']; } else { $displayedWeighting = ''; } $out .= '<ul>' . "\n" . '<li>' . get_lang('Worst score') . ' : ' . $exo_scores_details['minimum'] . $displayedWeighting . '</li>' . "\n" . '<li>' . get_lang('Best score') . ' : ' . $exo_scores_details['maximum'] . $displayedWeighting . '</li>' . "\n" . '<li>' . get_lang('Average score') . ' : ' . $exo_scores_details['average'] . $displayedWeighting . '</li>' . "\n" . '<li>' . get_lang('Average Time') . ' : ' . claro_html_duration(floor($exo_scores_details['avgTime'])) . '</li>' . "\n" . '</ul>' . "\n\n" . '<ul>' . "\n" . '<li>' . get_lang('User attempts') . ' : ' . $exo_scores_details['users'] . '</li>' . "\n" . '<li>' . get_lang('Total attempts') . ' : ' . $exo_scores_details['tusers'] . '</li>' . "\n" . '</ul>' . "\n\n";
if ($cmd == 'exMkInvis' && $exId) { Exercise::updateExerciseVisibility($exId, 'INVISIBLE'); $eventNotifier->notifyCourseEvent("exercise_invisible", claro_get_current_course_id(), claro_get_current_tool_id(), $exId, claro_get_current_group_id(), "0"); $eventNotifier->notifyCourseEvent("exercise_updated", claro_get_current_course_id(), claro_get_current_tool_id(), $exId, claro_get_current_group_id(), "0"); } } // Save question list if ($cmd == 'exSaveQwz') { if (is_null($exId)) { $dialogBox->error(get_lang('Error : unable to save the questions list')); } else { $exercise = new Exercise(); if (!$exercise->load($exId)) { $dialogBox->error(get_lang('Error: unable to load exercise')); } elseif (isset($_SESSION['lastRandomQuestionList'])) { if (!$exercise->saveRandomQuestionList($_SESSION['_user']['userId'], $exercise->getId(), @unserialize($_SESSION['lastRandomQuestionList']))) { $dialogBox->error(get_lang('Error: unable to save this questions list')); } else { $dialogBox->success(get_lang('The list of questions has been saved')); } unset($_SESSION['lastRandomQuestionList']); } else { $dialogBox->error(get_lang('Error: no questions list in memory')); } } } /* * Get list */ // pager initialisation if (!isset($_REQUEST['offset'])) {