Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

voucherview.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: voucherview.php 9513 2002-05-08 09:29:01Z vl $
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 // include_once( "classes/INIFile.php" );
30 // include_once( "classes/eztemplate.php" );
31 // include_once( "classes/ezcurrency.php" );
32 // include_once( "classes/ezlocale.php" );
33 // include_once( "classes/eztexttool.php" );
34
35 $ini =& eZINI::instance( 'site.ini' );
36 $Language = $ini->variable( "eZTradeMain", "Language" );
37 $move_item = true;
38
39 // include_once( "eztrade/classes/ezvoucher.php" );
40
41 if ( ( isset( $Action ) && $Action == "Update" ) || ( isset ( $Update ) ) )
42 {
43 $voucher = new eZVoucher( $VoucherID );
44
45 setType( $Price, "integer" );
46
47 $voucher->setPrice( $Price );
48
49 if ( $Available == "on" )
50 $voucher->setAvailable( true );
51 else
52 $voucher->setAvailable( false );
53
54 $voucher->store();
55 }
56
57 if( isset( $Ok ) )
58 {
59 eZHTTPTool::header( "Location: /trade/voucherlist/" );
60 exit();
61 }
62
63 if ( isset( $Action ) && $Action == "Delete" )
64 {
65 $voucher = new eZVoucher( $VoucherID );
66
67 $voucher->delete();
68
69 eZHTTPTool::header( "Location: /trade/voucherlist/" );
70 exit();
71 }
72
73 $t = new eZTemplate( "kernel/eztrade/user/" . $ini->variable( "eZTradeMain", "TemplateDir" ),
74 "kernel/eztrade/user/intl/", $Language, "voucherview.php" );
75
76 $t->setAllStrings();
77
78 $t->set_file( array( "voucher_edit_tpl" => "voucherview.tpl" ) );
79
80 $t->set_block( "voucher_edit_tpl", "view_voucher_tpl", "view_voucher" );
81 $t->set_block( "voucher_edit_tpl", "error_tpl", "error" );
82 $t->set_block( "view_voucher_tpl", "used_list_tpl", "used_list" );
83 $t->set_block( "used_list_tpl", "used_item_tpl", "used_item" );
84
85 $locale = new eZLocale( $Language );
86 $currency = new eZCurrency();
87
88 $t->set_var( "action_value", "Insert" );
89 $t->set_var( "view_voucher", "" );
90
91 if( isset( $Key ) )
92 $t->set_var( "voucher_key", eZTextTool::htmlspecialchars( $Key ) );
93 else
94 $t->set_var( "voucher_key", '' );
95
96 $t->set_var( "error", "" );
97
98 if ( isset ( $Key ) )
99 {
100 $voucher = eZVoucher::getFromKeyNumber( $Key, false );
101 if ( is_a ( $voucher, "eZVoucher" ) )
102 {
103 $currency->setValue( $voucher->price() );
104 $t->set_var( "voucher_price", $locale->format( $currency ) );
105 $t->set_var( "voucher_created", $locale->format( $voucher->created() ) );
106 $t->set_var( "voucher_id", $voucher->id() );
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 $usedList = $voucher->usedList();
122 $i=0;
123 foreach ( $usedList as $used )
124 {
125 if ( ( $i %2 ) == 0 )
126 $t->set_var( "td_class", "bglight" );
127 else
128 $t->set_var( "td_class", "bgdark" );
129
130 $currency->setValue( $used->price() );
131 $t->set_var( "used_price", $locale->format( $currency ) );
132 $t->set_var( "used_used", $locale->format( $used->used() ) );
133
134 $order = $used->order();
135
136 $t->set_var( "voucher_order_id", $order->id() );
137 $t->parse( "used_item", "used_item_tpl", true );
138 $i++;
139 }
140
141 if ( count( $usedList ) > 0 )
142 $t->parse( "used_list", "used_list_tpl", true );
143 else
144 $t->set_var( "used_list", "" );
145
146
147 $t->parse( "view_voucher", "view_voucher_tpl" );
148 }
149 else
150 {
151 $t->parse( "error", "error_tpl" );
152 }
153 }
154
155 $t->pparse( "output", "voucher_edit_tpl" );
156
157 ?>
$i
$i
Definition: admin/adlist.php:91
eZCurrency
Definition: ezcurrency.php:46
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZLocale
Definition: ezlocale.php:119
eZTemplate
Definition: eztemplate.php:107
eZTextTool\htmlspecialchars
static htmlspecialchars( $string)
Definition: eztexttool.php:144
eZVoucher
Definition: ezvoucher.php:54
eZVoucher\getFromKeyNumber
getFromKeyNumber(&$key, $available=true)
Definition: ezvoucher.php:428
$Action
$Action
Definition: companysearch.php:80
$mail
$mail
Definition: ezbulkmail/admin/maillist.php:61
exit
exit
Definition: folder.php:81
$order
$order
Definition: productreport.php:182
$currency
$currency
Definition: voucherview.php:86
$locale
$locale
Definition: voucherview.php:85
$Language
$Language
Definition: voucherview.php:36
$ini
$ini
Definition: voucherview.php:35
$t
if((isset( $Action) && $Action=="Update")||(isset( $Update))) if(isset( $Ok)) if(isset( $Action) && $Action=="Delete") $t
Definition: voucherview.php:73
$move_item
$move_item
Definition: voucherview.php:37
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.