commit | author | age
|
b5a2f8
|
1 |
<? |
436ed8
|
2 |
|
b5a2f8
|
3 |
/* |
436ed8
|
4 |
Copyright (c) 2007, Till Brehm, projektfarm Gmbh |
b5a2f8
|
5 |
All rights reserved. |
T |
6 |
|
|
7 |
Redistribution and use in source and binary forms, with or without modification, |
|
8 |
are permitted provided that the following conditions are met: |
|
9 |
|
|
10 |
* Redistributions of source code must retain the above copyright notice, |
|
11 |
this list of conditions and the following disclaimer. |
|
12 |
* Redistributions in binary form must reproduce the above copyright notice, |
|
13 |
this list of conditions and the following disclaimer in the documentation |
|
14 |
and/or other materials provided with the distribution. |
|
15 |
* Neither the name of ISPConfig nor the names of its contributors |
|
16 |
may be used to endorse or promote products derived from this software without |
|
17 |
specific prior written permission. |
|
18 |
|
|
19 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
|
20 |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
21 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
22 |
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
|
23 |
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
24 |
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
25 |
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
|
26 |
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|
27 |
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
|
28 |
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
29 |
*/ |
|
30 |
|
|
31 |
class nodetree { |
d84050
|
32 |
public $childs; |
P |
33 |
public $btext; |
|
34 |
public $id; |
b5a2f8
|
35 |
} |
T |
36 |
|
|
37 |
class cmstree |
|
38 |
{ |
d84050
|
39 |
//TODO is this used ?? - pedro |
P |
40 |
//var $_table; |
b5a2f8
|
41 |
|
d84050
|
42 |
// $vars enth�lt: |
b5a2f8
|
43 |
// - parent :id des Elternelementes |
T |
44 |
// - type :n = node, i = item |
|
45 |
// - doctype_id :id des Dokumententyps, wenn nicht im content Feld |
|
46 |
// - title :Titel des Eintrages |
|
47 |
// - status :1 = ok, d = delete |
|
48 |
// - icon :icon im node-tree, optional |
|
49 |
// - modul :modul des Eintrages, noch nicht verwendet |
d84050
|
50 |
// - doc_id :id des zugeh�rigen Dokumentes |
b1a6a5
|
51 |
|
d84050
|
52 |
public function node_list() |
b5a2f8
|
53 |
{ |
d84050
|
54 |
global $app; |
b1a6a5
|
55 |
|
d84050
|
56 |
$nodes = $app->db->queryAllRecords('SELECT * FROM media_cat order by sort, name'); |
b1a6a5
|
57 |
|
b5a2f8
|
58 |
$optionlist = array(); |
T |
59 |
$my0 = new nodetree(); |
|
60 |
|
|
61 |
foreach($nodes as $row) { |
|
62 |
|
d84050
|
63 |
$id = 'my'.$row['media_cat_id']; |
P |
64 |
$btext = $row['name']; |
|
65 |
$ordner = 'my'.$row['parent']; |
b5a2f8
|
66 |
if(!is_object($$id)) $$id = new nodetree(); |
T |
67 |
$$id->btext = $btext; |
d84050
|
68 |
$$id->id = $row['media_cat_id']; |
b5a2f8
|
69 |
|
T |
70 |
if(is_object($$ordner)) { |
|
71 |
$$ordner->childs[] = &$$id; |
|
72 |
} else { |
|
73 |
$$ordner = new nodetree(); |
|
74 |
$$ordner->childs[] = &$$id; |
|
75 |
} |
|
76 |
} |
b1a6a5
|
77 |
|
MC |
78 |
$this->ptree($my0, 0, $optionlist); |
d84050
|
79 |
return is_array($nodes) ? $optionlist : false; |
b5a2f8
|
80 |
} |
b1a6a5
|
81 |
|
d84050
|
82 |
private function ptree($myobj, $tiefe, &$optionlist){ |
b5a2f8
|
83 |
global $_SESSION; |
T |
84 |
$tiefe += 1; |
|
85 |
$id = $myobj->id; |
|
86 |
|
d84050
|
87 |
if(is_array($myobj->childs) and ($_SESSION['s']['cat_open'][$id] == 1 or $tiefe <= 1)) { |
b5a2f8
|
88 |
foreach($myobj->childs as $val) { |
T |
89 |
// kategorie => str_repeat('- ',$tiefe) . $val->btext, |
b1a6a5
|
90 |
|
b5a2f8
|
91 |
// Ergebnisse Formatieren |
T |
92 |
/* |
|
93 |
if($tiefe == 0) { |
|
94 |
$kategorie = "<div class='mnuLevel".$tiefe."'><a href='index.php?pg=liste&kat=".$val->id."' class='navKategorien'>".$val->btext."</a></div>"; |
|
95 |
} elseif ($tiefe == 1) { |
|
96 |
$kategorie = "<div class='mnuLevel".$tiefe."'><img src='images/listenpunkt.gif'> <a href='index.php?pg=liste&kat=".$val->id."' class='navKategorien'>".$val->btext."</a></div>"; |
|
97 |
} else { |
|
98 |
$kategorie = "<div class='mnuLevel".$tiefe."'> <a href='index.php?pg=liste&kat=".$val->id."' class='navKategorien'>".str_repeat('- ',$tiefe - 1) . $val->btext."</a></div>"; |
|
99 |
} |
|
100 |
*/ |
|
101 |
$val_id = $val->id; |
d84050
|
102 |
if($_SESSION['s']['cat_open'][$val_id] == 1) { |
e27086
|
103 |
$kategorie = "<div class='mnuLevel".$tiefe."'> <a href='treenavi.php?kat=".$val->id."' class='navtext' onclick=\"parent.content.location='media_list.php?search_media_cat_id=".$val->id."'\" style=\"text-decoration: none;\"><img src='../themes/default/icons/folder.png' border='0'> ".$val->btext."</a></div>"; |
b5a2f8
|
104 |
} else { |
e27086
|
105 |
$kategorie = "<div class='mnuLevel".$tiefe."'> <a href='treenavi.php?kat=".$val->id."' class='navtext' onclick=\"parent.content.location='media_list.php?search_media_cat_id=".$val->id."'\" style=\"text-decoration: none;\"><img src='../themes/default/icons/folder_closed.png' border='0'> ".$val->btext."</a></div>"; |
b5a2f8
|
106 |
} |
b1a6a5
|
107 |
|
b5a2f8
|
108 |
$optionlist[] = array( media_cat => $kategorie, |
T |
109 |
media_cat_id => $val->id, |
|
110 |
depth => $tiefe); |
|
111 |
$this->ptree($val, $tiefe, $optionlist); |
|
112 |
} |
|
113 |
} |
|
114 |
} |
|
115 |
|
|
116 |
} |
b1a6a5
|
117 |
?> |