From ffba4c3313f62e0dabeb1a5930c971406cbc2f97 Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Fri, 19 Aug 2011 11:52:10 +0200 Subject: [PATCH] fixed pages with no links --- pmwiki_recipes/exercises.php | 88 ++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 39 deletions(-) diff --git a/pmwiki_recipes/exercises.php b/pmwiki_recipes/exercises.php index 29d17ee..1fb4e97 100644 --- a/pmwiki_recipes/exercises.php +++ b/pmwiki_recipes/exercises.php @@ -1,40 +1,50 @@ B>C? A>C>B? B>C>A? B>A>C? C>B>A? C>A>B? -# e.g. size, frequency update, last edition, ... -# what is the color hashing used in RevertedPIM for this group, color A, B or C? -# might require JS -# keyword or URL in pages -# definition of word and vice versa -# limited to pages with definitions (e.g. some languages) -# list lines with "* word = definition" -# split word and definition -# pick one and display the other with alternatives -# extend type=pagehasexpression -# 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) -# difficulty parameter -# should be linked to the counter -# e.g. increasing the number of possibilities (at least 1 out of 5 pages instead of at least 1 out of 3) -# do a graph traversal rather than random jumps -# i.e. if pick randomly from the linked pages or from the group or from the the whole wiki of the previous page -# consider https://research.cc.gatech.edu/inc/game-forge +/* +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 + e.g. highest score from random appear as other exercise + after 1 random exercise, going back to the same type of the last picked exercise + which of those group corresponds the graph visualization V, A, B or C? + using groupnetworkvisualization.php + 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? + e.g. size, frequency update, last edition, ... + what is the color hashing used in RevertedPIM for this group, color A, B or C? + might require JS + keyword or URL in pages + definition of word and vice versa + limited to pages with definitions (e.g. some languages) + list lines with "* word = definition" + split word and definition + pick one and display the other with alternatives + extend type=pagehasexpression +difficulty parameter + should be linked to the counter + e.g. increasing the number of possibilities (at least 1 out of 5 pages instead of at least 1 out of 3) + see the hall of fame to see which exercise are the easiest +do a graph traversal rather than random jumps + i.e. if pick randomly from the linked pages or from the group or from the the whole wiki of the previous page + consider https://research.cc.gatech.edu/inc/game-forge +improve parsing + discard more pages + structuring e.g. PmWiki. , RecentChanges, GroupFooter, GroupHeader, Template, ... + page with just one line, especially markups, typically redirections +support other interfaces + e.g. http://www.cs.cmu.edu/~listen/ listed in Content/Education#SeeAlso + 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'; @@ -76,7 +86,6 @@ function Exercises($pagename, $auth){ $counterparam = "counter=$counter&"; } - // the pattern should be improve, e.g. remove PmWiki. , RecentChanges, GroupFooter, GroupHeader, Template, ... if ($group == "AllPages"){ // equivalent to getting ALL pages $pages = ListPages(); @@ -94,17 +103,17 @@ function Exercises($pagename, $auth){ $content = ReadPage($sourcepage,READPAGE_CURRENT); $links = $content["targets"]; $links_array = explode(",",$links); - // XXX this does not seem to be used - while ((count($links_array)<1) && (count($pages)>0)) { + //note that count($links_array)<1) was not used since explode returned an array with en empty value + while (($links_array[0]=="") && (count($pages)>0)) { $sourcepage = $pages[array_rand($pages)]; unset($pages[array_search($sourcepage,$pages)]); $content = ReadPage($sourcepage,READPAGE_CURRENT); $links = $content["targets"]; $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 .= "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; } @@ -412,6 +421,7 @@ Markup("exercisesresults", "directives", "/\(:exercisesresults:\)/", ExercisesRe # default to all participant, not just the currently logged in user # hall of fame could be useful in collaborative learning wikis # consider first sparklines for visuals +# remove failed before top score, try to group sessions and avoid results for the same function ExercisesResults(){ global $ScriptUrl, $FarmD, $Author; $availableexercisetypes = array("pagelink", "expressioninpage", "pagehasexpression", "historyvisualization");