Public Member Functions | Data Fields

assClozeSelectGap Class Reference
[Modules/TestQuestionPool]

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

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 <helmut.schottmueller@mac.com>
Version:
$Id$

Definition at line 37 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 $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

Parameters:
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

Returns:
array The list of items public
See also:
$items

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

Returns:
boolean shuffle state public
See also:
$shuffle

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

Parameters:
boolean $a_shuffle Shuffle state public
See also:
$shuffle

Reimplemented from assClozeGap.

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

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


Field Documentation

assClozeSelectGap::$shuffle

Reimplemented from assClozeGap.

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


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