/var/www/hkosl.com/sinomax/survey/webadmin/campaign_modifyform.php


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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
<?php
    
require_once('check_login.php');

    
$id = (int)$_GET["id"];

    
$row get_campaign($id);

    
$sql99        "SELECT * FROM sys_cms_login WHERE cmsloginid=?";
    
$parameters99 = array((int)$row{'lastupby'});
    
$row99        bind_pdo($sql99$parameters99"selectone");

    
$url                   $site_info["skytree_api_hostname"] . 'api/promotionCodeAPI/list';
    
$postData              = array();
    
$promotion_code_master call_curl($url$postData0);
    
$promotion_code_master json_decode($promotion_code_mastertrue);

    
$display_fields = array("fill_user_name" => "User Name""fill_tel" => "Mobile Number""fill_email" => "Email""fill_facebook_name" => "Facebook Name""fill_birthday" => "Birthday");
?>
<!DOCTYPE html>
<html>
<head>
    <?php require_once('html_head.php'); ?>
    <!-- color picker -->
    <link href="js/color_picker/css/evol.colorpicker.min.css" rel="stylesheet"/>
    <script src="js/color_picker/js/evol.colorpicker.min.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(document).ready(function () {
            $("#color").colorpicker();
        });
    </script>

    <script type="text/javascript" src="editor/tinymce.min.js"></script>
    <script type="text/javascript" src="editor/tinymce_init.js"></script>
    <script>
        tinymce_init(".desc", 800, 400);  //1.target element  2.width  3.height
    </script>

    <script>
        function enable_get_points() {
            if ($("#enable_get_points").prop('checked')) {
                $(".enable_get_points").show();
            } else {
                $(".enable_get_points").hide();
                $("input[name='get_points']").val("");
            }
        }

        function enable_promotion_code() {
            if ($("#enable_promotion_code").prop('checked')) {
                $(".enable_promotion_code").show();
            } else {
                $(".enable_promotion_code").hide();
                $("select[name='promotion_code_master_id']").val("");

            }
        }

        function show_not_request_login() {
            $(".not_request_login").show();
            $(".not_request_login input, .not_request_login select").removeAttr("disabled");
            $(".request_login").hide();
            $(".request_login input, .request_login select").attr("disabled", true);
            $(".enable_get_points").hide();
            $("input[name='get_points']").val("");
        }

        function show_request_login() {
            $(".request_login").show();
            $(".request_login input, .request_login select").removeAttr("disabled");
            $(".not_request_login").hide();
            $(".not_request_login input, .not_request_login select").attr("disabled", true);
            enable_get_points();
        }

        $(function () {
            $("#start_date").datepicker({dateFormat: 'yy-mm-dd'});
            $("#end_date").datepicker({dateFormat: 'yy-mm-dd'});

            <?php
            
if($row["user_login"] == "NOT_REQUEST_LOGIN") {
                echo 
"show_not_request_login();";
            }else{
                echo 
"show_request_login();";
            }
            
?>

            $(".choose_not_request_login").on("click", function () {
                show_not_request_login();
            });

            $(".choose_request_login").on("click", function () {
                show_request_login();
            });

            enable_get_points();
            enable_promotion_code();

            $("#enable_promotion_code").on("click", function () {
                enable_promotion_code();
            });

            $("#enable_get_points").on("click", function () {
                enable_get_points();
            });


        });
    </script>

    <script>
        $(function () {
            $("#tabs").tabs();
        });
    </script>

    <style>
        #tabs .ui-widget-header {
            border: 1px solid #aaaaaa;
            background: #cccccc url("images/ui-bg_highlight-soft_75_cccccc_1x100.png") 50% 50% repeat-x;
        }

        #tabs .ui-state-default a, #tabs .ui-state-default a:link, #tabs .ui-state-default a:visited {
            color: #000;
        }

        #tabs .ui-state-active a, #tabs .ui-state-active a:link, #tabs .ui-state-active a:visited {
            color: #1c94c4;
        }

        #tabs .ui-state-hover, #tabs .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, #tabs .ui-state-focus, .ui-widget-content .ui-state-focus, #tabs .ui-widget-header .ui-state-focus {
            border: none;
            background: #fff;
        }

    </style>
