Adding report by question page see #3864

skala
Julio Montoya 13 years ago
parent 9718b57562
commit 3783b375de
  1. 29
      main/exercice/exercise_report.php
  2. 21
      main/exercice/stats.php
  3. 13
      main/inc/lib/template.lib.php
  4. 2
      main/user/subscribe_user.php

@ -67,6 +67,11 @@ if (empty($exercise_id)) {
api_not_allowed(); api_not_allowed();
} }
if (!empty($exercise_id))
$parameters['exerciseId'] = $exercise_id;
if (!empty($_GET['path'])) {
$parameters['path'] = Security::remove_XSS($_GET['path']);
}
// filter display by student group // filter display by student group
// if $_GET['filterByGroup'] = -1 => do not filter // if $_GET['filterByGroup'] = -1 => do not filter
@ -266,7 +271,6 @@ if ($_GET['delete'] == 'delete' && ($is_allowedToEdit || api_is_coach()) && !emp
exit; exit;
} }
if (api_is_allowed_to_edit(null,true)) { if (api_is_allowed_to_edit(null,true)) {
if (!$_GET['filter']) { if (!$_GET['filter']) {
$filter_by_not_revised = true; $filter_by_not_revised = true;
@ -286,6 +290,13 @@ if (api_is_allowed_to_edit(null,true)) {
default : default :
null; null;
} }
//Report by question
$actions .= Display::url(Display::return_icon('statistics_admin.gif', get_lang("ReportByQuestion")), 'stats.php?exerciseId='.$exercise_id);
//Live results
$actions .='<a href="live_stats.php?' . api_get_cidreq() . '&exerciseId='.$exercise_id.'">'.Display :: return_icon('activity_monitor.png', get_lang('LiveResults'),'',32).'</a>';
if (!empty($_GET['exerciseId']) && empty($_GET['filter_by_user'])) { if (!empty($_GET['exerciseId']) && empty($_GET['filter_by_user'])) {
if ($_GET['filter'] == '1' or !isset ($_GET['filter']) or $_GET['filter'] == 0 ) { if ($_GET['filter'] == '1' or !isset ($_GET['filter']) or $_GET['filter'] == 0 ) {
$view_result = '<a href="' . api_get_self() . '?cidReq=' . api_get_course_id() . '&filter=2&id_session='.intval($_GET['id_session']).'&exerciseId='.intval($_GET['exerciseId']).'&gradebook='.$gradebook.'" >'.Display :: return_icon('exercice_check.png', get_lang('ShowCorrectedOnly'),'','32').'</a>'; $view_result = '<a href="' . api_get_self() . '?cidReq=' . api_get_course_id() . '&filter=2&id_session='.intval($_GET['id_session']).'&exerciseId='.intval($_GET['exerciseId']).'&gradebook='.$gradebook.'" >'.Display :: return_icon('exercice_check.png', get_lang('ShowCorrectedOnly'),'','32').'</a>';
@ -293,14 +304,12 @@ if (api_is_allowed_to_edit(null,true)) {
$view_result = '<a href="' .api_get_self() . '?cidReq=' . api_get_course_id() . '&filter=1&id_session='.intval($_GET['id_session']).'&exerciseId='.intval($_GET['exerciseId']).'&gradebook='.$gradebook.'" >'.Display :: return_icon('exercice_uncheck.png', get_lang('ShowUnCorrectedOnly'),'','32').'</a>'; $view_result = '<a href="' .api_get_self() . '?cidReq=' . api_get_course_id() . '&filter=1&id_session='.intval($_GET['id_session']).'&exerciseId='.intval($_GET['exerciseId']).'&gradebook='.$gradebook.'" >'.Display :: return_icon('exercice_uncheck.png', get_lang('ShowUnCorrectedOnly'),'','32').'</a>';
} }
$actions .= $view_result; $actions .= $view_result;
//
// filter by student group menu // filter by student group menu
//
$exercice_id = intval($_GET['exerciseId']);
$actions .= "<script type='text/javascript'>"; $actions .= "<script type='text/javascript'>";
$actions .= " function doFilterByGroup() {"; $actions .= " function doFilterByGroup() {";
$actions .= " var IdGroup = document.getElementById('groupFilter').value;"; $actions .= " var IdGroup = document.getElementById('groupFilter').value;";
$actions .= " var goToUrl = \"".api_get_self()."?".api_get_cidreq()."&filter=$filter&gradebook=$gradebook&exerciseId=$exercice_id;$quiz_results_per_page&filterByGroup=\"+IdGroup;"; $actions .= " var goToUrl = \"".api_get_self()."?".api_get_cidreq()."&filter=$filter&gradebook=$gradebook&exerciseId=$exercise_id;$quiz_results_per_page&filterByGroup=\"+IdGroup;";
$actions .= " self.location.href=goToUrl;"; $actions .= " self.location.href=goToUrl;";
$actions .= " }"; $actions .= " }";
$actions .= " </script>"; $actions .= " </script>";
@ -308,19 +317,11 @@ if (api_is_allowed_to_edit(null,true)) {
$actions .= Display::return_icon('group.gif', get_lang("FilterByGroup")); $actions .= Display::return_icon('group.gif', get_lang("FilterByGroup"));
$actions .= displayGroupMenu("groupFilter", $filterByGroup, "doFilterByGroup()")."&nbsp;"; $actions .= displayGroupMenu("groupFilter", $filterByGroup, "doFilterByGroup()")."&nbsp;";
} }
//Live results
$actions .='<a href="live_stats.php?' . api_get_cidreq() . '&exerciseId='.$exercise_id.'">'.Display :: return_icon('activity_monitor.png', get_lang('LiveResults'),'',32).'</a>';
}
}
$parameters=array('cidReq'=>Security::remove_XSS($_GET['cidReq']),'filter' => Security::remove_XSS($_GET['filter']),'gradebook' =>Security::remove_XSS($_GET['gradebook'])); $parameters=array('cidReq'=>Security::remove_XSS($_GET['cidReq']),'filter' => Security::remove_XSS($_GET['filter']),'gradebook' =>Security::remove_XSS($_GET['gradebook']));
if (!empty($exercise_id))
$parameters['exerciseId'] = $exercise_id;
if (!empty($_GET['path'])) {
$parameters['path'] = Security::remove_XSS($_GET['path']);
}
$table = new SortableTable('quiz_results', 'get_count_exam_results', 'get_exam_results_data', 1, 10); $table = new SortableTable('quiz_results', 'get_count_exam_results', 'get_exam_results_data', 1, 10);
$table->set_additional_parameters($parameters); $table->set_additional_parameters($parameters);

@ -8,6 +8,7 @@ $language_file = array('exercice', 'tracking');
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
require_once 'exercise.lib.php'; require_once 'exercise.lib.php';
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
$exercise_id = (isset($_GET['exerciseId']) && !empty($_GET['exerciseId'])) ? intval($_GET['exerciseId']) : 0; $exercise_id = (isset($_GET['exerciseId']) && !empty($_GET['exerciseId'])) ? intval($_GET['exerciseId']) : 0;
$objExercise = new Exercise(); $objExercise = new Exercise();
@ -29,7 +30,7 @@ $headers = array(
get_lang('LowestScore'), get_lang('LowestScore'),
get_lang('AverageScore'), get_lang('AverageScore'),
get_lang('HighestScore'), get_lang('HighestScore'),
get_lang('MaximumScore') get_lang('Weighting')
); );
if (!empty($question_list)) { if (!empty($question_list)) {
@ -39,10 +40,10 @@ if (!empty($question_list)) {
$data[$question_id]['name'] = cut($question_obj->question, 100); $data[$question_id]['name'] = cut($question_obj->question, 100);
$data[$question_id]['students_who_try_exercise'] = $exercise_stats['users']; $data[$question_id]['students_who_try_exercise'] = $exercise_stats['users'];
$data[$question_id]['lowest_score'] = $exercise_stats['min']; $data[$question_id]['lowest_score'] = round($exercise_stats['min'], 2);
$data[$question_id]['average_score'] = $exercise_stats['average']; $data[$question_id]['average_score'] = round($exercise_stats['average'], 2);
$data[$question_id]['highest_score'] = $exercise_stats['max']; $data[$question_id]['highest_score'] = round($exercise_stats['max'], 2);
$data[$question_id]['max_score'] = $question_obj->weighting; $data[$question_id]['max_score'] = round($question_obj->weighting, 2);
} }
} }
@ -80,6 +81,14 @@ $headers = array(
$interbreadcrumb[] = array ("url" => "exercice.php?gradebook=$gradebook", "name" => get_lang('Exercices')); $interbreadcrumb[] = array ("url" => "exercice.php?gradebook=$gradebook", "name" => get_lang('Exercices'));
$interbreadcrumb[] = array ("url" => "admin.php?exerciseId=$exercise_id","name" => $objExercise->name); $interbreadcrumb[] = array ("url" => "admin.php?exerciseId=$exercise_id","name" => $objExercise->name);
$tpl = new Template(get_lang('Stats')); $tpl = new Template(get_lang('ReportByQuestion'));
//$actions = array();
//$actions[]= array(get_lang('Back'), Display::return_icon('back.png', get_lang('Back'), 'exercise_report.php?'.$exercise_id));
//$tpl->set_actions($actions);
$actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'">' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'','32').'</a>';
$actions = Display::div($actions, array('class'=> 'actions'));
$content = $actions.$content;
$tpl->assign('content', $content); $tpl->assign('content', $content);
$tpl->display_one_col_template(); $tpl->display_one_col_template();

@ -53,6 +53,19 @@ class Template extends Smarty {
$this->assign('style', $this->style); $this->assign('style', $this->style);
} }
/*
* Use smarty to parse the actions menu
* @todo finish it!
* */
function set_actions($actions) {
$action_string = '';
if (!empty($actions)) {
foreach($actions as $action) {
}
}
$this->assign('actions', $actions);
}
/** /**
* Shortcut to display a 1 col layout (index.php) * Shortcut to display a 1 col layout (index.php)
* */ * */

@ -643,7 +643,7 @@ function email_filter($email) {
*/ */
function reg_filter($user_id) { function reg_filter($user_id) {
if(isset($_REQUEST['type']) && $_REQUEST['type']=='teacher') $type='teacher'; else $type='student'; if(isset($_REQUEST['type']) && $_REQUEST['type']=='teacher') $type='teacher'; else $type='student';
$result = '<a class="a_button orange small" href="'.api_get_self().'?register=yes&type='.$type.'&user_id='.$user_id.'">'.get_lang("reg").'</a>'; $result = '<a class="a_button white small" href="'.api_get_self().'?register=yes&type='.$type.'&user_id='.$user_id.'">'.get_lang("reg").'</a>';
return $result; return $result;
} }

Loading…
Cancel
Save