Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezaddress/admin/typelist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: typelist.php 6204 2001-07-19 12:06:56Z jakobn $
5 //
6 // Created on: <23-Oct-2000 17:53:46 bf>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 //
10 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 /*
28 This code can be reused for simple type lists. It requires an object with the following functions:
29 name(): Used for reading the name of the type.
30 id(): Used for retrieving the id of the type in the database
31
32 The object list must be initialized in the $item_type_array variable.
33 Also these following variables must be set properly.
34 $language_file: The file used for reading language translations, for example: consultationtype.php
35 $page_path: The base name of the url, for example: /address/consultationtype
36 You can also enable item placement by setting the $move_item variable to true, to make sure an
37 item can be moved it must implement the moveUp() and moveDown() functions.
38 If the $SortPage variable is set all items will have hyperlinked names linked to the variable content.
39 If $Searchable is set to true a search button is added.
40 If $template_array, $variable_array and $block_array is set they are used for extending the
41 list with extra information.
42 */
43
44 $ini =& eZINI::instance( 'site.ini' );
45 $Language = $ini->variable( "eZAddressMain", "Language" );
46 $DOC_ROOT = $ini->variable( "eZAddressMain", "DocumentRoot" );
47
48 // include_once( "classes/eztemplate.php" );
49 // include_once( "classes/ezlist.php" );
50
51 // include_once( "ezuser/classes/ezuser.php" );
52 // include_once( "ezuser/classes/ezusergroup.php" );
53 // include_once( "ezuser/classes/ezmodule.php" );
54 // include_once( "ezuser/classes/ezpermission.php" );
55
56 require( "kernel/ezuser/admin/admincheck.php" );
57
58 $t = new eZTemplate( "kernel/ezaddress/admin/" . $ini->variable( "eZAddressMain", "AdminTemplateDir" ),
59 "kernel/ezaddress/admin/" . "/intl", $Language, $language_file );
60
61 $t->setAllStrings();
62
63 $item_error = true;
64
65 if( empty( $HTTP_REFERER ) )
66 {
67 if( empty( $BackUrl ) )
68 {
69 $back_command = "$page_path/list";
70 }
71 else
72 {
73 $back_command = $BackUrl;
74 }
75 }
76 else
77 {
78 $back_command = $HTTP_REFERER;
79 }
80
81 if ( !isset( $typelist ) )
82 $typelist = "typelist.tpl";
83
84 if ( isset( $template_array ) and isset( $variable_array ) and
85 is_array( $template_array ) and is_array( $variable_array ) )
86 {
87 $standard_array = array( "list_page" => $typelist );
88 $t->set_file( array_merge( $standard_array, $template_array ) );
89 $t->set_file_block( $template_array );
90 if ( isset( $block_array ) and is_array( $block_array ) )
91 $t->set_block( $block_array );
92 $t->parse( $variable_array );
93 }
94 else
95 {
96 $t->set_var( "extra_type_header", "" );
97 $t->set_var( "extra_type_item", "" );
98 $t->set_file( "list_page", $typelist );
99 }
100
101 $t->set_block( "list_page", "list_item_tpl", "list_item" );
102 $t->set_block( "list_item_tpl", "line_item_tpl", "line_item" );
103 $t->set_block( "list_page", "no_line_item_tpl", "no_line_item" );
104 $t->set_block( "list_page", "search_item_tpl", "search_item" );
105
106 $t->set_block( "line_item_tpl", "item_plain_tpl", "item_plain" );
107 $t->set_block( "line_item_tpl", "item_linked_tpl", "item_linked" );
108 $t->set_block( "line_item_tpl", "item_move_up_tpl", "item_move_up" );
109 $t->set_block( "line_item_tpl", "item_separator_tpl", "item_separator" );
110 $t->set_block( "line_item_tpl", "item_move_down_tpl", "item_move_down" );
111 $t->set_block( "line_item_tpl", "no_item_move_up_tpl", "no_item_move_up" );
112 $t->set_block( "line_item_tpl", "no_item_separator_tpl", "no_item_separator" );
113 $t->set_block( "line_item_tpl", "no_item_move_down_tpl", "no_item_move_down" );
114
115 $t->set_var( "no_line_item", "" );
116 $t->set_var( "line_item", "" );
117 $t->set_var( "list_item", "" );
118 $t->set_var( "search_item", "" );
119
120 if( isset( $Action ) && $Action == "list" )
121 {
122 $SearchText = false;
123 $search_encoded = false;
124 $total_types = false;
125 $Max = false;
126 }
127
128 $t->set_var( "item_up_command", "$page_path/up" );
129 $t->set_var( "item_down_command", "$page_path/down" );
130 $t->set_var( "item_edit_command", "$page_path/edit" );
131 $t->set_var( "item_delete_command", "$page_path/delete" );
132 $t->set_var( "item_view_command", "$page_path/view" );
133 $t->set_var( "item_list_command", "$page_path/list" );
134 $t->set_var( "item_new_command", "$page_path/new" );
135 $t->set_var( "item_id", isset( $ItemID ) ? $ItemID : false );
136 $t->set_var( "item_name", isset( $ItemName ) ? $ItemName : false );
137 $t->set_var( "back_url", $back_command );
138 $t->set_var( "item_back_command", $back_command );
139
140 $t->set_var( "action", $Action );
141 $t->set_var( "type", $ListType );
142
143 $SearchText = stripslashes( $SearchText );
144 $t->set_var( "search_form_text", $SearchText );
145 $t->set_var( "search_text", $search_encoded );
146
147 if ( isset( $Searchable ) )
148 $t->parse( "search_item", "search_item_tpl" );
149
150 $count = count( $item_type_array );
151
152 $i = 0;
153 foreach( $item_type_array as $item )
154 {
155 $t->set_var( "item_move_up", "" );
156 $t->set_var( "no_item_move_up", "" );
157 $t->set_var( "item_move_down", "" );
158 $t->set_var( "no_item_move_down", "" );
159 $t->set_var( "item_separator", "" );
160 $t->set_var( "no_item_separator", "" );
161
162 $t->set_var( "item_plain", "" );
163 $t->set_var( "item_linked", "" );
164
165 if ( ( $i %2 ) == 0 )
166 $t->set_var( "bg_color", "bglight" );
167 else
168 $t->set_var( "bg_color", "bgdark" );
169
170 if ( isset( $func_call ) and is_array( $func_call ) )
171 {
172 reset( $func_call );
173 foreach( $func_call as $key => $val )
174 {
175 $t->set_var( $key, $item->$val() );
176 }
177 }
178 else
179 {
180 $t->set_var( "item_id", $item->id() );
181 $t->set_var( "item_name", $item->name() );
182 }
183
184 if ( isset( $SortPage ) )
185 {
186 $t->set_var( "item_sort_command", $SortPage );
187 $t->parse( "item_linked", "item_linked_tpl" );
188 }
189 else
190 {
191 $t->parse( "item_plain", "item_plain_tpl" );
192 }
193
194 if ( $i > 0 && isset( $move_item ) )
195 {
196 $t->parse( "item_move_up", "item_move_up_tpl" );
197 }
198 else
199 {
200 $t->parse( "no_item_move_up", "no_item_move_up_tpl" );
201 }
202
203 if ( $i > 0 && $i < $count - 1 && isset( $move_item ) )
204 {
205 $t->parse( "item_separator", "item_separator_tpl" );
206 }
207 else
208 {
209 $t->parse( "no_item_separator", "no_item_separator_tpl" );
210 }
211
212 if ( $i < $count - 1 && isset( $move_item ) )
213 {
214 $t->parse( "item_move_down", "item_move_down_tpl" );
215 }
216 else
217 {
218 $t->parse( "no_item_move_down", "no_item_move_down_tpl" );
219 }
220
221 $t->parse( "line_item", "line_item_tpl", true );
222
223 $i++;
224 }
225
226 if( $count < 1 )
227 {
228 $t->parse( "no_line_item", "no_line_item_tpl" );
229 }
230 else
231 {
232 $t->parse( "list_item", "list_item_tpl" );
233 }
234
235 eZList::drawNavigator( $t, $total_types, $Max, $Index, "list_page" );
236
237 $t->pparse( "output", "list_page" );
238
239 ?>
$language_file
$language_file
Definition: addresstypeedit.php:30
$item_type_array
$item_type_array
Definition: addresstypelist.php:34
$move_item
$move_item
Definition: addresstypelist.php:35
eZList\drawNavigator
static drawNavigator(&$t, $total_types, $max_types, $index, $parent=false, $variables=false)
Definition: ezlist.php:401
eZTemplate
Definition: eztemplate.php:107
$item
$item
Definition: classes/admin/linklist.php:228
$Action
$Action
Definition: companysearch.php:80
$SortPage
$SortPage
Definition: consultationtypelist.php:51
$func_call
$func_call
Definition: countryedit.php:46
$block_array
$block_array
Definition: countryedit.php:44
$template_array
$template_array
Definition: countryedit.php:43
$Max
$Max
Definition: countrylist.php:31
$total_types
$total_types
Definition: countrylist.php:47
$Searchable
$Searchable
Definition: countrylist.php:51
$typelist
$typelist
Definition: countrylist.php:37
$variable_array
$variable_array
Definition: countrylist.php:39
$Index
$Index
Definition: eZPBINIFile.php:499
$ListType
$ListType
Definition: ezaddress/admin/datasupplier.php:31
$DOC_ROOT
$DOC_ROOT
Definition: ezaddress/admin/typelist.php:46
$t
$t
Definition: ezaddress/admin/typelist.php:58
$item_error
$item_error
Definition: ezaddress/admin/typelist.php:63
$i
$i
Definition: ezaddress/admin/typelist.php:152
$Language
$Language
Definition: ezaddress/admin/typelist.php:45
$ini
$ini
Definition: ezaddress/admin/typelist.php:44
$SearchText
$SearchText
Definition: ezaddress/admin/typelist.php:143
$count
$count
Definition: ezaddress/admin/typelist.php:150
$search_encoded
$search_encoded
Definition: ezaddress/admin/typelist_pre.php:49
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.