added the random type

This commit is contained in:
Fabien Benetou
2011-08-12 23:04:13 +02:00
parent a617218f07
commit 03c37db619
+6 -4
View File
@@ -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;