1f205a0c51ecce8901024af97338981a268dce45
[atutor.git] / mods / wiki / plugins / appearance / fancy_list_dict.php
1 <?php
2
3 # this plugin is only utilized by WordIndex and PageIndex, but is
4 # in fact a ["list_pages"] plugin and could be used with others too
5 #
6 # links of the list are grouped into <table> blocks with the first
7 # letter as block title
8
9
10 $ewiki_plugins["list_dict"][0] = "ewiki_fancy_list_dict";
11            // ["list_pages"][0] = ...
12
13
14
15 function ewiki_fancy_list_dict($links) {
16
17
18    $o .= '<table border="0" cellpadding="3" cellspacing="2">' . "\n";
19
20    $lfl = false;
21
22    foreach ($links as $line) {
23
24       $nfl = strtoupper(substr($line, strpos($line, ">") + 1));
25       $nfl = strtr($nfl, "ÄÖÜß0123456789", "AOUS          ");
26       while ((($nfl[0] < "A") || ($nfl[0] > "Z")) && ($nfl[0] != " ")) {
27          $nfl = substr($nfl, 1);
28       }
29       $nfl = $nfl[0];
30
31       if ($lfl != $nfl) {
32
33          if ($lfl) {
34             $o .= "</td></tr>\n";
35          }
36
37          $o .= '<tr><td valign="top" align="center" width="22" bgcolor="#333333" color="#eeeeee" class="darker reverse"><h2>' .
38                ($lfl = $nfl) . '</h2></td>' .
39                '<td valign="top">';
40       }
41       else {
42          $o .= "<br />";
43       }
44
45       $o .= $line ;
46
47    }
48
49    $o .= "</td></tr>\n</table>\n";
50
51    return($o);
52 }
53
54
55 ?>