Permalink
Browse files

Merge branch 'MDL-31080_21' of git://github.com/timhunt/moodle into M…

…OODLE_21_STABLE
  • Loading branch information...
2 parents 6acec6c + ce7595e commit 35dc672ead1efe41197d44aae85f96147833087f @stronk7 stronk7 committed Jan 17, 2012
Showing with 21 additions and 19 deletions.
  1. +10 −13 mod/quiz/editlib.php
  2. +1 −0 mod/quiz/lang/en/quiz.php
  3. +4 −2 mod/quiz/locallib.php
  4. +6 −4 mod/quiz/styles.css
View
@@ -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);
@@ -404,6 +404,7 @@
$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';
View
@@ -870,11 +870,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 '';
}
}
View
@@ -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;}
@@ -397,8 +399,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;}

0 comments on commit 35dc672

Please sign in to comment.