21include_once 
"./Modules/Test/classes/inc.AssessmentConstants.php";
 
   70        $this->type = (
int) $a_type;
 
   72        $this->shuffle = 
true;
 
  107        $this->type = $a_type;
 
  122        if ($gap_index === 
null) {
 
  127        for (
$i = -2; 
$i < $gap_index; 
$i++) {
 
  159        return count($this->items);
 
  173        $order = $a_item->getOrder();
 
  174        if (array_key_exists($order, $this->items)) {
 
  176            for (
$i = 0; 
$i < $order; 
$i++) {
 
  177                array_push($newitems, $this->items[
$i]);
 
  179            array_push($newitems, $a_item);
 
  180            for (
$i = $order, $iMax = count($this->items); 
$i < $iMax; 
$i++) {
 
  181                array_push($newitems, $this->items[
$i]);
 
  184            foreach ($newitems as $idx => $item) {
 
  185                $newitems[$idx]->setOrder(
$i);
 
  188            $this->items = $newitems;
 
  190            array_push($this->items, $a_item);
 
  206        foreach ($this->items as 
$key => $item) {
 
  207            if ($item->getOrder() == $order) {
 
  208                $item->setPoints($points);
 
  224        if (array_key_exists($order, $this->items)) {
 
  225            unset($this->items[$order]);
 
  227            foreach ($this->items as 
$key => $item) {
 
  228                $this->items[
$key]->setOrder($order);
 
  246        foreach ($this->items as 
$key => $item) {
 
  247            if ($item->getOrder() == $order) {
 
  248                $item->setLowerBound($bound);
 
  265        foreach ($this->items as 
$key => $item) {
 
  266            if ($item->getOrder() == $order) {
 
  267                $item->setUpperBound($bound);
 
  284        if (array_key_exists($a_index, $this->items)) {
 
  285            return $this->items[$a_index];
 
  313        $this->shuffle = (bool) $a_shuffle;
 
  337        foreach ($this->items as $item) {
 
  338            if (strlen($item->getAnswertext()) > $maxwidth) {
 
  339                $maxwidth = strlen($item->getAnswertext());
 
  356        foreach ($this->items as 
$key => $item) {
 
  357            if ($item->getPoints() > $maxpoints) {
 
  358                $maxpoints = $item->getPoints();
 
  362        foreach ($this->items as 
$key => $item) {
 
  363            if ($item->getPoints() == $maxpoints) {
 
  382                $best_solutions = [];
 
  383                if ($combinations !== 
null && $combinations[
'best_solution'] == 1) {
 
  384                    $best_solutions[$combinations[
'points']] = [];
 
  385                    array_push($best_solutions[$combinations[
'points']], $combinations[
'answer']);
 
  387                    foreach ($this->
getItems($shuffler) as $answer) {
 
  388                        $points_string_for_key = (string) $answer->getPoints();
 
  389                        if (isset($best_solutions[$points_string_for_key]) && is_array($best_solutions[$points_string_for_key])) {
 
  390                            array_push($best_solutions[$points_string_for_key], $answer->getAnswertext());
 
  392                            $best_solutions[$points_string_for_key] = [];
 
  393                            array_push($best_solutions[$points_string_for_key], $answer->getAnswertext());
 
  398                krsort($best_solutions, SORT_NUMERIC);
 
  399                reset($best_solutions);
 
  400                $found = current($best_solutions);
 
  401                return join(
" " . 
$lng->txt(
"or") . 
" ", $found);
 
  406                foreach ($this->
getItems($shuffler) as $answer) {
 
  407                    if ($answer->getPoints() >= $maxpoints) {
 
  408                        $maxpoints = $answer->getPoints();
 
  409                        $foundvalue = $answer->getAnswertext();
 
  438        require_once 
'Services/Math/classes/class.EvalMath.php';
 
  442        $lowerBound = $math->evaluate($item->getLowerBound());
 
  443        $upperBound = $math->evaluate($item->getUpperBound());
 
  444        $preciseValue = $math->evaluate($item->getAnswertext());
 
  446        if ($lowerBound < $preciseValue || $upperBound > $preciseValue) {
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps.
 
getBestSolutionOutput(Transformation $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.
 
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.
 
setGapSize(int $gap_size)
 
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.
 
getItems(Transformation $shuffler, ?int $gap_index=null)
Gets the items of a cloze gap.
 
setType($a_type=0)
Sets the cloze gap type.
 
const CLOZE_TEXT
Cloze question constants.