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

Annotation of /nfo/php/libs/org.netfrag.app/WebExplorer/utils.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Sun Apr 6 01:28:04 2003 UTC (21 years, 4 months ago) by jonen
Branch: MAIN
+ initial commit
+ moved decode functions here
+ reworked decode functions to use new LinkBuilder class

1 jonen 1.1 <?php
2    
3     /**
4     * $Id: MVC.php,v 1.5 2003/04/05 21:18:29 joko Exp $
5     *
6     * $Log: MVC.php,v $
7     *
8     *
9     */
10    
11     /**
12     * Container holds most helper functions are used at the WebExplorer itself
13     * or at its components, e.g. decode functions used at the GUI modules.
14     *
15     *
16     * @author Sebastian Utz <seut@tunemedia.de>
17     * @package org.netfrag.app
18     * @name WebExplorer::utils
19     *
20     */
21    
22    
23     class WebExplorer_utils {
24    
25    
26    
27     // TODO: refactor to Data::Lift - subcomponent: handling will get way more easy!
28     function decode_item_array($item, $hidden_elements, $options) {
29     //$options = $this->_options['decode_args'];
30     //print "item: " . Dumper($item);
31     //print "options: " . Dumper($options);
32     if( is_array($item) ) {
33     //$cur_row_index = $this->_datasource->get_cur_data_index();
34     //$parent_guid = $this->_datasource->_data[$cur_row_index]['guid'];
35     // build list for selection form
36     if($options['form']) {
37     foreach($item as $key => $value) {
38     $tmp = split($options['seperator'], $value);
39     $ident = $tmp['1'];
40     $meta = $tmp['2'];
41     $list[$key] = $ident;
42     }
43     if(is_array($list) ) {
44     $container = container(
45     form_open( $item[0], $_SERVER["PHP_SELF"], "POST" ),
46     form_hidden("ecdm", $meta),
47     form_select("ecdid", $list),
48     form_submit("submit","view" )
49     );
50     foreach($hidden_elements as $label => $value) {
51     $container->add(form_hidden($label, $value));
52     }
53     $container->add(form_close() );
54     $item = $container;
55     }
56     } else {
57     //print "<b>2</b><br/>";
58     $container = container();
59     foreach($item as $key => $value) {
60     $tmp = split($options['seperator'], $value);
61     $ident = $tmp['1'];
62     $meta = $tmp['2'];
63    
64     $link_vars = array(
65     'ecdid' => $ident,
66     'ecdm' => $meta,
67     );
68    
69     foreach($hidden_elements as $label => $value) {
70     $link_vars[$label] = $value;
71     //$tmp_array[] = $label . "=" . $value;
72     }
73    
74     //$str_hidden = join("&", $tmp_array);
75     //$container->add("->", html_a($_SERVER["PHP_SELF"] . "?ecdid=" . $ident . "&ecdm=" . $meta . "&" . $str_hidden, $key . " view"), html_br());
76    
77     // create new LinkBuilder instance and get link GUID by saving vars
78     $linkbuilder = new LinkBuilder();
79     $link_guid = $linkbuilder->save($link_vars);
80    
81     $container->add("->", html_a($_SERVER["PHP_SELF"] . "?lbid=" . $link_guid, $key . " view"), html_br());
82     }
83     $item = $container;
84     }
85     return $item;
86     }
87     }
88    
89     // decodes serialized string representations of object-references
90     // TODO: refactor to Data::Lift - subcomponent: handling will get way more easy!
91     function decode_item_expr($item, $hidden_elements, $options) {
92     //$options = $this->_options['decode_args'];
93     //print "item: $item<br/>";
94     if(substr($item, 0, 2) == "o_") {
95     $tmp = split($options['seperator'], $item);
96     $ident = $tmp['1'];
97     $meta = $tmp['2'];
98    
99     $link_vars = array(
100     'ecdid' => $ident,
101     'ecdm' => $meta,
102     );
103     foreach($hidden_elements as $label => $value) {
104     $link_vars[$label] = $value;
105     //$tmp_array[] = $label . "=" . $value;
106     }
107    
108     //$str_hidden = join("&", $tmp_array);
109     //$item = html_a($_SERVER["PHP_SELF"] . "?ecdid=" . $ident . "&ecdm=" . $meta . "&" . $str_hidden, "view");
110    
111     $linkbuilder = new LinkBuilder();
112     $link_guid = $linkbuilder->save($link_vars);
113     $item = html_a($_SERVER["PHP_SELF"] . "?lbid=" . $link_guid, "view");
114    
115     return $item;
116     }
117     }
118    
119    
120    
121     }
122    
123    
124     ?>

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