ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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
 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.
- Public Member Functions inherited from assClozeGap
 assClozeGap ($a_type)
 assClozeGap constructor
 getType ()
 Gets the cloze gap type.
 getItemsRaw ()
 Gets the items of a cloze gap.
 getItemCount ()
 Gets the item count.
 addItem ($a_item)
 Adds a gap item.
 setItemPoints ($order, $points)
 Sets the points for a given item.
 deleteItem ($order)
 Deletes an item at a given index.
 setItemLowerBound ($order, $bound)
 Sets the lower bound for a given item.
 setItemUpperBound ($order, $bound)
 Sets the upper bound for a given item.
 getItem ($a_index)
 Gets the item with a given index.
 clearItems ()
 Removes all gap items.
 setShuffle ($a_shuffle=true)
 Sets the shuffle state of the items.
 getMaxWidth ()
 Returns the maximum width of the gap.
 getBestSolutionIndexes ()
 Returns the indexes of the best solutions for the gap.
 getBestSolutionOutput ()

Data Fields

 $shuffle
- Data Fields inherited from assClozeGap
 $type
 Type of gap.
 $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:
class.assClozeSelectGap.php 44245 2013-08-17 11:15:45Z mbecker

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

Member Function Documentation

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

Reimplemented from assClozeGap.

Definition at line 75 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

Parameters
integer$a_typeAn integer representing the gap type public

Definition at line 32 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

Returns
array The list of items public
See Also
$items

Reimplemented from assClozeGap.

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

References assClozeGap\$items, and 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

Returns
boolean shuffle state public
See Also
$shuffle

Reimplemented from assClozeGap.

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

References $shuffle.

{
}
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

Reimplemented from assClozeGap.

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

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

Field Documentation

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: