Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

shippingtypes.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: shippingtypes.php 6233 2001-07-20 11:42:02Z jakobn $
5 //
6 // Created on: <22-Feb-2001 11:38:37 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 // include_once( "classes/INIFile.php" );
29 // include_once( "classes/eztemplate.php" );
30 // include_once( "classes/ezhttptool.php" );
31
32 $ini =& eZINI::instance( 'site.ini' );
33
34 $Language = $ini->variable( "eZTradeMain", "Language" );
35
36 // include_once( "eztrade/classes/ezshippingtype.php" );
37 // include_once( "eztrade/classes/ezshippinggroup.php" );
38
39 // include_once( "eztrade/classes/ezvattype.php" );
40
41
42 if ( isset( $Action ) && $Action == "Store" )
43 {
44 if ( is_numeric( $DefaultTypeID ) )
45 {
46 $type = new eZShippingType( $DefaultTypeID );
47 $type->setAsDefault();
48 }
49
50
51 if ( is_array( $TypeID ) )
52 {
53 $i = 0;
54 foreach ( $TypeID as $id )
55 {
56 $vatType = new eZVATType( $VATTypeID[$i] );
57
58 $shippingType = new eZShippingType( $id );
59 $shippingType->setName( $TypeName[$i] );
60 $shippingType->setVATType( $vatType );
61 $shippingType->store();
62 $i++;
63 }
64 }
65
66
67 if ( is_array( $GroupID ) )
68 {
69 $i = 0;
70 foreach ( $GroupID as $id )
71 {
72 $shippingGroup = new eZShippingGroup( $id );
73 $shippingGroup->setName( $GroupName[$i] );
74 $shippingGroup->store();
75 $i++;
76 }
77 }
78
79 if ( is_array( $ValueGroupID ) )
80 {
81 $i = 0;
82 foreach ( $ValueGroupID as $groupID )
83 {
84 $shippingType = new eZShippingType( $ValueTypeID[$i] );
85 $shippingGroup = new eZShippingGroup( $groupID );
86 $shippingGroup->setStartAddValue( $shippingType, $StartValue[$i], $AddValue[$i] );
87 $i++;
88 }
89 }
90 }
91
92 if ( isset( $Action ) && $Action == "AddType" )
93 {
94 $shippingType = new eZShippingType();
95 $shippingType->setName( "" );
96 $shippingType->store();
97 }
98
99 if ( isset( $Action ) && $Action == "AddGroup" )
100 {
101 $shippingType = new eZShippingGroup();
102 $shippingType->setName( "" );
103 $shippingType->store();
104 }
105
106
107 if ( isset( $Action ) && $Action == "DeleteSelected" )
108 {
109 if ( count( $DeleteType ) > 0 )
110 foreach ( $DeleteType as $id )
111 {
112 $shippingType = new eZShippingType( $id );
113 $shippingType->delete();
114 }
115
116 if ( count( $DeleteGroup ) > 0 )
117 foreach ( $DeleteGroup as $id )
118 {
119 $shippingGroup = new eZShippingGroup( $id );
120 $shippingGroup->delete();
121 }
122 }
123
124
125 $t = new eZTemplate( "kernel/eztrade/admin/" . $ini->variable( "eZTradeMain", "AdminTemplateDir" ),
126 "kernel/eztrade/admin/intl/", $Language, "shippingtypes.php" );
127
128 $t->setAllStrings();
129
130 $t->set_file( array( "shipping_types_tpl" => "shippingtypes.tpl" ) );
131
132 $t->set_block( "shipping_types_tpl", "type_item_tpl", "type_item" );
133 $t->set_block( "type_item_tpl", "vat_item_tpl", "vat_item" );
134 $t->set_block( "shipping_types_tpl", "group_item_tpl", "group_item" );
135 $t->set_block( "shipping_types_tpl", "header_item_tpl", "header_item" );
136 $t->set_block( "group_item_tpl", "type_group_item_tpl", "type_group_item" );
137
138
139 $shippingGroup = new eZShippingGroup();
140 $groups =& $shippingGroup->getAll();
141
142 $shippingType = new eZShippingType();
143 $shippingTypes =& $shippingType->getAll();
144
145
146 $t->set_var( "type_item", "" );
147 $t->set_var( "header_item", "" );
148
149 // set the header
150 foreach ( $shippingTypes as $type )
151 {
152 $t->set_var( "shipping_type_name", $type->name() );
153 $t->set_var( "type_id", $type->id() );
154 if ( $type->isDefault() )
155 $t->set_var( "default_checked", "checked" );
156 else
157 $t->set_var( "default_checked", "" );
158
159
160 $currentVATType =& $type->vatType();
161
162 $vatType = new eZVATType();
163
164 $types =& $vatType->getAll();
165
166 $i=0;
167 $t->set_var( "vat_item", "" );
168 foreach ( $types as $item )
169 {
170 if ( is_a( $currentVATType, "eZVATType" ) )
171 {
172 if ( $currentVATType->id() == $item->id() )
173 {
174 $t->set_var( "vat_selected", "selected" );
175 }
176 else
177 {
178 $t->set_var( "vat_selected", "" );
179 }
180 }
181 else
182 {
183 $t->set_var( "vat_selected", "" );
184 }
185 $t->set_var( "vat_id", $item->id() );
186 $t->set_var( "vat_name", $item->name() );
187 $t->set_var( "vat_value", $item->value() );
188
189 $t->parse( "vat_item", "vat_item_tpl", true );
190
191 $i++;
192 }
193
194 $t->parse( "type_item", "type_item_tpl", true );
195 $t->parse( "header_item", "header_item_tpl", true );
196 }
197
198 $t->set_var( "group_item", "" );
199
200 $i=0;
201 foreach ( $groups as $group )
202 {
203 if ( ( $i % 2 ) == 0 )
204 {
205 $t->set_var( "td_class", "bglight" );
206 }
207 else
208 {
209 $t->set_var( "td_class", "bgdark" );
210 }
211
212 $t->set_var( "group_id", $group->id() );
213 $t->set_var( "shipping_group_name", $group->name() );
214
215 $t->set_var( "type_group_item", "" );
216 foreach ( $shippingTypes as $type )
217 {
218 $values =& $group->startAddValue( $type );
219
220 $t->set_var( "value_group_id", $group->id() );
221 $t->set_var( "value_type_id", $type->id() );
222
223
224 $t->set_var( "start_value", $values["StartValue"] );
225 $t->set_var( "add_value", $values["AddValue"] );
226
227 $t->parse( "type_group_item", "type_group_item_tpl", true );
228 }
229
230 $t->parse( "group_item", "group_item_tpl", true );
231 $i++;
232 }
233
234 $t->pparse( "output", "shipping_types_tpl" );
235
236 ?>
$group
$group
Definition: admin/articleedit.php:799
$types
$types
Definition: articlepreview.php:108
eZShippingGroup
Definition: ezshippinggroup.php:44
eZShippingType
Definition: ezshippingtype.php:45
eZTemplate
Definition: eztemplate.php:107
eZVATType
Definition: ezvattype.php:41
$item
$item
Definition: classes/admin/linklist.php:228
$type
$type
Definition: classes/admin/linkselect.php:220
$Action
$Action
Definition: companysearch.php:80
$id
$id
Definition: companytypelist.php:193
$groupID
$groupID
Definition: ezgroupeventcalendar/user/dayview.php:90
$values
$values
Definition: fixedvalues.php:103
$GroupID
$GroupID
Definition: rssheadlines.php:51
$groups
$groups
Definition: shippingtypes.php:140
$shippingType
$shippingType
Definition: shippingtypes.php:142
$shippingGroup
$shippingGroup
Definition: shippingtypes.php:139
$i
$i
Definition: shippingtypes.php:200
$Language
$Language
Definition: shippingtypes.php:34
$ini
$ini
Definition: shippingtypes.php:32
$t
if(isset( $Action) && $Action=="Store") if(isset( $Action) && $Action=="AddType") if(isset( $Action) && $Action=="AddGroup") if(isset( $Action) && $Action=="DeleteSelected") $t
Definition: shippingtypes.php:125
$shippingTypes
$shippingTypes
Definition: shippingtypes.php:143
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.