added the random type

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

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

Loading…
Cancel
Save