Skip to content
Browse files

*** empty log message ***

  • Loading branch information...
1 parent edc2913 commit 083fc55c3e89c08fd8a677df96e9f214789d6254 ecastrolt committed May 29, 2005
Showing with 33 additions and 30 deletions.
  1. +33 −30 mod/quiz/report/analysis/report.php
View
63 mod/quiz/report/analysis/report.php
@@ -8,17 +8,12 @@
class quiz_report extends quiz_default_report {
function display($quiz, $cm, $course) { /// This function just displays the report
-
global $CFG, $SESSION, $db, $QUIZ_QTYPES;
- define('QUIZ_ALLATTEMPTS', 0);
- define('QUIZ_HIGHESTATTEMPT', 1);
- define('QUIZ_FIRSTATTEMPT', 2);
- define('QUIZ_LASTATTEMPT', 3);
-
$strnoquiz = get_string('noquiz','quiz');
$strnoattempts = get_string('noattempts','quiz');
if (!$quiz->questions) {
+ $this->print_header_and_tabs($cm, $course, $quiz, $reportmode="analysis");
print_heading($strnoattempts);
return true;
}
@@ -39,6 +34,7 @@ function display($quiz, $cm, $course) { /// This function just displays the
}
if(empty($users)) {
+ $this->print_header_and_tabs($cm, $course, $quiz, $reportmode="analysis");
print_heading($strnoattempts);
return true;
}
@@ -92,7 +88,7 @@ function display($quiz, $cm, $course) { /// This function just displays the
if(empty($attempts)) {
$this->print_header_and_tabs($cm, $course, $quiz, $reportmode="analysis");
- print_heading($strnoattempts);
+ ($strnoattempts);
$this->print_options_form($quiz, $cm, $attemptselection, $lowmarklimit, $pagesize);
return true;
}
@@ -133,7 +129,10 @@ function display($quiz, $cm, $course) { /// This function just displays the
}
$numbers = explode(',', $questionlist);
$statsrow = array();
- foreach ($numbers as $i) {
+ foreach ($numbers as $i) {
+ if (!isset($quizquestions[$i]) or !isset($states[$i])) {
+ continue;
+ }
$qtype = ($quizquestions[$i]->qtype==4) ? $states[$i]->options->question->qtype : $quizquestions[$i]->qtype;
if (!in_array ($qtype, $accepted_qtypes)){
continue;
@@ -224,7 +223,7 @@ function display($quiz, $cm, $course) { /// This function just displays the
$table->sortable(true);
$table->collapsible(true);
- $table->initialbars(true);
+ $table->initialbars(false);
$table->column_class('id', 'numcol');
$table->column_class('credits', 'numcol');
@@ -306,8 +305,8 @@ function display($quiz, $cm, $course) { /// This function just displays the
} else {
$qclass = 'partialcorrect';
}
- $response->credit = " (".format_float($q['credits'][$aid],2).") ";
- $response->text = format_text("$resp", FORMAT_MOODLE, $format_options, $quiz->course);
+ $response->credit = '<span class="'.$qclass.'">('.format_float($q['credits'][$aid],2).') </span>';
+ $response->text = '<span class="'.$qclass.'">'.format_text("$resp", FORMAT_MOODLE, $format_options, $quiz->course).' </span>';
$count = $q['rcounts'][$aid].'/'.$q['count'];
$response->rcount = $count; // format_text("$count", FORMAT_MOODLE, $format_options, $quiz->course);
$response->rpercent = '('.format_float($q['rcounts'][$aid]/$q['count']*100,0).'%)';
@@ -318,17 +317,11 @@ function display($quiz, $cm, $course) { /// This function just displays the
$qsd = format_float($q['qsd'],3);
$di = format_float($q['disc_index'],2);
$dc = format_float($q['disc_coeff'],2);
-
- foreach($responses as $response) {
- $table->add_data(array($qnumber."\n<br>".$qicon."\n ".$qreview, $qquestion, $response->text, $response->credit, $response->rcount, $response->rpercent, $facility, $qsd, $di, $dc));
- }
- $last = count($table->data)-1;
- for ($i=$last; $i>= $last - count($responses) + 2; $i--){
- $blanks = array_merge(range(0,1),range(6,9));
- foreach($blanks as $col){
- $table->data[$i][$col] = "";
- }
+ $response = array_shift($responses);
+ $table->add_data(array($qnumber."\n<br>".$qicon."\n ".$qreview, $qquestion, $response->text, $response->credit, $response->rcount, $response->rpercent, $facility, $qsd, $di, $dc));
+ foreach($responses as $response) {
+ $table->add_data(array('', '', $response->text, $response->credit, $response->rcount, $response->rpercent, '', '', '', ''));
}
}
@@ -351,29 +344,34 @@ function print_options_form($quiz, $cm, $attempts, $lowlimit=0, $pagesize=10) {
echo '<div class="controls">';
echo '<form id="options" name="options" method="report.php" >';
- echo '<p>'.get_string('analysisoptions', 'quiz').': ';
+ echo '<p class="quiz-report-options">'.get_string('analysisoptions', 'quiz').': </p>';
echo '<input type="hidden" name="id" value="'.$cm->id.'" />';
echo '<input type="hidden" name="q" value="'.$quiz->id.'" />';
echo '<input type="hidden" name="mode" value="analysis" />';
- echo '<label for="attemptselection">'.get_string('attemptselection', 'quiz_analysis').'</label>';
+ echo '<table id="analysis-options" align="center"><tr>';
+ echo '<td><label for="attemptselection">'.get_string('attemptselection', 'quiz_analysis').'</label></td><td>';
$options = array ( QUIZ_ALLATTEMPTS => get_string("attemptsall", 'quiz_analysis'),
QUIZ_HIGHESTATTEMPT => get_string("attemptshighest", 'quiz_analysis'),
QUIZ_FIRSTATTEMPT => get_string("attemptsfirst", 'quiz_analysis'),
QUIZ_LASTATTEMPT => get_string("attemptslast", 'quiz_analysis'));
choose_from_menu($options, "attemptselection", "$attempts", "");
-
- echo '<label for="lowmarklimit">'.get_string('lowmarkslimit', 'quiz_analysis').'</label> <input type="text" id="lowmarklimit" name="lowmarklimit" size="1" value="'.$lowlimit.'" /> % ';
-
- echo '<label for="pagesize">'.get_string('pagesize', 'quiz_analysis').'</label> <input type="text" id="pagesize" name="pagesize" size="1" value="'.$pagesize.'" />';
-
+ echo '</td><tr>';
+ echo '<td><label for="lowmarklimit">'.get_string('lowmarkslimit', 'quiz_analysis').'</label></td>';
+ echo '<td><input type="text" id="lowmarklimit" name="lowmarklimit" size="1" value="'.$lowlimit.'" /> % </td>';
+ echo '</tr>';
+ echo '<tr>';
+ echo '<td><label for="pagesize">'.get_string('pagesize', 'quiz_analysis').'</label></td>';
+ echo '<td><input type="text" id="pagesize" name="pagesize" size="1" value="'.$pagesize.'" /></td>';
+ echo '</tr>';
+ echo '<tr><td colspan="2" align="center">';
echo '<input type="submit" value="'.get_string('go').'" />';
helpbutton("analysisoptions", get_string("analysisoptions",'quiz_analysis'), 'quiz_analysis');
- echo '</p>';
+ echo '</td></tr></table>';
echo '</form>';
echo '</div>';
echo "\n";
- echo '<table align="center"><tr>';
+ echo '<table align="center"><tr>';
unset($options);
$options["id"] = "$cm->id";
$options["q"] = "$quiz->id";
@@ -663,6 +661,11 @@ function print_row_stats_data(&$q) {
}
+define('QUIZ_ALLATTEMPTS', 0);
+define('QUIZ_HIGHESTATTEMPT', 1);
+define('QUIZ_FIRSTATTEMPT', 2);
+define('QUIZ_LASTATTEMPT', 3);
+
function stats_sumx($sum, $data){
$sum[0] += $data[0];
$sum[1] += $data[1];

0 comments on commit 083fc55

Please sign in to comment.
Something went wrong with that request. Please try again.