changed git call from https to git readonly
[atutor.git] / mods / wiki / plugins / aview / pagetrail.php
1 <?php
2
3 /*
4      << PrevPage | ParentPageWithLinkList | NextPage >>
5
6    Using a pages meta box you can define it to be part of page
7    section/group ordered by a link list on another page. Use a
8    meta field of "top:" or "parent:" or "group:" to make the
9    current page belong to the cluster of pages in a trail. Then
10    the for and back links will be shown at the bottom.
11 */
12
13
14 $ewiki_plugins["view_append"][] = "ewiki_aview_pagetrail";
15
16 function ewiki_aview_pagetrail($id, &$data, $action) {
17
18    if ($m = $data["meta"]["meta"]) {
19  
20       #-- check for parent page
21       ($top = $m["top"])
22       or ($top = $m["parent"])
23       or ($top = $m["group"]);
24
25       if ($top) {
26          $t = ewiki_db::GET($top);
27          $t = explode("\n", trim($t["refs"]));
28
29          $n = array_search(ewiki_array($top), strtolower($t));
30          $prev = $t[$n-1];
31          $next = $t[$n+1];
32
33          $o = "<div class=\"page-trail\">&lt;&lt; "
34             . ($prev ? ewiki_link($prev) : "")
35             . " | " . ewiki_link($top) . " | "
36             . ($prev ? ewiki_link($prev) : "") . " &gt;%gt;</div>\n";
37          return($o);
38       }
39    }
40 }
41
42
43 ?>