Class for cloze question select gaps. More...
Inheritance diagram for assClozeSelectGap:
Collaboration diagram for assClozeSelectGap:Public Member Functions | |
| assClozeSelectGap ($a_type) | |
| assClozeSelectGap constructor | |
| getShuffle () | |
| Gets the shuffle state of the items. | |
| setType ($a_shuffle=TRUE) | |
| Sets the shuffle state of the items. | |
| arrayShuffle ($array) | |
| Shuffles the values of a given array. | |
| getItems () | |
| Gets the items of a cloze gap. | |
Data Fields | |
| $shuffle | |
Class for cloze question select gaps.
assClozeSelectGap is a class for the abstraction of cloze select gaps. It represents a select gap.
Definition at line 37 of file class.assClozeSelectGap.php.
| assClozeSelectGap::arrayShuffle | ( | $ | array | ) |
Shuffles the values of a given array.
Shuffles the values of a given array
| array | $array An array which should be shuffled public |
Reimplemented from assClozeGap.
Definition at line 95 of file class.assClozeSelectGap.php.
Referenced by getItems().
{
mt_srand((double)microtime()*1000000);
$i = count($array);
if ($i > 0)
{
while(--$i)
{
$j = mt_rand(0, $i);
if ($i != $j)
{
// swap elements
$tmp = $array[$j];
$array[$j] = $array[$i];
$array[$i] = $tmp;
}
}
}
return $array;
}
Here is the caller graph for this function:| assClozeSelectGap::assClozeSelectGap | ( | $ | a_type | ) |
assClozeSelectGap constructor
| integer | $a_type An integer representing the gap type public |
Definition at line 52 of file class.assClozeSelectGap.php.
{
$this->type = $a_type;
$this->items = array();
$this->shuffle = TRUE;
}
| assClozeSelectGap::getItems | ( | ) |
Gets the items of a cloze gap.
Gets the items of a cloze gap
Reimplemented from assClozeGap.
Definition at line 125 of file class.assClozeSelectGap.php.
References arrayShuffle().
{
if ($this->shuffle)
{
return $this->arrayShuffle($this->items);
}
else
{
return $this->items;
}
}
Here is the call graph for this function:| assClozeSelectGap::getShuffle | ( | ) |
Gets the shuffle state of the items.
Gets the shuffle state of the items
Reimplemented from assClozeGap.
Definition at line 68 of file class.assClozeSelectGap.php.
{
return $this->shuffle;
}
| assClozeSelectGap::setType | ( | $ | a_shuffle = TRUE |
) |
Sets the shuffle state of the items.
Sets the shuffle state of the items
| boolean | $a_shuffle Shuffle state public |
Reimplemented from assClozeGap.
Definition at line 82 of file class.assClozeSelectGap.php.
{
$this->shuffle = $a_shuffle ? TRUE : FALSE;
}
| assClozeSelectGap::$shuffle |
Reimplemented from assClozeGap.
Definition at line 44 of file class.assClozeSelectGap.php.
1.7.1