From 477c217f5c149c929f250fd07241c29035b1167e Mon Sep 17 00:00:00 2001 From: tjhunt Date: Mon, 5 Jan 2009 05:26:08 +0000 Subject: [PATCH] MDL-17294 Eliminate some commented out code, and clean up the 'no questions in quiz' special case. --- mod/quiz/editlib.php | 45 ++++++-------------------------------------- 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/mod/quiz/editlib.php b/mod/quiz/editlib.php index 767edb255c..867e983b62 100644 --- a/mod/quiz/editlib.php +++ b/mod/quiz/editlib.php @@ -182,53 +182,31 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete=true, $strtype = get_string("type", "quiz"); $strpreview = get_string("preview", "quiz"); - /*if (!$quiz->questions) { - echo "

"; - print_string("noquestions", "quiz"); - echo "

"; - return 0; - }*/ - if($quiz->questions){ + if ($quiz->questions) { list($usql, $params) = $DB->get_in_or_equal(explode(',', $quiz->questions)); $questions = $DB->get_records_sql("SELECT q.*,c.contextid FROM {question} q, {question_categories} c WHERE q.id $usql AND q.category = c.id", $params); + } else { + $questions = array(); } - // if user only has empty pages we have to keep that: out with OR (!$questions) - if (!$quiz->questions) { - $pagecount=1; - echo '
Page '. - $pagecount.'
'; - print_string("noquestionsinquiz", "quiz"); - echo '
'; - if(!$reordertool){ - quiz_print_pagecontrols($quiz, $pageurl, $pagecount,$hasattempts); - } - echo "
"; - //this is how it worked before summer 2008 - //OR !$questions - if(!isset($questions)){ - return 0; - } - } - $layout=quiz_clean_layout($quiz->questions); $order = explode(',', $layout); $lastindex = count($order)-1; - if ($hasattempts){ + if ($hasattempts) { $disabled='disabled="disabled"'; $movedisabled=''; $pagingdisabled=''; - }else{ + } else { $disabled=''; $movedisabled=''; $pagingdisabled=''; } - if($quiz->shufflequestions){ + if ($quiz->shufflequestions) { $movedisabled='disabled="disabled"'; } if($quiz->questionsperpage){ @@ -289,17 +267,6 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete=true, echo $reordercontrolstop; } - /* // Tim: is this a separate case from the above "no questions in quiz"? Should it still be done?: - if(!$quiz->questions){ - $pagecount=1; - echo '
Page '. - $pagecount.'
'; - print_string("noquestions", "quiz"); - quiz_print_pagecontrols($quiz, $pageurl, $pagecount); - echo "
"; - - }*/ - //the current question ordinal (no descriptions) $qno = 1; //the current question (includes questions and descriptions) -- 2.39.5