/[cvs]/nfo/php/libs/org.netfrag.app/WebExplorer/Module/NavigationTree.php
ViewVC logotype

Contents of /nfo/php/libs/org.netfrag.app/WebExplorer/Module/NavigationTree.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Wed Aug 11 13:08:19 2004 UTC (20 years ago) by jonen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +20 -5 lines
 bugfix related to (joko's) changes at Data::Lift

1 <?
2 /*
3 ## -----------------------------------------------------------------------------
4 ## $Id: NavigationTree.php,v 1.1 2003/04/19 16:18:16 jonen Exp $
5 ## -----------------------------------------------------------------------------
6 ## $Log: NavigationTree.php,v $
7 ## Revision 1.1 2003/04/19 16:18:16 jonen
8 ## initial commit
9 ##
10 ##
11 ##
12 ## -----------------------------------------------------------------------------
13 */
14
15 loadModule('WebExplorer::Module::AbstractGUIModule');
16
17 require_once('Tree/Tree.php');
18
19 class WebExplorer_Module_NavigationTree extends WebExplorer_Module_AbstractGUIModule {
20
21 var $source;
22 var $result;
23 var $tree;
24
25 function set_gui_object() {
26 $this->_gui_object = $this->buildTree();
27 }
28
29
30 function buildTree() {
31
32 //print "args: " . Dumper($this->_args);
33
34 $locator_meta = $this->_args['options']['data_locator_meta'];
35 //if (!$this->_args[caption]) { $this->_args[caption] = $locator_meta[ident] . " as " . $locator_meta[abstract_type]; }
36 if (!$this->_args[caption]) { $this->_args[caption] = ""; }
37
38
39 // query data
40 $initial_locator = php::mkComponent( 'DataSource::Locator', array( adapter_type => 'free' ) );
41 $proxy = php::mkComponent('DataSource::Generic', $initial_locator, $this->_args['options']['data_locator_meta']);
42 //print "proxy: " . Dumper($proxy);
43
44 if ($this->source = $proxy->get_adapter()) {
45 //print "source: " . Dumper($this->source);
46 $this->source->do_query();
47 }
48
49 //print "result: " . Dumper($this->source->_result);
50
51 // get navigation data structure (nested tree) from backend object
52 // remote or locally? we just don't care here....
53 //global $backend;
54
55 // V1 - HACK!!!
56 //$this->backend = new TsBackend();
57 //$treedata = $this->backend->getNavigationTree();
58
59 // V2 - better
60 $treedata = $this->source->get_result();
61
62 //print Dumper($treedata);
63
64 /*
65 $treedata = array(
66 //'name' => '', attributes => array( url => '123' ),
67 'children' => array(
68 array( name => 'Login', attributes => array( url => linkargs::topic('Login') ) ),
69 array( name => 'Verwaltung', attributes => array( url => linkargs::topic('Overview') ),
70 'children' => array(
71 array( name => 'Jobs', attributes => array( url => linkargs::topic('Jobs') ) ),
72 array( name => 'Daten:Backend', attributes => array( url => linkargs::topic('DataBrowser') ) ),
73 array( name => 'Daten:Frontend', attributes => array( url => linkargs::topic('DataBrowser') ) ),
74 array( name => 'Daten:Steuerung', attributes => array( url => linkargs::topic('DataBrowser') ) ),
75 ),
76 ),
77 ));
78 */
79
80 $hidden_elements = $this->_args['hidden_elements'];
81 $link_vars = array(
82 't' => $this->_args[caption],
83 'name' => "ecdid",
84 'list' => $hidden_elements
85 );
86
87
88 // convert (speak "lift") data from nested arrays/hashes to a hashified topic tree
89 // this step is required to satisfy the following lifting
90 $lift = mkObject('Data::Lift', $treedata, array( metatype => 'topic', link_args => $link_vars ) );
91 $this->topictree = $lift->to('ExplorerTree');
92 //print "topictree: " . Dumper($this->topictree) . "<br/>";
93
94 //return;
95
96 // V1
97 // convert (speak "lift") data from nested arrays/hashes to a PEAR::Tree object
98 //$lift = mkObject('Data::Lift', $this->topictree, array( metatype => 'tree' ) );
99 //$this->treeobject = $lift->to('PEAR::Tree');
100
101 // V2
102 // have tree in-memory only
103 $this->treeobject = Tree::setup('Memory_Array', $this->topictree);
104 // read tree from database
105 //$memTree = Tree::setup( 'Memory_DBnested' , 'mysql://root@localhost/test', array('table'=>'Tree_Nested') );
106 $this->treeobject->setup();
107
108 //print "treeobject: " . Dumper($this->treeobject) . "<br/>";
109
110
111 // trace
112 //print Dumper($initial_locator);
113 //print Dumper($this->_args);
114
115 //$this->nav = new VerticalCSSNavTable($this->_args['caption'], "", $width="100%");
116 //$this->tree = new VerticalCSSNavTable($this->_args['caption'], "", $width="100%");
117 $this->tree = new DHTMLTreeNav( $this->treeobject );
118
119 //$this->tree->add(link::topic('DataBrowser'), "No data.");
120
121
122 /*
123 // check valid/non-empty result
124 //if ($itemCount = $this->source->get_total_rows()) {
125 if (1) {
126 $this->result = $this->source->_result;
127
128 // trace
129 //print Dumper($source->_result);
130
131 //if (is_array($result)) {
132 $this->propagate();
133 //}
134
135 } else {
136
137 // both are valid! (at least - should be...)
138 //$nav->add(pageLink('explorer'), "No data.");
139 //$this->nav->add(link::topic('DataBrowser'), "No data.");
140 print "No data.<br/>";
141
142 }
143 */
144
145
146 $container = html_div();
147 $container->add( $this->tree, html_br() );
148
149 return $container;
150
151 }
152
153
154
155 }
156
157 ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed