Subversion Repositories Applications.projet

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 ddelon 1
<?php
2
/*
3
listpages.php
4
 
5
Copyright 2002  David DELON
6
Copyright 2003  Patrick PAUL
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or
10
(at your option) any later version.
11
 
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
*/
21
 
22
if (!function_exists("TreeView"))
23
{
24
	function TreeView($node,$level,$indent=0)
25
	{
26
		global $wiki;
27
		if ($level>0) {
28
			$head=split(" :: ",$wiki->GetConfigValue("navigation_links"));
29
			// we don't want page from the header
30
			if (!in_array($node, $head, TRUE))
31
			{
32
				if (($indent>0) && (!($wiki->GetConfigValue("root_page")==$node)) || ($indent==0) )
33
				{
34
				// Ignore users too ...
35
					if (!$wiki->LoadUser($node))
36
					{
37
						if ($indent)
38
							echo (str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",$indent)),$wiki->Link($node),"<br/>\n";
39
						$pages = $wiki->LoadAll("select to_tag from ".$wiki->config["table_prefix"]."links where from_tag='".mysql_escape_string($node)."' order by to_tag asc");
40
 
41
						if (is_array($pages)) {
42
							foreach ($pages as $page)
43
							{
44
								$wiki->CachePage($page);
45
								TreeView($page["to_tag"],$level-1,$indent+1);
46
							}
47
						}
48
					}
49
				}
50
			}
51
		}
52
	}
53
}
54
 
55
if($sortkey = $this->GetParameter("sort")) {
56
	if (($sortkey != "tag") && ($sortkey != "time") && ($sortkey != "owner") && ($sortkey != "user")) $sortkey = "tag";
57
	$pages = $this->LoadAll("select tag, owner, user from ".$this->config["table_prefix"]."pages where latest = 'Y' and comment_on = '' order by $sortkey asc");
58
        foreach ($pages as $page) {
59
                $this->CachePage($page);
60
		$owner=$page["owner"]?$page["owner"]:"Inconnu";
61
		echo "&nbsp;&nbsp;&nbsp;",$this->ComposeLinkToPage($page["tag"], "", "", 0)," . . . . ",$this->Format($owner),". . . . derni&egrave;re modification par " , $this->Format($page["user"]) , "<br/>\n" ;
62
        }
63
}
64
// Tree display
65
else if ($sortkey = $this->GetParameter("tree"))
66
{
67
// No rootpage specified, assume root_page
68
	if ($sortkey=="tree") $sortkey=$this->GetConfigValue("root_page");
69
      	echo $this->ComposeLinkToPage($sortkey),"<br /><br/>\n" ;
70
 
71
// 3 levels displayed, It should be parameter ...
72
	TreeView($sortkey,3);
73
 
74
}
75
// Default Action :  sort by tag
76
else
77
{
78
	$pages = $this->LoadAll("select tag, owner, user from ".$this->config["table_prefix"]."pages where latest = 'Y' and comment_on = '' order by tag asc");
79
        foreach ($pages as $page) {
80
                $this->CachePage($page);
81
		$owner=$page["owner"]?$page["owner"]:"Inconnu";
82
		echo "&nbsp;&nbsp;&nbsp;",$this->ComposeLinkToPage($page["tag"], "", "", 0)," . . . . ",$this->Format($owner),"<br/>\n" ;
83
        }
84
}
85
?>