This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
en:create:functions:getquestions [13.01.2015 20:29] – created alexander.ritter | en:create:functions:getquestions [24.01.2015 15:46] – [getQuestions()] alexander.ritter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== getQuestions() ====== | ====== getQuestions() ====== | ||
- | '' | + | '' |
- | Die Funktion | + | The function |
- | * //RubrikKennung//\\ Die zweistellige Kennung einer Rubrik. | + | * //sectionID//\\ The two-figure ID of a section |
- | ===== Rückgabewert | + | ===== Return Value ===== |
- | Die Funktion liefert ein Array mit vollständigen Frage-Kennungen, | + | The function returns an array with complete questions IDs as e.g. |
array(' | array(' | ||
- | Falls keine Rubrik mit der angegeben | + | If no section exists with the specified |
- | ===== Beispiele | + | ===== Examples |
+ | |||
+ | The following PHP code shows all questions of a section one below the other (on one page). | ||
- | Folgender PHP-Code zeigt untereinander (auf einer Seite) alle Fragen einer Rubrik. | ||
<code php> | <code php> | ||
$questions = getQuestions(' | $questions = getQuestions(' | ||
- | // Liefert z.B. AB01, AB02, AB04, AB05 | + | // Returns e.g. AB01, AB02, AB04, AB05 |
foreach ($questions as $qID) { | foreach ($questions as $qID) { | ||
question($qID); | question($qID); | ||
Line 27: | Line 28: | ||
</ | </ | ||
- | Folgender | + | The following |
<code php> | <code php> | ||
Line 35: | Line 36: | ||
</ | </ | ||
- | Und folgender | + | And the following |
<code php> | <code php> | ||
- | // Die zufällige Liste nur einmal erstellen | + | // Create the random list only once |
if (!isset($questions)) { | if (!isset($questions)) { | ||
$all = getQuestions(' | $all = getQuestions(' | ||
Line 45: | Line 47: | ||
registerVariable(' | registerVariable(' | ||
} | } | ||
- | // Jeweils eine Frage anzeigen | + | // Each show a question |
$i = loopPage(4); | $i = loopPage(4); | ||
question($questions[$i]); | question($questions[$i]); | ||
</ | </ |