private function MultichoiceQuestion::shuffle in Quiz 7
Same name and namespace in other branches
- 6.4 question_types/multichoice/multichoice.classes.inc \MultichoiceQuestion::shuffle()
- 7.6 question_types/multichoice/multichoice.classes.inc \MultichoiceQuestion::shuffle()
- 7.4 question_types/multichoice/multichoice.classes.inc \MultichoiceQuestion::shuffle()
- 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 445 - 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;
}