MDL-30069 Question type icons missing in lots of places.
This commit is contained in:
+2
-10
@@ -825,16 +825,8 @@ function get_question_options(&$questions, $loadtags = false) {
|
||||
* @return string the HTML for the img tag.
|
||||
*/
|
||||
function print_question_icon($question) {
|
||||
global $OUTPUT;
|
||||
|
||||
$qtype = question_bank::get_qtype($question->qtype, false);
|
||||
$namestr = $qtype->menu_name();
|
||||
|
||||
// TODO convert to return a moodle_icon object, or whatever the class is.
|
||||
$html = '<img src="' . $OUTPUT->pix_url('icon', $qtype->plugin_name()) . '" alt="' .
|
||||
$namestr . '" title="' . $namestr . '" />';
|
||||
|
||||
return $html;
|
||||
global $PAGE;
|
||||
return $PAGE->get_renderer('question', 'bank')->qtype_icon($question->qtype);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -781,7 +781,7 @@ function quiz_print_singlequestion($question, $returnurl, $quiz) {
|
||||
echo quiz_question_edit_button($quiz->cmid, $question, $returnurl,
|
||||
quiz_question_tostring($question) . ' ');
|
||||
echo '<span class="questiontype">';
|
||||
print_question_icon($question);
|
||||
echo print_question_icon($question);
|
||||
echo ' ' . question_bank::get_qtype_name($question->qtype) . '</span>';
|
||||
echo '<span class="questionpreview">' .
|
||||
quiz_question_preview_button($quiz, $question, true) . '</span>';
|
||||
@@ -807,7 +807,7 @@ function quiz_print_randomquestion(&$question, &$pageurl, &$quiz, $quiz_qbanktoo
|
||||
}
|
||||
|
||||
echo '<div class="randomquestionfromcategory">';
|
||||
print_question_icon($question);
|
||||
echo print_question_icon($question);
|
||||
print_random_option_icon($question);
|
||||
echo ' ' . get_string('randomfromcategory', 'quiz') . '</div>';
|
||||
|
||||
@@ -886,7 +886,7 @@ function quiz_print_randomquestion(&$question, &$pageurl, &$quiz, $quiz_qbanktoo
|
||||
function quiz_print_singlequestion_reordertool($question, $returnurl, $quiz) {
|
||||
echo '<div class="singlequestion">';
|
||||
echo '<label for="s' . $question->id . '">';
|
||||
print_question_icon($question);
|
||||
echo print_question_icon($question);
|
||||
echo ' ' . quiz_question_tostring($question);
|
||||
echo '</label>';
|
||||
echo '<span class="questionpreview">' .
|
||||
@@ -920,7 +920,7 @@ function quiz_print_randomquestion_reordertool(&$question, &$pageurl, &$quiz) {
|
||||
echo '<div class="quiz_randomquestion">';
|
||||
echo '<div class="randomquestionfromcategory">';
|
||||
echo $reordercheckboxlabel;
|
||||
print_question_icon($question);
|
||||
echo print_question_icon($question);
|
||||
print_random_option_icon($question);
|
||||
|
||||
if ($questioncount == 0) {
|
||||
|
||||
@@ -1793,7 +1793,7 @@ function print_qtype_to_add_option($qtype) {
|
||||
echo '<span class="qtypename">';
|
||||
$fakequestion = new stdClass();
|
||||
$fakequestion->qtype = $qtype->name();
|
||||
print_question_icon($fakequestion);
|
||||
echo print_question_icon($fakequestion);
|
||||
echo $qtype->menu_name() . '</span><span class="qtypesummary">' . $summary;
|
||||
echo "</span></label>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Renderers for outputting parts of the question bank.
|
||||
*
|
||||
* @package moodlecore
|
||||
* @subpackage questionbank
|
||||
* @copyright 2011 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
/**
|
||||
* This renderer outputs parts of the question bank.
|
||||
*
|
||||
* @copyright 2011 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class core_question_bank_renderer extends plugin_renderer_base {
|
||||
|
||||
/**
|
||||
* Output the icon for a question type
|
||||
* @param string $qtype the question type.
|
||||
* @return string HTML fragment.
|
||||
*/
|
||||
public function qtype_icon($qtype) {
|
||||
$qtype = question_bank::get_qtype($qtype, false);
|
||||
$namestr = $qtype->local_name();
|
||||
|
||||
return $this->pix_icon('icon', $namestr, $qtype->plugin_name(), array('title' => $namestr));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user