populate related PTVs
This commit is contained in:
@@ -2,11 +2,17 @@
|
||||
|
||||
# return the "key pages" of a group
|
||||
# todo
|
||||
# explicit importance via PTVs
|
||||
# existing PTVs startrecall, recall, startprepare, ... (cf MemoryHandling)
|
||||
# dedicated PTV
|
||||
# http://phpir.com/pagerank-in-php
|
||||
# http://faculty.ucr.edu/~hanneman/nettext/C10_Centrality.html#Betweenness
|
||||
# check if isset() really is necessary, seems it was avoided in Coeditions
|
||||
# transform as an extension of http://www.pmwiki.org/wiki/PmWiki/CustomPagelistSortOrder
|
||||
# would produce much better integration
|
||||
|
||||
function GroupKeyPages($groupname,$selectionmechanism=""){
|
||||
# XXX if the groupname does not exist then should return an empty array
|
||||
$pages = ListPages("/$groupname\./e");
|
||||
|
||||
//note that this could be replaced by proper ListPages call
|
||||
@@ -24,14 +30,25 @@ function GroupKeyPages($groupname,$selectionmechanism=""){
|
||||
break;
|
||||
default:
|
||||
$keypages = NetworkDegree($b,8); # degree threshold
|
||||
}
|
||||
} # XXX none of those methods leverage PTVs so far
|
||||
return array_unique($keypages);
|
||||
}
|
||||
|
||||
|
||||
function GenerateNetworkFromList($pagelist){
|
||||
$b = array();
|
||||
foreach ($pagelist as $page) {
|
||||
$content = ReadPage($page,$since=0);
|
||||
//$content = ReadPage($page,$since=0);
|
||||
$content = ReadPage($page,READPAGE_CURRENT);
|
||||
# check if it has PTVs :
|
||||
$relatedPTVs = array( "startrecall", "recall", "startprepare" );
|
||||
foreach ($relatedPTVs as $PTV){
|
||||
# if so, add the value
|
||||
$PTV_value = PageTextVar($page,$PTV);
|
||||
if ($PTV_value) {
|
||||
$b["$page"]["$PTV"] = $PTV_value;
|
||||
}
|
||||
} # XXX somehow seems to parse the list of pages twice
|
||||
$links = $content["targets"];
|
||||
$links_array = explode(",",$links);
|
||||
foreach ($links_array as $link) {
|
||||
@@ -122,6 +139,7 @@ function GroupDegreeDistribution($groupname){
|
||||
$pages = CleanPageList($pages,$groupname);
|
||||
|
||||
$b = GenerateNetworkFromList($pages);
|
||||
if (empty($b)) return array();
|
||||
|
||||
$distribution = array_fill(1,10,0);
|
||||
// has no effect
|
||||
|
||||
Reference in New Issue
Block a user