24 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
77 $this->type = $a_type;
78 $this->items = array();
79 $this->shuffle = FALSE;
107 $this->type = $a_type;
156 return count($this->items);
170 array_push($this->items, $a_item);
185 foreach ($this->items as $key => $item)
187 if ($item->getOrder() == $order)
189 $item->setPoints($points);
205 if (array_key_exists($order, $this->items))
207 unset($this->items[$order]);
209 foreach ($this->items as $key => $item)
211 $this->items[$key]->setOrder($order);
229 foreach ($this->items as $key => $item)
231 if ($item->getOrder() == $order)
233 $item->setLowerBound($bound);
250 foreach ($this->items as $key => $item)
252 if ($item->getOrder() == $order)
254 $item->setUpperBound($bound);
270 if (array_key_exists($a_index, $this->items))
272 return $this->items[$a_index];
290 $this->items = array();
304 $this->shuffle = $a_shuffle ? TRUE : FALSE;
331 mt_srand((
double)microtime()*1000000);
342 $array[$j] = $array[$i];
361 foreach ($this->items as $item)
363 if (strlen($item->getAnswerText()) > $maxwidth)
365 $maxwidth = strlen($item->getAnswerText());
382 foreach ($this->items as $key => $item)
384 if ($item->getPoints() > $maxpoints)
386 $maxpoints = $item->getPoints();
390 foreach ($this->items as $key => $item)
392 if ($item->getPoints() == $maxpoints)
394 array_push($keys, $key);
407 $best_solutions = array();
408 foreach ($this->
getItems() as $answer)
410 if (is_array($best_solutions[$answer->getPoints()]))
412 array_push($best_solutions[$answer->getPoints()], $answer->getAnswertext());
416 $best_solutions[$answer->getPoints()] = array();
417 array_push($best_solutions[$answer->getPoints()], $answer->getAnswertext());
420 krsort($best_solutions, SORT_NUMERIC);
421 reset($best_solutions);
422 $found = current($best_solutions);
423 return join(
" " . $lng->txt(
"or") .
" ", $found);
428 foreach ($this->
getItems() as $answer)
430 if ($answer->getPoints() >= $maxpoints)
432 $maxpoints = $answer->getPoints();
433 $foundvalue = $answer->getAnswertext();