4include_once 
"./Modules/Test/classes/inc.AssessmentConstants.php";
 
   57                $this->type = $a_type;
 
   58                $this->items = array();
 
   59                $this->shuffle = 
true;
 
   85                $this->type = $a_type;
 
  134                return count($this->items);
 
  148                $order = $a_item->getOrder();
 
  149                if (array_key_exists($order, $this->items))
 
  152                        for ($i = 0; $i < $order; $i++)
 
  154                                array_push($newitems, $this->items[$i]);
 
  156                        array_push($newitems, $a_item);
 
  157                        for ($i = $order; $i < count($this->items); $i++)
 
  159                                array_push($newitems, $this->items[$i]);
 
  162                        foreach ($newitems as $idx => $item)
 
  164                                $newitems[$idx]->setOrder($i);
 
  167                        $this->items = $newitems;
 
  171                        array_push($this->items, $a_item);
 
  187                foreach ($this->items as $key => $item)
 
  189                        if ($item->getOrder() == $order)
 
  191                                $item->setPoints($points);
 
  207                if (array_key_exists($order, $this->items))
 
  209                        unset($this->items[$order]);
 
  211                        foreach ($this->items as $key => $item)
 
  213                                $this->items[$key]->setOrder($order);
 
  231                foreach ($this->items as $key => $item)
 
  233                        if ($item->getOrder() == $order)
 
  235                                $item->setLowerBound($bound);
 
  252                foreach ($this->items as $key => $item)
 
  254                        if ($item->getOrder() == $order)
 
  256                                $item->setUpperBound($bound);
 
  272                if (array_key_exists($a_index, $this->items))
 
  274                        return $this->items[$a_index];
 
  292                $this->items = array();
 
  304                $this->shuffle = (bool) $a_shuffle;
 
  333                mt_srand((
double)microtime()*1000000);
 
  344                                        $array[$j] = $array[$i];
 
  363                foreach ($this->items as $item)
 
  365                        if (strlen($item->getAnswertext()) > $maxwidth)
 
  367                                $maxwidth = strlen($item->getAnswertext());
 
  384                foreach ($this->items as $key => $item)
 
  386                        if ($item->getPoints() > $maxpoints)
 
  388                                $maxpoints = $item->getPoints();
 
  392                foreach ($this->items as $key => $item)
 
  394                        if ($item->getPoints() == $maxpoints)
 
  396                                array_push($keys, $key);
 
  409                                $best_solutions = array();
 
  410                                foreach ($this->
getItems() as $answer)
 
  412                                        if (is_array($best_solutions[$answer->getPoints()]))
 
  414                                                array_push($best_solutions[$answer->getPoints()], $answer->getAnswertext());
 
  418                                                $best_solutions[$answer->getPoints()] = array();
 
  419                                                array_push($best_solutions[$answer->getPoints()], $answer->getAnswertext());
 
  422                                krsort($best_solutions, SORT_NUMERIC);
 
  423                                reset($best_solutions);
 
  424                                $found = current($best_solutions);
 
  425                                return join(
" " . 
$lng->txt(
"or") . 
" ", $found);
 
  430                                foreach ($this->
getItems() as $answer)
 
  432                                        if ($answer->getPoints() >= $maxpoints)
 
  434                                                $maxpoints = $answer->getPoints();
 
  435                                                $foundvalue = $answer->getAnswertext();
 
Class for cloze question gaps.
setItemLowerBound($order, $bound)
Sets the lower bound for a given item.
deleteItem($order)
Deletes an item at a given index.
getBestSolutionIndexes()
Returns the indexes of the best solutions for the gap.
getItems()
Gets the items of a cloze gap.
assClozeGap($a_type)
assClozeGap constructor
getItemCount()
Gets the item count.
arrayShuffle($array)
Shuffles the values of a given array.
setItemPoints($order, $points)
Sets the points for a given item.
getShuffle()
Gets the shuffle state of the items.
clearItems()
Removes all gap items.
getMaxWidth()
Returns the maximum width of the gap.
setShuffle($a_shuffle=true)
Sets the shuffle state of the items.
getType()
Gets the cloze gap type.
getItem($a_index)
Gets the item with a given index.
getItemsRaw()
Gets the items of a cloze gap.
addItem($a_item)
Adds a gap item.
setItemUpperBound($order, $bound)
Sets the upper bound for a given item.
setType($a_type=0)
Sets the cloze gap type.
const CLOZE_TEXT
Cloze question constants.