Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

voucheredit.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: voucheredit.php 7465 2001-09-26 07:09:33Z ce $
5 //
6 // Created on: <20-Dec-2000 18:24:06 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 // include_once( "classes/ezhttptool.php" );
28
29 if ( isset( $Cancel ) )
30 {
31 eZHTTPTool::header( "Location: /trade/voucherlist/" );
32 exit();
33 }
34
35 // include_once( "classes/INIFile.php" );
36 // include_once( "classes/eztemplate.php" );
37 // include_once( "classes/ezcurrency.php" );
38 // include_once( "classes/ezlocale.php" );
39
40 $ini =& eZINI::instance( 'site.ini' );
41 $Language = $ini->variable( "eZTradeMain", "Language" );
42 $move_item = true;
43
44 // include_once( "eztrade/classes/ezvoucher.php" );
45
46 if ( ( $Action == "Update" ) || ( isset ( $Update ) ) )
47 {
48 $voucher = new eZVoucher( $VoucherID );
49
50 setType( $Price, "integer" );
51
52 $voucher->setPrice( $Price );
53
54 if ( $Available == "on" )
55 $voucher->setAvailable( true );
56 else
57 $voucher->setAvailable( false );
58
59 $voucher->store();
60 }
61
62 if( isset( $Ok ) )
63 {
64 eZHTTPTool::header( "Location: /trade/voucherlist/" );
65 exit();
66 }
67
68 if ( $Action == "Delete" )
69 {
70 $voucher = new eZVoucher( $VoucherID );
71
72 $voucher->delete();
73
74 eZHTTPTool::header( "Location: /trade/voucherlist/" );
75 exit();
76 }
77
78 $t = new eZTemplate( "kernel/eztrade/admin/" . $ini->variable( "eZTradeMain", "AdminTemplateDir" ),
79 "kernel/eztrade/admin/intl/", $Language, "voucheredit.php" );
80
81 $t->setAllStrings();
82
83 $t->set_file( array( "voucher_edit_tpl" => "voucheredit.tpl" ) );
84
85 $t->set_block( "voucher_edit_tpl", "used_list_tpl", "used_list" );
86 $t->set_block( "used_list_tpl", "used_item_tpl", "used_item" );
87
88 $locale = new eZLocale( $Language );
89 $currency = new eZCurrency();
90
91 $t->set_var( "action_value", "Insert" );
92
93 // edit
94 if ( $Action == "Edit" )
95 {
96 $voucher = new eZVoucher( $VoucherID );
97
98 $currency->setValue( $voucher->price() );
99 $t->set_var( "voucher_price", $voucher->price() );
100 $t->set_var( "voucher_created", $locale->format( $voucher->created() ) );
101 $t->set_var( "action_value", "Update" );
102 $t->set_var( "voucher_id", $voucher->id() );
103
104 $usedList =& $voucher->usedList();
105
106 $count = count ( $usedList );
107
108 $voucherInfo =& $voucher->information();
109
110 if ( $voucherInfo->mailMethod() == 1 )
111 {
112 $mail =& $voucherInfo->online();
113 $t->set_var( "sent_email", $mail->url() );
114 $t->set_var( "sent_description", $voucherInfo->description() );
115 }
116 else if ( $voucherInfo->mailMethod() == 2 )
117 {
118
119 }
120
121 if ( $voucher->isAvailable() )
122 $t->set_var( "is_checked", "checked" );
123 else
124 $t->set_var( "is_checked", "" );
125
126 $i=0;
127 foreach ( $usedList as $used )
128 {
129 if ( ( $i %2 ) == 0 )
130 $t->set_var( "td_class", "bglight" );
131 else
132 $t->set_var( "td_class", "bgdark" );
133
134 $currency->setValue( $used->price() );
135 $t->set_var( "used_price", $locale->format( $currency ) );
136 $t->set_var( "used_used", $locale->format( $used->used() ) );
137
138 $localUser =& $used->user();
139
140 $t->set_var( "user_name", $localUser->firstName() . " " . $localUser->lastName() );
141 $t->set_var( "user_id", $localUser->id() );
142
143 $order =& $used->order();
144
145 $t->set_var( "voucher_order_id", $order->id() );
146 $t->parse( "used_item", "used_item_tpl", true );
147 $i++;
148 }
149
150 if ( count( $usedList ) > 0 )
151 {
152 $t->parse( "used_list", "used_list_tpl", true );
153 }
154 else
155 {
156 $t->set_var( "used_list", "" );
157 }
158
159 }
160
161 $t->pparse( "output", "voucher_edit_tpl" );
162
163 ?>
$i
$i
Definition: admin/adlist.php:91
$localUser
if(! $user) $localUser
Definition: admin/orderview.php:96
eZCurrency
Definition: ezcurrency.php:46
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZLocale
Definition: ezlocale.php:119
eZTemplate
Definition: eztemplate.php:107
eZVoucher
Definition: ezvoucher.php:54
$Action
$Action
Definition: companysearch.php:80
$mail
$mail
Definition: ezbulkmail/admin/maillist.php:61
exit
exit
Definition: folder.php:81
$count
$count
Definition: onlinetypelist.php:108
$order
$order
Definition: productreport.php:182
$currency
$currency
Definition: voucheredit.php:89
$locale
$locale
Definition: voucheredit.php:88
$ini
if(isset( $Cancel)) $ini
Definition: voucheredit.php:40
$Language
$Language
Definition: voucheredit.php:41
$t
if(( $Action=="Update")||(isset( $Update))) if(isset( $Ok)) if( $Action=="Delete") $t
Definition: voucheredit.php:78
$move_item
$move_item
Definition: voucheredit.php:42
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.