1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
<?php include_once('../../check_login.php'); ini_set('display_errors',0); $id = $_GET["refid"]; if($id){ $sth1 = $dbh->prepare("SELECT * FROM redemption_event WHERE refid =?"); $parameter = array((int)$id); if (!$sth1->execute($parameter)){ throw new Exception('[' . $sth1->errorCode() . ']: ' . print_r($sth1->errorInfo())); } $row = $sth1->fetch(PDO::FETCH_ASSOC); if (!$sth1->execute($parameter)){ throw new Exception('[' . $sth1->errorCode() . ']: ' . print_r($sth1->errorInfo())); $row = $sth1->fetch(PDO::FETCH_ASSOC); $sql99 = "SELECT * FROM sys_cms_login WHERE cmsloginid=?"; $sth99 = $dbh->prepare($sql99); $sth99->execute(array((int)$row{'lastupby'})); $row99 = $sth99->fetch(PDO::FETCH_ASSOC); } } ?> <!DOCTYPE html> <html> <head> <?php include_once('../../head.php'); ?> <script type="text/javascript" src="../../js/validation.js"></script> <script type="text/javascript" src="../../js/jquery-ui-1.8.18.custom.min.js"></script> <link type="text/css" href="../../css/smoothness/jquery-ui-1.8.18.custom.css" rel="stylesheet"/> <script type="text/javascript" src="../../../js/chosen.jquery.js"></script> <script type="text/javascript" src="../../../js/chosen.jquery.min.js"></script> <link type="text/css" href="../../../css/chosen.css" rel="stylesheet"/> <script> $(function () { $('.select').chosen(); $("#date,#postdate,#purchase_date_to,#purchase_date_from").datepicker({ dateFormat: 'yy-mm-dd'}); }); function DeleteRow(refid) { if (confirm("Are You Confirm Delete?")) { window.location.href = 'redemption_event_code_delete.php?id=<?=$id?>&refid=' + refid; } } function delSerialNumber(thisbox){ $(thisbox).parent().parent().remove(); if($('#LiSerialNumberBox tr').size() == 1){ $('#LiSerialNumberBox').hide(); } } function addSerialNumber(){ if($('#LiSerialNumberBox tr').size() > 0){ $('#LiSerialNumberBox').show(); } $('#LiSerialNumberBox').append('<tr><td height="30" valign="top"><input type="hidden" name="code[defult][]" value="33"/>33</td><td valign="top"><input type="text" class="inputer required" name="code[number][]" placeholder="XXX" style="width:50px; min-width:50px;" maxlength="3" value=""/></td><td valign="top"><input type="text" class="inputer required" name="code[date][]" placeholder="YYMM" style="width:50px; min-width:50px;" maxlength="4" value=""/></td><td valign="top"><input type="text" class="inputer required" name="code[to][]" placeholder="00001" style="width:50px; min-width:50px;" maxlength="5" value=""/></td><td valign="top"><input type="text" class="inputer required" name="code[from][]" placeholder="99999" style="width:50px; min-width:50px;" maxlength="5" value=""/></td><td valign="top"><input type="button" value="Delete" style="height:26px;" onclick="delSerialNumber(this)"/></td></tr>'); } function save(){ var error = false; if($('#photo').val()){ var check = false; var str=$('#photo').val(); var checkArray = new Array('JPG','jpg','PNG','png'); for(var i=0;i<checkArray.length;i++){ if(str.indexOf(checkArray[i]) > 0){ check = true; } } if(check == false){ $('#e4').show(); error = true; }else{ var total_upload_qualification_file_size = 0; if($("#photo")[0].files[0]){ total_upload_qualification_file_size += parseFloat($("#photo")[0].files[0].size/1024/1024); } if(total_upload_qualification_file_size > 2){ $('#e5').show(); error = true; } } } if($("#LiForm").valid() && error == false){ $("#LiForm").submit(); } } </script> </head> <body> <form action="redemption_event_process.php" id="LiForm" method="post" name="addform" enctype="multipart/form-data"> <? if($id){?> <input type="hidden" name="id" value="<?=$id?>"/> <? }?> <table width="1000" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="70" align="right" valign="middle" class="icontxt"><table border="0" cellpadding="0" cellspacing="0"> <tr> <td width="50" align="center" style="font-size: 12px;"><img type="image" src="../../images/iconSave.png" width="32" height="32" border="0" onClick="save()" style="cursor:pointer;"> Save </td> <td width="50" align="center"><a href="redemption_event_index.php?msg=Cancel"><img src="../../images/iconCancel.png" alt="Cancel" width="32" height="32" border="0"><br> Cancel </a></td> <td> </td> </tr> </table></td> </tr> <tr> <td class="pagetitletxt"> <b><img src="../../images/iconList.jpg" width="48" height="48" align="absmiddle"/> Redemption Event > <?=$id?'Edit':'Add'?> </b> <? if($id){?> <span style="float:right;" class="msg">Last Update: <?= $row99{'cmsloginname'} . ' ' . $row{'lastupdate'}; ?> </span> <? }?></td> </tr> <tr> <td align="left" valign="middle"><!-- Content --> <div id="LiContentTable"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td width="120" align="left" valign="middle" class='content'>Post Date</td> <td class='content' valign="middle">: </td> <td class='content'><input type="text" class="inputer required date" name="postdate" value="<?=$row['postdate']?>" id="postdate"></td> </tr> <tr> <td width="120" align="left" valign="middle" class='content'>Purchase date period</td> <td class='content' valign="middle">: </td> <td class='content'> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td>To : </td> <td><input type="text" class="inputer required date" name="purchase_date_to" value="<?=$row['purchase_date_to']?>" id="purchase_date_to"></td> <td>From : </td> <td><input type="text" class="inputer required date" name="purchase_date_from" value="<?=$row['purchase_date_from']?>" id="purchase_date_from"></td> </tr> </table></td> </tr> <tr> <td width="120" align="left" valign="middle" class='content'>Date</td> <td class='content' valign="middle">: </td> <td class='content'><input type="text" class="inputer required date" name="date" value="<?=$row['date']?>" id="date"></td> </tr> <?php foreach ($arraylangcode as $langcode => $langname) { ?> <tr> <td width="120" align="left" valign="middle" class='content'>Title<br> [ <?= $langname ?> ]</td> <td class='content' valign="middle">: </td> <td class='content'><input type="text" class="inputer required" name="name_<?= $langcode ?>" size="80" maxlength="200" value="<?=$row['name_'.$langcode]?>"/></td> </tr> <?php } ?> <?php foreach ($arraylangcode as $langcode => $langname) { ?> <tr> <td width="120" align="left" valign="middle" class='content'>Description<br> [ <?= $langname ?> ]</td> <td class='content' valign="middle">: </td> <td class='content'><textarea name="description_<?= $langcode ?>" style="height:80px; width:504px;" cols="80" class="inputer required"><?=$row['description_'.$langcode]?> </textarea></td> </tr> <?php } ?> <tr> <td width="120" align="left" valign="middle" class='content'>Country</td> <td width="5" valign="middle" class='content'>: </td> <td class='content'><select name="country[]" class="inputer select required" id="name" style="width:500px;" multiple="multiple"> <option value="">-Please Select-</option> <? foreach ($country_list_en as $index => $country ) { ?> <? $sth1 = $dbh->prepare("SELECT count(*) as count FROM redemption_event_country WHERE event_refid = ? and country =?"); $parameter = array($id,(int)$index); if (!$sth1->execute($parameter)){ throw new Exception('[' . $sth1->errorCode() . ']: ' . print_r($sth1->errorInfo())); } $count_event_country = $sth1->fetch(PDO::FETCH_ASSOC); ?> <option value="<?=$index?>" <? if($count_event_country['count']){?> selected<? }?>><?=$country?></option> <? }?> </select></td> </tr> <?php foreach ($arraylangcode as $langcode => $langname) { ?> <tr> <td width="100" align="left" valign="middle" class='content'>Photo<br> [ <?= $langname; ?> ]</td> <td width="5" align="left" valign="middle" class='content'>: </td> <td class='content'><? $width = "width='480'"; $height = "height=''"; ?> <? if($id && $row{'photo_'.$langcode}){?> <div><img src='../../../file/redemption_event/<?=$row{'photo_'.$langcode}?>' <?=$width?> <?=$height?> border='0'></div> <? }?> <input name="photo_<?= $langcode; ?>" type="file" id="photo" class="inputer <? if(!$id || !$row{'photo_'.$langcode}){?>required<? }?>" size="100"/> <div class="error2" id="e4">只能上載JPG,PNG,GIF的圖片檔案</div> <div class="error2" id="e5">上載的檔案不能大於2MB</div> <br/> <span class="msg">Photo Format: jpg,png | Photo Width Size: 480px | File Size: 2MB </span></td> </tr> <?php } ?> <tr> <td width="120" align="left" valign="middle" class='content'>Serial Number</td> <td class='content' valign="middle">: </td> <td class='content'> <? $sth1 = $dbh->prepare("SELECT count(*) as count FROM redemption_event_code WHERE event_refid =?"); $parameter = array((int)$id); if (!$sth1->execute($parameter)){ throw new Exception('[' . $sth1->errorCode() . ']: ' . print_r($sth1->errorInfo())); } $count_event_code = $sth1->fetch(PDO::FETCH_ASSOC); if($count_event_code['count']){ ?> <div style="width:696px; margin-bottom:5px;"> <? $sql = "SELECT * FROM redemption_event_code where event_refid = ?"; $parameters = array($id); if (!($sth = $dbh->prepare($sql))) { throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo())); } if (!$sth->execute($parameters)) { throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo())); } while ($row_code = $sth->fetch(PDO::FETCH_ASSOC)) { $sth1 = $dbh->prepare("SELECT refid,count(*) as count FROM redemption_event_join WHERE event_code_refid =?"); $parameter = array((int)$row_code['refid']); if (!$sth1->execute($parameter)){ throw new Exception('[' . $sth1->errorCode() . ']: ' . print_r($sth1->errorInfo())); } $row_count = $sth1->fetch(PDO::FETCH_ASSOC); ?> <div style="float:left; border:1px solid #999; margin-right:5px; margin-bottom:5px;"> <table border="0" cellpadding="0" cellspacing="5"> <tr> <td><div><? if($row_count['count']>0){?><a href="../redemption_event_join/redemption_event_join_form.php?refid=<?=$row_count['refid']?>"><b><? }?><?=$row_code['serial_number']?><? if($row_count['count']>0){?></b></a><? }?></div></td> <td><input type="button" value="Delete" onClick="DeleteRow(<?=$row_code['refid']?>)"<? if($row_count['count']>0){?> disabled <? }?>/></td> </tr> </table> </div> <? }?> <div style="clear:both;"></div> </div> <? }?> <div> <table border="0" cellpadding="0" cellspacing="0" id="LiSerialNumberBox" style="display:none; margin-bottom:10px;"> <tr> <td style="padding-right:10px;" height="20"><strong>Defult</strong></td> <td style="width:58px;padding-right:10px;"><strong>Number</strong></td> <td style="width:58px;padding-right:10px;"><strong>Date</strong></td> <td style="width:58px;padding-right:10px;"><strong>To</strong></td> <td style="width:58px;"><strong>Form</strong></td> <td></td> </tr> </table> <input type="button" value="Add More Serial Number" onClick="addSerialNumber()"/> </div></td> </tr> </table> </div> <!-- End Content --></td> </tr> <tr> <td align="left" valign="middle"> </td> </tr> </table> </form> </body> </html>
|