added the random type

master
Fabien Benetou 14 years ago
parent a617218f07
commit 03c37db619
  1. 6
      pmwiki_recipes/exercises.php

@ -25,6 +25,8 @@ function Exercises($pagename, $auth){
$type = $_GET["type"]; $type = $_GET["type"];
$availableexercisetypes = array("pagelink", "expressioninpage"); $availableexercisetypes = array("pagelink", "expressioninpage");
if ($type=="random")
$type= $availableexercisetypes[rand(0,count($availableexercisetypes)-1)];
switch ($type){ switch ($type){
case "pagelink": case "pagelink":
@ -105,11 +107,11 @@ function Exercises($pagename, $auth){
foreach ($availableexercisetypes as $e) { foreach ($availableexercisetypes as $e) {
$result .= " [[$pagename?action=Exercises&type=$e|$e]],"; $result .= " [[$pagename?action=Exercises&type=$e|$e]],";
} }
$result .= "."; $result .= " or a [[$pagename?action=Exercises&type=random|random]] one.";
}
if ( $counter > 0) { if ( $counter > 0) {
$result .= " (note that it resets the counter)"; $result .= " (note that it resets the counter)";
} }
}
$renderedresult = MarkupToHTML($pagename, $result); $renderedresult = MarkupToHTML($pagename, $result);
print $renderedresult; print $renderedresult;

Loading…
Cancel
Save