mirror of
https://github.com/moodle/moodle.git
synced 2025-02-13 12:34:28 +01:00
MDL-31080 quiz editing, must be able to see and delete missing questions
This commit is contained in:
parent
8cbccb71da
commit
31c5521442
@ -462,19 +462,16 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool,
|
||||
$reordercheckboxlabel = '';
|
||||
$reordercheckboxlabelclose = '';
|
||||
|
||||
if ($qnum && empty($questions[$qnum])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the questiontype is missing change the question type
|
||||
if ($qnum && !array_key_exists($qnum, $questions)) {
|
||||
$fakequestion = new stdClass();
|
||||
$fakequestion->id = 0;
|
||||
$fakequestion->id = $qnum;
|
||||
$fakequestion->category = 0;
|
||||
$fakequestion->qtype = 'missingtype';
|
||||
$fakequestion->name = get_string('deletedquestion', 'qtype_missingtype');
|
||||
$fakequestion->questiontext = '<p>' .
|
||||
get_string('deletedquestion', 'qtype_missing') . '</p>';
|
||||
$fakequestion->length = 0;
|
||||
$fakequestion->name = get_string('missingquestion', 'quiz');
|
||||
$fakequestion->questiontext = ' ';
|
||||
$fakequestion->questiontextformat = FORMAT_HTML;
|
||||
$fakequestion->length = 1;
|
||||
$questions[$qnum] = $fakequestion;
|
||||
$quiz->grades[$qnum] = 0;
|
||||
|
||||
@ -581,7 +578,7 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool,
|
||||
array('title' => $strmovedown));
|
||||
}
|
||||
}
|
||||
if ($allowdelete && (empty($question->id) ||
|
||||
if ($allowdelete && ($question->qtype == 'missingtype' ||
|
||||
question_has_capability_on($question, 'use', $question->category))) {
|
||||
// remove from quiz, not question delete.
|
||||
if (!$hasattempts) {
|
||||
@ -595,7 +592,7 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool,
|
||||
}
|
||||
?>
|
||||
</div><?php
|
||||
if ($question->qtype != 'description' && !$reordertool) {
|
||||
if (!in_array($question->qtype, array('description', 'missingtype')) && !$reordertool) {
|
||||
?>
|
||||
<div class="points">
|
||||
<form method="post" action="edit.php" class="quizsavegradesform"><div>
|
||||
@ -777,7 +774,7 @@ function quiz_print_pagecontrols($quiz, $pageurl, $page, $hasattempts, $defaultc
|
||||
* @param object $quiz The quiz in the context of which the question is being displayed
|
||||
*/
|
||||
function quiz_print_singlequestion($question, $returnurl, $quiz) {
|
||||
echo '<div class="singlequestion">';
|
||||
echo '<div class="singlequestion ' . $question->qtype . '">';
|
||||
echo quiz_question_edit_button($quiz->cmid, $question, $returnurl,
|
||||
quiz_question_tostring($question) . ' ');
|
||||
echo '<span class="questiontype">';
|
||||
@ -884,7 +881,7 @@ function quiz_print_randomquestion(&$question, &$pageurl, &$quiz, $quiz_qbanktoo
|
||||
* @param object $quiz The quiz in the context of which the question is being displayed
|
||||
*/
|
||||
function quiz_print_singlequestion_reordertool($question, $returnurl, $quiz) {
|
||||
echo '<div class="singlequestion">';
|
||||
echo '<div class="singlequestion ' . $question->qtype . '">';
|
||||
echo '<label for="s' . $question->id . '">';
|
||||
echo print_question_icon($question);
|
||||
echo ' ' . quiz_question_tostring($question);
|
||||
|
@ -401,6 +401,7 @@ $string['min'] = 'Min';
|
||||
$string['minutes'] = 'Minutes';
|
||||
$string['missingcorrectanswer'] = 'Correct answer must be specified';
|
||||
$string['missingitemtypename'] = 'Missing name';
|
||||
$string['missingquestion'] = 'This question no longer seems to exist';
|
||||
$string['modulename'] = 'Quiz';
|
||||
$string['modulename_help'] = 'The quiz module enables the teacher to design and set quizzes consisting of multiple choice, true-false, matching and other question types. Each attempt is automatically marked, and the teacher can choose whether to give feedback and/or show correct answers.';
|
||||
$string['modulenameplural'] = 'Quizzes';
|
||||
|
@ -833,11 +833,13 @@ function quiz_question_edit_button($cmid, $question, $returnurl, $contentafteric
|
||||
}
|
||||
$questionparams = array('returnurl' => $returnurl, 'cmid' => $cmid, 'id' => $question->id);
|
||||
$questionurl = new moodle_url("$CFG->wwwroot/question/question.php", $questionparams);
|
||||
return '<a title="' . $action . '" href="' . $questionurl->out() . '"><img src="' .
|
||||
return '<a title="' . $action . '" href="' . $questionurl->out() . '" class="questioneditbutton"><img src="' .
|
||||
$OUTPUT->pix_url($icon) . '" alt="' . $action . '" />' . $contentaftericon .
|
||||
'</a>';
|
||||
} else if ($contentaftericon) {
|
||||
return '<span class="questioneditbutton">' . $contentaftericon . '</span>';
|
||||
} else {
|
||||
return $contentaftericon;
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,8 +264,10 @@ table#categoryquestions {width: 100%;overflow: hidden;table-layout: fixed;}
|
||||
#page-mod-quiz-edit .editq div.question div.content .questionpreview {float:left;}
|
||||
#page-mod-quiz-edit .editq div.question div.content .questionpreview a{font-weight:normal;margin-left:0em;display:inline;float:none;}
|
||||
#page-mod-quiz-edit .editq div.question div.content .randomquestioncategory .questionpreview img{padding-right:0.3em;}
|
||||
#page-mod-quiz-edit .editq div.question div.content .singlequestion a .questionname,
|
||||
#page-mod-quiz-edit .editq div.question div.content .singlequestion a .questiontext{float:left;}
|
||||
#page-mod-quiz-edit .editq div.question div.content .singlequestion .questioneditbutton .questionname,
|
||||
#page-mod-quiz-edit .editq div.question div.content .singlequestion .questioneditbutton .questiontext{float:left;}
|
||||
#page-mod-quiz-edit .reorder div.question div.content .singlequestion.missingtype .questionname,
|
||||
#page-mod-quiz-edit .editq div.question div.content .singlequestion.missingtype .questionname {font-style: italic; max-width: 75%;}
|
||||
#page-mod-quiz-edit .editq div.question div.description div.content .questiontext {max-width: 75%;}
|
||||
#page-mod-quiz-edit .editq div.question div.qnum{font-size:1.5em;}
|
||||
|
||||
@ -398,8 +400,8 @@ bank window's title is prominent enough*/
|
||||
#page-mod-quiz-edit.dir-rtl div.editq div.question div.content {float: right;height: 40px;}
|
||||
#page-mod-quiz-edit.dir-rtl div.question div.content div.points {left: 50px;right:auto;}
|
||||
#page-mod-quiz-edit.dir-rtl div.question div.content div.questioncontrols {float: left;left: 0.3em; right:auto;}
|
||||
#page-mod-quiz-edit.dir-rtl .editq div.question div.content .singlequestion a .questionname,
|
||||
#page-mod-quiz-edit.dir-rtl .editq div.question div.content .singlequestion a .questiontext {float: right; padding-right: 0.3em;}
|
||||
#page-mod-quiz-edit.dir-rtl .editq div.question div.content .singlequestion .questioneditbutton .questionname,
|
||||
#page-mod-quiz-edit.dir-rtl .editq div.question div.content .singlequestion .questioneditbutton .questiontext {float: right; padding-right: 0.3em;}
|
||||
#page-mod-quiz-edit.dir-rtl div.question div.content .questiontext,
|
||||
#page-mod-quiz-edit.dir-rtl #categoryquestions .questiontext {padding-right: 0.3em;}
|
||||
#page-mod-quiz-edit.dir-rtl .editq div.questioncontentcontainer div.singlequestion img {float: right;}
|
||||
|
Loading…
x
Reference in New Issue
Block a user