</head>
<body>

<form action="campaign_modify.php" method="post" name="modifyform" enctype="multipart/form-data">
    <input type="hidden" name="id" value="<?= $row{'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;">
                            <input type="image" alt="submit" src="images/iconSave.png" width="32" height="32" border="0"><br>
                            &nbsp;Save&nbsp;&nbsp;</a></td>
                        <td width="50" align="center">
                            <a href="campaign_index.php?msg=4"><img src="images/iconCancel.png" alt="Cancel" width="32" height="32" border="0"><br>
                                &nbsp;Cancel&nbsp;&nbsp;</a></td>
                        <td>&nbsp;</td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <span style="float:left;" class="pagetitletxt">
                    &nbsp;&nbsp;<b><img src="images/iconList.jpg" width="48" height="48" align="absmiddle"/> Modify
                        Campaign </b></span><span style="float:right;" class="msg">Last
                    Update: <?= $row99{'cmsusername'} . '&nbsp;&nbsp;&nbsp;' $row{'lastupdate'}; ?></span>
            </td>
        </tr>
        <tr>
            <td align="left" valign="middle"><!-- Content -->
                <table border="0" cellpadding="0" cellspacing="0">

                    <tr>
                        <td width="120" align="right" valign="top" class='content required_field'>Campaign URL
                        </td>
                        <td class='content' valign="top">:&nbsp;</td>
                        <td class='content'>
                            <a href="<?= $site_info["url"] . "campaign.php?id=" $row["id"] . "&campaign=" urlencode($row["name_" $langcode]) ?>" target="_blank">
                                <?= $site_info["url"] . "campaign.php?id=" $row["id"] . "&campaign=" urlencode($row["name_" $langcode]) ?>
                            </a> <br><br>
                        </td>
                    </tr>

                    <?php foreach ($arraylangcode as $langcode => $langname) { ?>
                        <tr>
                            <td width="120" align="right" valign="top" class='content required_field'>
                                Name<br/>[<?= $langname?>]
                            </td>
                            <td class='content' valign="top">:&nbsp;</td>
                            <td class='content'>
                                <input type="text" class="content" name="name_<?= $langcode ?>" value="<?= $row["name_" $langcode?>" style="width: 500px;" required/>
                                <br><br>
                            </td>
                        </tr>
                    <?php ?>

                    <tr>
                        <td width="150" align="right" valign="top" class='content required_field'>
                            Campaign Language
                        </td>
                        <td class='content' valign="top">:&nbsp;</td>
                        <td class='content'>
                            <input type="radio" class="content" name="default_language" value="en" <?=($row["default_language"]=="en"?"checked":"")?>/>English
                            <input type="radio" class="content" name="default_language" value="tc" <?=($row["default_language"]=="tc"?"checked":"")?>/>Traditional Chinese
                            <input type="radio" class="content" name="default_language" value="both" <?=($row["default_language"]=="both"?"checked":"")?>/>Both
                            <br><br>
                        </td>
                    </tr>

                    <tr>
                        <td width="150" align="right" valign="top" class='content'>
                            Hide Campaign Name
                        </td>
                        <td class='content' valign="top">:&nbsp;</td>
                        <td class='content'>
                            <input type="checkbox" class="content" name="hide_campaign_name" value="1" <?= $row["hide_campaign_name"] == "checked" "" ?>/>
                            <br><br>
                        </td>
                    </tr>

                    <tr>
                        <td width="120" align="right" valign="top" class='content required_field'>Background Image<br> (PC)</td>
                        <td width="5" valign="top" class='content'>:&nbsp;</td>
                        <td class='content'><?php if ($row["background_img"] <> '') { ?>
                                <img src="../images/campaign_background/<?= $row["background_img"]; ?>" style="max-width: 500px;"/>
                                <br>
                                <input type="checkbox" name="delimage" value="1">Delete Image<br/><br/>
                            <?php ?>
                            <input name="background_img" type="file" class="content"/><br/>

                            <span class="msg">Image format: gif,jpg,png | File Size: < 2M | Suggested Resolution: Width 1920px </span> <br><br>
                        </td>
                    </tr>

                    <tr>
                        <td width="120" align="right" valign="top" class='content required_field'>Background Image <br>(Mobile)</td>
                        <td width="5" valign="top" class='content'>:&nbsp;</td>
                        <td class='content'><?php if ($row["background_img_mobile"] <> '') { ?>
                                <img src="../images/campaign_background/<?= $row["background_img_mobile"]; ?>" style="max-width: 500px;"/>
                                <br>
                                <input type="checkbox" name="delimage_mobile" value="1">Delete Image<br/><br/>
                            <?php ?>
                            <input name="background_img_mobile" type="file" class="content"/><br/>

                            <span class="msg">Image format: gif,jpg,png | File Size: < 2M | Suggested Resolution: Width 480px</span> <br><br>
                        </td>
                    </tr>


                    <tr>
                        <td width="150" align="right" valign="top" class='content'>Background Color
                        </td>
                        <td class='content' valign="top">:&nbsp;</td>
                        <td class='content'>
                            <input type="text" class="content" name="background_color" value="<?=$row["background_color"]?>" id="color"/>
                            <br><br>
                        </td>

                    <tr>
                        <td width="150" align="right" valign="top" class='content required_field'>
                            Sender Email
                        </td>
                        <td class='content' valign="top">:&nbsp;</td>
                        <td class='content'>
                            <input type="text" class="content" name="sender_email" value="<?= $row["sender_email"?>" style="width: 500px;" required/>
                            <br><br>
                        </td>
                    </tr>

                    <tr>
                        <td width="120" align="right" valign="top" class='content required_field'>User Login
                        </td>
                        <td class='content' valign="top">:&nbsp;</td>
                        <td class='content'>
                            <input type="radio" class="content choose_not_request_login" name="user_login" value="NOT_REQUEST_LOGIN" <?= $row["user_login"] == "NOT_REQUEST_LOGIN" "checked" "" ?> id="" required/>
                            Not Request Login

                            <input type="radio" class="content choose_request_login" name="user_login" value="REQUEST_LOGIN" <?= $row["user_login"] == "REQUEST_LOGIN" "checked" "" ?> required/>
                            Request Login

                            <input type="radio" class="content choose_request_login" name="user_login" value="REQUEST_REGISTRATION" <?= $row["user_login"] == "REQUEST_REGISTRATION" "checked" "" ?> required/>
                            Registration

                            <input type="radio" class="content choose_request_login" name="user_login" value="REQUEST_LOGIN_REGISTRATION" <?= $row["user_login"] == "REQUEST_LOGIN_REGISTRATION" "checked" "" ?> required/>
                            Request Login and Registration

                            <br><br>
                        </td>
                    </tr>

                    <tr class="not_request_login" style="display: none;">
                        <td width="150" align="right" valign="top" class='content'>Display Fields
                        </td>
                        <td class='content' valign="top">:&nbsp;</td>
                        <td class='content'>
                            <?php
                                
foreach ($display_fields as $field_name => $field) {
                                    
/*if($field_name=="fill_user_name" || $field_name=="fill_tel" || $field_name=="fill_email"){
                                        echo "<span style='color: red;'>*</span>";
                                    }else{
                                        echo "<span style='color: white;'>*</span>";
                                    }*/

                                    
echo '<input type="checkbox" name="' $field_name '" value="1" id="' $field_name '" ' . ($row[$field_name] == "checked" "") . '> ' $field '<br>';
                                }
                            
?>
                            <br>
                        </td>
                    </tr>

                    <tr class="request_login" style="display: none;">
                        <td width="150" align="right" valign="top" class='content'>Enable Get Points?
                        </td>
                        <td class='content' valign="top">:&nbsp;</td>
                        <td class='content'>
                            <input type="checkbox" name="enable_get_points" value="1" id="enable_get_points" <?= $row["enable_get_points"] == "checked" "" ?>>
                            Yes <br><br>
                        </td>
                    </tr>

                    <tr class="enable_get_points" style="display: none;">
                        <td width="150" align="right" valign="top" class='content required_field'>Points Operator
                        </td>
                        <td class='content' valign="top">:&nbsp;</td>
                        <td class='content'>
                            <input type="radio" class="content" name="points_operator" value="+" <?= $row["points_operator"] == "+" "checked" "" ?>/>
                            Add (+)
                            <!--<input type="radio" class="content" name="points_operator" value="x" <? /*=$row["points_operator"] == "x"?"checked":""*/ ?>/> Multiple (x)-->
                            <br><br>
                        </td>
                    </tr>

                    <tr class="enable_get_points" style="display: none;">
                        <td width="150" align="right" valign="top" class='content required_field'>Get Points
                        </td>
                        <td class='content' valign="top">:&nbsp;</td>
                        <td class='content'>
                            <input type="text" class="content" name="get_points" value="<?= $row["get_points"?>"/>
                            <br><br>
                        </td>
                    </tr>

                    <tr>
                        <td width="150" align="right" valign="top" class='content'>Enable Promotion Code?
                        </td>
                        <td class='content' valign="top">:&nbsp;</td>
                        <td class='content'>
                            <input type="checkbox" name="enable_promotion_code" value="1" id="enable_promotion_code" <?=$row["enable_promotion_code"]==1?"checked":"" ?>>
                            Yes <br><br>
                        </td>
                    </tr>

                    <tr class="enable_promotion_code" style="display: none;">
                        <td width="150" align="right" valign="top" class='content required_field'>Promotion Code Master
                        </td>
                        <td class='content' valign="top">:&nbsp;</td>
                        <td class='content'>
                            <?php
                                
if ($promotion_code_master["success"] != 1) {
                                    echo 
"Cannot get promotion code master data.";
                                } else {
                                    echo 
'<select name="promotion_code_master_id">';
                                    foreach (
$promotion_code_master["data"] as $master) {
                                        echo 
"<option value='" $master["id"] . "' " . ($master["id"] == $row["promotion_code_master_id"] ? "selected" "") . ">" $master["ref_name"] . "</option>";
                                    }
                                    echo 
'</select>';
                                }
                            
?>
                            <br><br>
                        </td>
                    </tr>

                    <tr>
                        <td width="120" align="right" valign="top" class='content required_field'>Start Date
                        </td>
                        <td class='content' valign="top">:&nbsp;</td>
                        <td class='content'>
                            <input type="text" class="content" name="start_date" value="<?= $row["start_date"?>" id="start_date" required/>
                            <br><br>
                        </td>
                    </tr>

                    <tr>
                        <td width="120" align="right" valign="top" class='content required_field'>End Date
                        </td>
                        <td class='content' valign="top">:&nbsp;</td>
                        <td class='content'>
                            <input type="text" class="content" name="end_date" value="<?= $row["end_date"?>" id="end_date" required/>
                            <br><br>
                        </td>
                    </tr>

                    <tr>
                        <td width="120" align="right" valign="top" class='content required_field'>Editor
                        </td>
                        <td class='content' valign="top">:&nbsp;</td>
                        <td class='content'>
                            <div id="tabs">
                                <ul>
                                    <?php
                                        $editor_list 
= array("Survey Introduction""First Page Description""Thank You Page""Email Content""Terms & Conditions""User Info");
                                        foreach (
$editor_list as $desc_num => $editor) {
                                            echo 
'<li><a href="#tabs-' . ($desc_num 1) . '">' $editor '</a></li>';
                                        }
                                    
?>
                                </ul>
                                <?php
                                    
foreach ($editor_list as $desc_num => $editor) {

                                        echo 
'<div id="tabs-' . ($desc_num 1) . '">';

                                        foreach (
$arraylangcode as $langcode => $langname) {
                                            echo 
"[" $langname "]<br>";
                                            echo 
'<textarea class="desc" name="desc' . ($desc_num 1) . '_' $langcode '">' $row["desc" . ($desc_num 1) . "_" $langcode] . '</textarea>
                                            <br><br>'
;
                                        }

                                        echo 
'</div>';
                                    }
                                
?>
                            </div>
                            <br><br>
                        </td>
                    </tr>

                    <tr>
                        <td width="120" align="right" valign="top" class='content'></td>
                        <td class='content' valign="top"></td>
                        <td class='content red'>
                            <br> * Required Field <br><br><br>
                        </td>
                    </tr>

                </table>
            </td>
        </tr>
    </table>
</form>
</body>
</html>