ILIAS  release_4-4 Revision
assClozeSelectGap Class Reference

Class for cloze question select gaps. More...

+ Inheritance diagram for assClozeSelectGap:
+ Collaboration diagram for assClozeSelectGap:

Public Member Functions

 assClozeSelectGap ($a_type)
 assClozeSelectGap constructor More...
 
 getShuffle ()
 Gets the shuffle state of the items. More...
 
 setType ($a_shuffle=TRUE)
 Sets the shuffle state of the items. More...
 
 arrayShuffle ($array)
 Shuffles the values of a given array. More...
 
 getItems ()
 Gets the items of a cloze gap. More...
 
- Public Member Functions inherited from assClozeGap
 assClozeGap ($a_type)
 assClozeGap constructor More...
 
 getType ()
 Gets the cloze gap type. More...
 
 setType ($a_type=0)
 Sets the cloze gap type. More...
 
 getItems ()
 Gets the items of a cloze gap. More...
 
 getItemsRaw ()
 Gets the items of a cloze gap. More...
 
 getItemCount ()
 Gets the item count. More...
 
 addItem ($a_item)
 Adds a gap item. More...
 
 setItemPoints ($order, $points)
 Sets the points for a given item. More...
 
 deleteItem ($order)
 Deletes an item at a given index. More...
 
 setItemLowerBound ($order, $bound)
 Sets the lower bound for a given item. More...
 
 setItemUpperBound ($order, $bound)
 Sets the upper bound for a given item. More...
 
 getItem ($a_index)
 Gets the item with a given index. More...
 
 clearItems ()
 Removes all gap items. More...
 
 setShuffle ($a_shuffle=true)
 Sets the shuffle state of the items. More...
 
 getShuffle ()
 Gets the shuffle state of the items. More...
 
 arrayShuffle ($array)
 Shuffles the values of a given array. More...
 
 getMaxWidth ()
 Returns the maximum width of the gap. More...
 
 getBestSolutionIndexes ()
 Returns the indexes of the best solutions for the gap. More...
 
 getBestSolutionOutput ()
 

Data Fields

 $shuffle
 
- Data Fields inherited from assClozeGap
 $type
 Type of gap. More...
 
 $items
 
 $shuffle
 

Detailed Description

Class for cloze question select gaps.

assClozeSelectGap is a class for the abstraction of cloze select gaps. It represents a select gap.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
$Id$

Definition at line 17 of file class.assClozeSelectGap.php.

Member Function Documentation

◆ arrayShuffle()

assClozeSelectGap::arrayShuffle (   $array)

Shuffles the values of a given array.

Shuffles the values of a given array

Parameters
array$arrayAn array which should be shuffled public

Definition at line 75 of file class.assClozeSelectGap.php.

Referenced by getItems().

76  {
77  mt_srand((double)microtime()*1000000);
78  $i = count($array);
79  if ($i > 0)
80  {
81  while(--$i)
82  {
83  $j = mt_rand(0, $i);
84  if ($i != $j)
85  {
86  // swap elements
87  $tmp = $array[$j];
88  $array[$j] = $array[$i];
89  $array[$i] = $tmp;
90  }
91  }
92  }
93  return $array;
94  }
+ Here is the caller graph for this function:

◆ assClozeSelectGap()

assClozeSelectGap::assClozeSelectGap (   $a_type)

assClozeSelectGap constructor

Parameters
integer$a_typeAn integer representing the gap type public

Definition at line 32 of file class.assClozeSelectGap.php.

33  {
34  $this->type = $a_type;
35  $this->items = array();
36  $this->shuffle = TRUE;
37  }

◆ getItems()

assClozeSelectGap::getItems ( )

Gets the items of a cloze gap.

Gets the items of a cloze gap

Returns
array The list of items public
See also
$items

Definition at line 105 of file class.assClozeSelectGap.php.

References assClozeGap\$items, and arrayShuffle().

106  {
107  if ($this->shuffle)
108  {
109  return $this->arrayShuffle($this->items);
110  }
111  else
112  {
113  return $this->items;
114  }
115  }
arrayShuffle($array)
Shuffles the values of a given array.
+ Here is the call graph for this function:

◆ getShuffle()

assClozeSelectGap::getShuffle ( )

Gets the shuffle state of the items.

Gets the shuffle state of the items

Returns
boolean shuffle state public
See also
$shuffle

Definition at line 48 of file class.assClozeSelectGap.php.

References $shuffle.

49  {
50  return $this->shuffle;
51  }

◆ setType()

assClozeSelectGap::setType (   $a_shuffle = TRUE)

Sets the shuffle state of the items.

Sets the shuffle state of the items

Parameters
boolean$a_shuffleShuffle state public
See also
$shuffle

Definition at line 62 of file class.assClozeSelectGap.php.

63  {
64  $this->shuffle = $a_shuffle ? TRUE : FALSE;
65  }

Field Documentation

◆ $shuffle

assClozeSelectGap::$shuffle

Definition at line 24 of file class.assClozeSelectGap.php.

Referenced by getShuffle().


The documentation for this class was generated from the following file: