Exemplo n.º 1
0
 function SaveRank(&$question)
 {
     // format the text for the question
     list($headertext, $title) = $this->MakeQuestionHeader($question);
     //build list of options
     $optlist = array();
     $optlist[0] = "-";
     foreach ($question->options as $option) {
         if ($option->order == "") {
             $option->order = 0;
         }
         $optlist[$option->order] = OrderToStr($option->order);
     }
     $optlist[9990] = "N/A";
     $question->optlist = $optlist;
     // different template for each type of marking
     $ob = new OB();
     $ob->ClearAndSave();
     if (strtolower($question->score_method) == "strictorder") {
         include "qti20/tmpl/rank-strictorder.php";
     }
     if (strtolower($question->score_method) == "allitemscorrect") {
         include "qti20/tmpl/rank-allitemscorrect.php";
     }
     if (strtolower($question->score_method) == "orderneighbours") {
         $this->AddWarning("'Strict order plus half marks for neighbours' is not a supported marking type, using 'Strict order (mark per option)' instead", $question->load_id);
         include "qti20/tmpl/rank-strictorder.php";
         //include "qti12/tmpl/rank-orderneighbours.php";
     }
     if (strtolower($question->score_method) == "bonusmark") {
         $this->AddWarning("'Correct items with bonus for overall order' is not a supported marking type, using 'Strict order (mark per option)' instead", $question->load_id);
         include "qti20/tmpl/rank-strictorder.php";
         //include "qti12/tmpl/rank-bonusmark.php";
     }
     $this->output .= $ob->GetContent();
     $ob->Restore();
 }
Exemplo n.º 2
0
 function IsRankingQuestion(&$response_list)
 {
     if (count($response_list) < 3) {
         return false;
     }
     // check for all but 2 of the items matching 1st/2nd/3rd etc
     $match_str = array();
     $match_num = array();
     for ($i = 1; $i < count($response_list) - 1; $i++) {
         $item = OrderToStr($i);
         $match_num[$i] = 0;
         $match_str[$item] = 0;
     }
     foreach ($response_list as $item) {
         if (array_key_exists($item, $match_str)) {
             $match_str[$item] = 1;
         }
         if (array_key_exists($item, $match_num)) {
             $match_num[$item] = 1;
         }
     }
     $str_ok = true;
     foreach ($match_str as $isok) {
         if ($isok == 0) {
             $str_ok = false;
         }
     }
     if ($str_ok) {
         echo "Found ranking based on 1st, 2nd, 3rd etc<br>";
         return true;
     }
     $num_ok = true;
     foreach ($match_num as $isok) {
         if ($isok == 0) {
             $num_ok = false;
         }
     }
     return false;
 }