--- quiz/quiz.admin.inc
+++ quiz/quiz.admin.inc
@@ -1065,7 +1065,7 @@ function _quiz_add_questions_to_form(&$f
'#type' => 'textfield',
'#size' => 2,
'#maxlength' => 2,
- '#disabled' => $question->auto_update_max_score,
+ '#disabled' => isset($question->auto_update_max_score) ? $question->auto_update_max_score: NULL,
'#default_value' => isset($question->max_score) ? $question->max_score : 0,
);
}
@@ -1806,7 +1806,7 @@ function theme_quiz_admin_summary($varia
if (isset($summary['passfail'])) {
$output .= '
' . check_markup($summary['passfail'], $quiz->body['und'][0]['format']) . '
' . "\n";
}
- if (isset($summary['result'])) {
+ if (isset($summary['result']) && $summary['result'] != '') {
$output .= '' . check_markup($summary['result'], $quiz->body['und'][0]['format']) . '
' . "\n";
}
--- quiz/quiz.module
+++ quiz/quiz.module
@@ -1900,8 +1900,10 @@ function quiz_take_quiz($quiz) {
// First time running through quiz.
elseif (quiz_start_check($quiz, $rid)) {
- _quiz_take_quiz_init($quiz);
-
+ $no_questions_found = _quiz_take_quiz_init($quiz);
+ if ($no_questions_found) {
+ return array('body' => array('#markup' => $no_questions_found));
+ }
}
else {
@@ -2223,16 +2225,27 @@ function _quiz_take_quiz_init($quiz) {
// Create question list.
$questions = quiz_build_question_list($quiz);
+ $message = NULL;
if ($questions === FALSE) {
- drupal_set_message(t('Not enough random questions were found. Please add more questions before trying to take this @quiz.',
- array('@quiz' => QUIZ_NAME)), 'error');
- return array('body' => array('#value' => ' '));
+ if (quiz_type_confirm($quiz, 'update')) {
+ $message = t('Not enough random questions were found. Please add more questions before trying to take this @quiz.',
+ array('@quiz' => QUIZ_NAME));
+ } else {
+ $message = t('No questions were found.');
+ }
+ drupal_set_message($message, 'error');
+ return $message;
}
if (count($questions) == 0) {
- drupal_set_message(t('No questions were found. Please !assign_questions before trying to take this @quiz.',
- array('@quiz' => QUIZ_NAME, '!assign_questions' => l(t('assign questions'), 'node/' . arg(1) . '/questions'))), 'error');
- return array('body' => array('#value' => t('Please assign questions...')));
+ if (quiz_type_confirm($quiz, 'update')) {
+ $message = t('No questions were found. Please !assign_questions before trying to take this @quiz.',
+ array('@quiz' => QUIZ_NAME, '!assign_questions' => l(t('assign questions'), 'node/' . arg(1) . '/questions')));
+ } else {
+ $message = t('No questions were found.');
+ }
+ drupal_set_message($message, 'error');
+ return $message;
}
// Initialize session variables.