You are here

private function MultichoiceQuestion::shuffle in Quiz 6.4

Same name and namespace in other branches
  1. 7.6 question_types/multichoice/multichoice.classes.inc \MultichoiceQuestion::shuffle()
  2. 7 question_types/multichoice/multichoice.classes.inc \MultichoiceQuestion::shuffle()
  3. 7.4 question_types/multichoice/multichoice.classes.inc \MultichoiceQuestion::shuffle()
  4. 7.5 question_types/multichoice/multichoice.classes.inc \MultichoiceQuestion::shuffle()

Custom shuffle function. It keeps the array key - value relationship intact

Parameters

array $array:

Return value

unknown_type

2 calls to MultichoiceQuestion::shuffle()
MultichoiceQuestion::getAnsweringForm in question_types/multichoice/multichoice.classes.inc
Generates the question form.
MultichoiceQuestion::getNodeView in question_types/multichoice/multichoice.classes.inc
Implementation of getNodeView

File

question_types/multichoice/multichoice.classes.inc, line 396
The main classes for the multichoice question type.

Class

MultichoiceQuestion
Extension of QuizQuestion.

Code

private function shuffle(array &$array) {
  $newArray = array();
  $toReturn = array_keys($array);
  shuffle($toReturn);
  foreach ($toReturn as $key) {
    $newArray[$key] = $array[$key];
  }
  $array = $newArray;
  return $toReturn;
}