4include_once 
"./Modules/Test/classes/inc.AssessmentConstants.php";
 
   58        $this->items = array();
 
   59        $this->shuffle = 
true;
 
   97            return $shuffler->
shuffle($this->items);
 
  128        return count($this->items);
 
  142        $order = $a_item->getOrder();
 
  143        if (array_key_exists($order, $this->items)) {
 
  145            for (
$i = 0; 
$i < $order; 
$i++) {
 
  146                array_push($newitems, $this->items[
$i]);
 
  148            array_push($newitems, $a_item);
 
  149            for (
$i = $order; 
$i < count($this->items); 
$i++) {
 
  150                array_push($newitems, $this->items[
$i]);
 
  153            foreach ($newitems as $idx => $item) {
 
  154                $newitems[$idx]->setOrder(
$i);
 
  157            $this->items = $newitems;
 
  159            array_push($this->items, $a_item);
 
  175        foreach ($this->items as 
$key => $item) {
 
  176            if ($item->getOrder() == $order) {
 
  177                $item->setPoints($points);
 
  193        if (array_key_exists($order, $this->items)) {
 
  194            unset($this->items[$order]);
 
  196            foreach ($this->items as 
$key => $item) {
 
  197                $this->items[
$key]->setOrder($order);
 
  215        foreach ($this->items as 
$key => $item) {
 
  216            if ($item->getOrder() == $order) {
 
  217                $item->setLowerBound($bound);
 
  234        foreach ($this->items as 
$key => $item) {
 
  235            if ($item->getOrder() == $order) {
 
  236                $item->setUpperBound($bound);
 
  252        if (array_key_exists($a_index, $this->items)) {
 
  253            return $this->items[$a_index];
 
  269        $this->items = array();
 
  281        $this->shuffle = (bool) $a_shuffle;
 
  305        foreach ($this->items as $item) {
 
  306            if (strlen($item->getAnswertext()) > $maxwidth) {
 
  307                $maxwidth = strlen($item->getAnswertext());
 
  324        foreach ($this->items as 
$key => $item) {
 
  325            if ($item->getPoints() > $maxpoints) {
 
  326                $maxpoints = $item->getPoints();
 
  330        foreach ($this->items as 
$key => $item) {
 
  331            if ($item->getPoints() == $maxpoints) {
 
  349                $best_solutions = array();
 
  350                if ($combinations !== 
null && $combinations[
'best_solution'] == 1) {
 
  351                    $best_solutions[$combinations[
'points']] = array();
 
  352                    array_push($best_solutions[$combinations[
'points']], $combinations[
'answer']);
 
  354                    foreach ($this->
getItems($shuffler) as $answer) {
 
  355                        if (isset($best_solutions[$answer->getPoints()]) && is_array($best_solutions[$answer->getPoints()])) {
 
  356                            array_push($best_solutions[$answer->getPoints()], $answer->getAnswertext());
 
  358                            $best_solutions[$answer->getPoints()] = array();
 
  359                            array_push($best_solutions[$answer->getPoints()], $answer->getAnswertext());
 
  364                krsort($best_solutions, SORT_NUMERIC);
 
  365                reset($best_solutions);
 
  366                $found = current($best_solutions);
 
  367                return join(
" " . 
$lng->txt(
"or") . 
" ", $found);
 
  372                foreach ($this->
getItems($shuffler) as $answer) {
 
  373                    if ($answer->getPoints() >= $maxpoints) {
 
  374                        $maxpoints = $answer->getPoints();
 
  375                        $foundvalue = $answer->getAnswertext();
 
An exception for terminatinating execution or to throw for unit testing.
Class for cloze question gaps.
getBestSolutionOutput(ilArrayElementShuffler $shuffler, $combinations=null)
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.
getItemCount()
Gets the item count.
setItemPoints($order, $points)
Sets the points for a given item.
getItems(ilArrayElementShuffler $shuffler)
Gets the items of a cloze gap.
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.
__construct($a_type)
assClozeGap constructor
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.