diff --git a/mod/quiz/questionlib.php b/mod/quiz/questionlib.php
index a0dc16549ec..fca725dedea 100644
--- a/mod/quiz/questionlib.php
+++ b/mod/quiz/questionlib.php
@@ -833,6 +833,34 @@ function quiz_print_question_icon($question, $editlink=true, $return = false) {
}
+/**
+* Returns a html link to the question image if there is one
+*
+* @return string The html image tag or the empy string if there is no image.
+* @param object $question The question object
+*/
+function quiz_get_image($question, $courseid) {
+
+ global $CFG;
+ $img = '';
+
+ if ($question->image) {
+ $img .= 'wwwroot/file.php/$courseid/$question->image";
+
+ } else {
+ $img .= "$CFG->wwwroot/file.php?file=$courseid/$question->image";
+ }
+ $img .= '" alt="" />';
+ }
+ return $img;
+}
+
/**
* Print the question image if there is one
*
@@ -859,7 +887,6 @@ function quiz_print_possible_question_image($question, $courseid) {
}
}
-
/**
* Construct name prefixes for question form element names
*
diff --git a/mod/quiz/questiontypes/question.html b/mod/quiz/questiontypes/question.html
new file mode 100644
index 00000000000..953559f6318
--- /dev/null
+++ b/mod/quiz/questiontypes/question.html
@@ -0,0 +1,45 @@
+
+
|
+ number; ?>
+ editlink; ?>
+ marks) { ?>
+
+ :
+
+
+ + marks; ?> + |
+
+
+
+
+ print_question_formulation_and_controls($question, $state, $cmoptions, $options); ?>
+
+
+ print_question_grading_details($question, $state, $cmoptions, $options); ?>
+
+
+ print_question_submit_buttons($question, $state, $cmoptions, $options); ?>
+
+
+ history; ?>
+
+ |
+
| '; - } else { - echo ' | ';
- }
+ global $CFG;
// Print question number
- echo '' . $number . '';
- if (isteacher($cmoptions->course)) {
- echo ' '; - link_to_popup_window ('/mod/quiz/question.php?id=' . $question->id, - 'editquestion', get_string('edit'), 450, 550, get_string('edit')); - echo ''; + $q->number = $number; + + // For editing teachers print a link to an editing popup window + $q->editlink = ''; + if (isteacheredit($cmoptions->course)) { + $stredit = get_string('edit'); + $linktext = ' ';
+ $q->editlink = link_to_popup_window('/mod/quiz/question.php?id='.$question->id, $stredit, $linktext, 450, 550, $stredit, '', true);
}
+
+ $q->strmarks = '';
+ $q->marks = '';
if ($question->maxgrade and $options->scores) {
- echo '';
- echo get_string('marks', 'quiz').': ';
+ $q->strmarks .= get_string('marks', 'quiz').': ';
if ($cmoptions->optionflags & QUIZ_ADAPTIVE) {
- echo ' ';
- }
-
- echo ''; - echo ('' === $state->last_graded->grade) ? '--/' : round($state->last_graded->grade, $cmoptions->decimalpoints).'/'; + $q->marks = ('' === $state->last_graded->grade) ? '--/' : round($state->last_graded->grade, $cmoptions->decimalpoints).'/'; } - echo $question->maxgrade.' | '; - - $this->print_question_formulation_and_controls($question, $state, - $cmoptions, $options); - - echo ' |
| '; - - if ($question->maxgrade and $options->scores) { - $this->print_question_grading_details($question, $state, $cmoptions, $options); - } - - if (QUIZ_EVENTDUPLICATEGRADE == $state->event) { - echo ' '; - print_string('duplicateresponse', 'quiz'); - } - - if(!$options->readonly) { - echo ' | ||
| '; - $this->print_question_submit_buttons($question, $state, - $cmoptions, $options); + $q->marks .= $question->maxgrade; } + $q->history = ''; if(isset($options->history) and $options->history) { if ($options->history == 'all') { // show all states @@ -537,12 +512,10 @@ class quiz_default_questiontype { $b.round($st->grade, $cmoptions->decimalpoints).$be ); } - echo ' | ||
| '; - print_table($table); + $q->history = make_table($table); } } - echo ' | ||