0fa0d016731e2c448f641923049b33cba0ffd2c8
[atutor.git] / mods / wiki / spages / PageLinks.php
1 <?php
2 /*
3    orders pages by count of links they have
4 */
5
6  echo ewiki_make_title($id, $id, 2);
7
8  #-- fetch all pages
9  $list = array();
10  $result = ewiki_db::GETALL(array("refs"));
11  while ($r = $result->get(0, 0x0137, EWIKI_DB_F_TEXT)) {
12     $list[$r["id"]] = count(explode("\n", trim($r["refs"])));
13  }
14
15  #-- beatify list
16  if (isset($_REQUEST["desc"])) {
17     asort($list);
18  }
19  else {
20     arsort($list);
21  }
22  $r = array();
23  foreach ($list as $id=>$num) {
24     $r[] = array($id, "", "", "($num)");
25  }
26  unset($list);
27
28  #-- output
29  echo ewiki_list_pages($r, 0);
30
31 ?>