fixed pages with no links

master
Fabien Benetou 14 years ago
parent 1e80b51172
commit ffba4c3313
  1. 88
      pmwiki_recipes/exercises.php

@ -1,40 +1,50 @@
<?php if (!defined('PmWiki')) exit(); <?php if (!defined('PmWiki')) exit();
error_reporting(0); /*
// for demo Generate exercises based on wiki content and its structure
# generate exercises based on wiki content and its structure exercises idea to implement (cf http://fabien.benetou.fr/Cookbook/Cognition#DailyExercisesFeed )
# random type is not implemented properly enough for score tracking
# still to implement (cf http://fabien.benetou.fr/Cookbook/Cognition#DailyExercisesFeed ) e.g. highest score from random appear as other exercise
# refactor in classes? after 1 random exercise, going back to the same type of the last picked exercise
# random type is not implemented properly enough for score tracking which of those group corresponds the graph visualization V, A, B or C?
# e.g. highest score from random appear as other exercise using groupnetworkvisualization.php
# after 1 random exercise, going back to the same type of the last picked exercise what is the correct order for pages A, B and C on descending criteria i A>B>C? A>C>B? B>C>A? B>A>C? C>B>A? C>A>B?
# which of those group corresponds the graph visualization V, A, B or C? e.g. size, frequency update, last edition, ...
# using groupnetworkvisualization.php what is the color hashing used in RevertedPIM for this group, color A, B or C?
# what is the correct order for pages A, B and C on descending criteria i A>B>C? A>C>B? B>C>A? B>A>C? C>B>A? C>A>B? might require JS
# e.g. size, frequency update, last edition, ... keyword or URL in pages
# what is the color hashing used in RevertedPIM for this group, color A, B or C? definition of word and vice versa
# might require JS limited to pages with definitions (e.g. some languages)
# keyword or URL in pages list lines with "* word = definition"
# definition of word and vice versa split word and definition
# limited to pages with definitions (e.g. some languages) pick one and display the other with alternatives
# list lines with "* word = definition" extend type=pagehasexpression
# split word and definition difficulty parameter
# pick one and display the other with alternatives should be linked to the counter
# extend type=pagehasexpression e.g. increasing the number of possibilities (at least 1 out of 5 pages instead of at least 1 out of 3)
# implemented see the hall of fame to see which exercise are the easiest
# is word X from page A, B, C or D? (type=expressioninpage) do a graph traversal rather than random jumps
# does page A contains word X, Y or Z? (type=pagehasexpression) i.e. if pick randomly from the linked pages or from the group or from the the whole wiki of the previous page
# which of those page corresponds the updates visualization V, A, B or C? (type=historyvisualization) consider https://research.cc.gatech.edu/inc/game-forge
# is page A linked to page B? (type=pagelink) improve parsing
# difficulty parameter discard more pages
# should be linked to the counter structuring e.g. PmWiki. , RecentChanges, GroupFooter, GroupHeader, Template, ...
# e.g. increasing the number of possibilities (at least 1 out of 5 pages instead of at least 1 out of 3) page with just one line, especially markups, typically redirections
# do a graph traversal rather than random jumps support other interfaces
# i.e. if pick randomly from the linked pages or from the group or from the the whole wiki of the previous page e.g. http://www.cs.cmu.edu/~listen/ listed in Content/Education#SeeAlso
# consider https://research.cc.gatech.edu/inc/game-forge Vimperator with predictable link numbers to go faster
track time require for answering each question
display a clock
could improve excitment, e.g. answer the maximum number of questions correctly in X minutes
implemented
is word X from page A, B, C or D? (type=expressioninpage)
does page A contains word X, Y or Z? (type=pagehasexpression)
which of those page corresponds the updates visualization V, A, B or C? (type=historyvisualization)
is page A linked to page B? (type=pagelink)
*/
$RecipeInfo['Exercises']['Version'] = '2015-16-08'; $RecipeInfo['Exercises']['Version'] = '2015-16-08';
@ -76,7 +86,6 @@ function Exercises($pagename, $auth){
$counterparam = "counter=$counter&"; $counterparam = "counter=$counter&";
} }
// the pattern should be improve, e.g. remove PmWiki. , RecentChanges, GroupFooter, GroupHeader, Template, ...
if ($group == "AllPages"){ if ($group == "AllPages"){
// equivalent to getting ALL pages // equivalent to getting ALL pages
$pages = ListPages(); $pages = ListPages();
@ -94,17 +103,17 @@ function Exercises($pagename, $auth){
$content = ReadPage($sourcepage,READPAGE_CURRENT); $content = ReadPage($sourcepage,READPAGE_CURRENT);
$links = $content["targets"]; $links = $content["targets"];
$links_array = explode(",",$links); $links_array = explode(",",$links);
// XXX this does not seem to be used //note that count($links_array)<1) was not used since explode returned an array with en empty value
while ((count($links_array)<1) && (count($pages)>0)) { while (($links_array[0]=="") && (count($pages)>0)) {
$sourcepage = $pages[array_rand($pages)]; $sourcepage = $pages[array_rand($pages)];
unset($pages[array_search($sourcepage,$pages)]); unset($pages[array_search($sourcepage,$pages)]);
$content = ReadPage($sourcepage,READPAGE_CURRENT); $content = ReadPage($sourcepage,READPAGE_CURRENT);
$links = $content["targets"]; $links = $content["targets"];
$links_array = explode(",",$links); $links_array = explode(",",$links);
} }
if ((count($links_array)<1)) { if ($links_array[0]=="") {
$result .= "Unfortunately it seems no suitable page has been found for this game. "; $result .= "Unfortunately it seems no suitable page has been found for this game. ";
$result .= "Try in another group or [[AllPages/AllPages?type=$type&counter=$counter|in the entire wiki]]."; $result .= "Try in another group or [[AllPages/AllPages?action=Exercises&type=$type&counter=$counter|in the entire wiki]].";
break; break;
} }
@ -412,6 +421,7 @@ Markup("exercisesresults", "directives", "/\(:exercisesresults:\)/", ExercisesRe
# default to all participant, not just the currently logged in user # default to all participant, not just the currently logged in user
# hall of fame could be useful in collaborative learning wikis # hall of fame could be useful in collaborative learning wikis
# consider first sparklines for visuals # consider first sparklines for visuals
# remove failed before top score, try to group sessions and avoid results for the same
function ExercisesResults(){ function ExercisesResults(){
global $ScriptUrl, $FarmD, $Author; global $ScriptUrl, $FarmD, $Author;
$availableexercisetypes = array("pagelink", "expressioninpage", "pagehasexpression", "historyvisualization"); $availableexercisetypes = array("pagelink", "expressioninpage", "pagehasexpression", "historyvisualization");

Loading…
Cancel
Save