Merge branch 'MDL-49338_29' of git://github.com/timhunt/moodle into MOODLE_29_STABLE

This commit is contained in:
Andrew Nicols
2016-02-23 13:45:15 +08:00
4 changed files with 19 additions and 10 deletions
+3 -2
View File
@@ -703,10 +703,11 @@ class edit_renderer extends \plugin_renderer_base {
* @param \stdClass $quiz the quiz settings from the database.
* @param \stdClass $question data from the question and quiz_slots tables.
* @param bool $label if true, show the preview question label after the icon
* @param int $variant which question variant to preview (optional).
* @return string HTML to output.
*/
public function question_preview_icon($quiz, $question, $label = null) {
$url = quiz_question_preview_url($quiz, $question);
public function question_preview_icon($quiz, $question, $label = null, $variant = null) {
$url = quiz_question_preview_url($quiz, $question, $variant);
// Do we want a label?
$strpreviewlabel = '';
+9 -6
View File
@@ -1230,11 +1230,12 @@ function quiz_attempt_state_name($state) {
* @param int $cmid the course_module object for this quiz.
* @param object $question the question.
* @param string $returnurl url to return to after action is done.
* @param int $variant which question variant to preview (optional).
* @return string html for a number of icons linked to action pages for a
* question - preview and edit / view icons depending on user capabilities.
*/
function quiz_question_action_icons($quiz, $cmid, $question, $returnurl) {
$html = quiz_question_preview_button($quiz, $question) . ' ' .
function quiz_question_action_icons($quiz, $cmid, $question, $returnurl, $variant = null) {
$html = quiz_question_preview_button($quiz, $question, false, $variant) . ' ' .
quiz_question_edit_button($cmid, $question, $returnurl);
return $html;
}
@@ -1291,9 +1292,10 @@ function quiz_question_edit_button($cmid, $question, $returnurl, $contentafteric
/**
* @param object $quiz the quiz settings
* @param object $question the question
* @param int $variant which question variant to preview (optional).
* @return moodle_url to preview this question with the options from this quiz.
*/
function quiz_question_preview_url($quiz, $question) {
function quiz_question_preview_url($quiz, $question, $variant = null) {
// Get the appropriate display options.
$displayoptions = mod_quiz_display_options::make_from_quiz($quiz,
mod_quiz_display_options::DURING);
@@ -1305,22 +1307,23 @@ function quiz_question_preview_url($quiz, $question) {
// Work out the correcte preview URL.
return question_preview_url($question->id, $quiz->preferredbehaviour,
$maxmark, $displayoptions);
$maxmark, $displayoptions, $variant);
}
/**
* @param object $quiz the quiz settings
* @param object $question the question
* @param bool $label if true, show the preview question label after the icon
* @param int $variant which question variant to preview (optional).
* @return the HTML for a preview question icon.
*/
function quiz_question_preview_button($quiz, $question, $label = false) {
function quiz_question_preview_button($quiz, $question, $label = false, $variant = null) {
global $PAGE;
if (!question_has_capability_on($question, 'use', $question->category)) {
return '';
}
return $PAGE->get_renderer('mod_quiz', 'edit')->question_preview_icon($quiz, $question, $label);
return $PAGE->get_renderer('mod_quiz', 'edit')->question_preview_icon($quiz, $question, $label, $variant);
}
/**
@@ -169,7 +169,8 @@ class quiz_statistics_table extends flexible_table {
* @return string contents of this table cell.
*/
protected function col_actions($questionstat) {
return quiz_question_action_icons($this->quiz, $this->cmid, $questionstat->question, $this->baseurl);
return quiz_question_action_icons($this->quiz, $this->cmid,
$questionstat->question, $this->baseurl, $questionstat->variant);
}
/**
+5 -1
View File
@@ -1,11 +1,15 @@
This files describes API changes in the quiz code.
=== 2.9.5. ===
=== 2.9.5 ===
* mod_quiz\output\edit_renderer::start_section_list now takes $structure as an
argument. If you have overridden this method (it's hard to believe anyone ever
would) you will need to update your renderer.
* Several methods relating to preview links/buttons/urls have a new optional
argument to make the preview be of a particular variant.
=== 2.9 ===