/var/www/hkosl.com/m.musiccircle/signupTutorSubject.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
<? include('_init.php'); ?>
<?
    $id 
intval($_SESSION['member_login']);
    if(!
$id){
        
$path 'index.php';
        @
header("Location: {$path}");
        echo 
"<script language='JavaScript'>window.location='{$path}'</script>";
        exit();
    }else{
        
$sql        "select *,(select cmsloginname from sys_cms_login where tb.cmsloginid = cmsloginid and deleted = 0 LIMIT 1) as username 
                       from tutor_main as tb where id = ? and deleted = ? and status = ?"
;
        
$parameters = array($id,0,2);
        
$row bind_pdo($sql$parameters"selectone");
    
        if(!
$row['id']){
            
$path 'index.php';
            @
header("Location: {$path}");
            echo 
"<script language='JavaScript'>window.location='{$path}'</script>";
            exit();
        }
    }
    
$lang $_SESSION['langcode'];
    
//
    
$sql        "select * from tutor_main where id = ? and deleted = ?";
    
$parameters = array($id0);
    
$row        bind_pdo($sql$parameters"selectone");
    
//

    
$sql                "select * from master_type_code where typeid = ? and deleted = ? order by sort ASC";
    
$parameters         = array('EXPSTUDENTAGE'0);
    
$rows_expstudentage bind_pdo($sql$parameters"selectall");

    
$sql                  "select * from master_type_code where typeid = ? and deleted = ? order by sort asc";
    
$parameters           = array('INSTRUMENT_TYPE'0);
    
$rows_instrument_type bind_pdo($sql$parameters"selectall");
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <? include('_head.php'); ?>
    <link href="css/_sign.css" type="text/css" rel="stylesheet">
    <style>
    a{
        color:#F60;    
    }
    </style>
    <script>
        $(function () {
            $('.testcharge').change(
                function(){
                    if ($(this).val() && $(this).val() < 75) {
                        $(this).val(75);
                    }
                }
            ); 
            $('.expectcharge').change(
                function(){
                    if ($(this).val() && $(this).val() < 20) {
                        $(this).val(20);
                    }
                }
            );
            $('.inputPrice,.inputCharge').change(
                function () {
                    if (isNaN($(this).val())) {
                        $(this).val('');
                    }
                }
            );
            $('#LiForm').submit(
                function () {
                    var focus_array = new Array();
                    var error = false;
                    $('.error').hide();
                    if ($('input[name="expstudentage_id[]"]:checked', this).size() == 0) {
                        $("#expstudentageError").show();
                        focus_array[focus_array.length] = $('input[name="expstudentage_id[]"]').eq(0);
                        error = true;
                    }
                    var check = 0;
                    for(var i=1;i<=6;i++){
                        var count = 0;
                        var count2 = 0;
                        if($('select[name="tutor_expectcharge[mas_instrument'+i+']"]').val()){
                            check++;
                            $('#instrument'+i+' .expectcharge').each(
                                function(){
                                    if($(this).val()){
                                        count++;
                                    }
                                }
                            );
                            if(count == 0){
                                $("#expectchargeError"+i).show();
                                focus_array[focus_array.length] = $('#instrument'+i+' .expectcharge').eq(0);
                                error = true;
                            }
                            //
                            $('#instrument'+i+' .testcharge').each(
                                function(){
                                    if($(this).val()){
                                        count2++;
                                    }
                                }
                            );
                            if(count2 == 0){
                                $("#testchargeError"+i).show();
                                focus_array[focus_array.length] = $('#instrument'+i+' .testcharge').eq(0);
                                error = true;
                            }
                        }
                    }
                    if(check == 0){
                        $("#expectchargeError").show();
                        focus_array[focus_array.length] = $('.tab-pane.active .form-control').eq(0);
                        error = true;
                    }
                    if (error == false) {
                        return true;
                    } else {
                        //focus_array[0].focus();
                        $('html, body').animate({
                            scrollTop: $(focus_array[0]).offset().top - 200
                        }, 500);

                        return false;
                    }
                }
            );
        });
    </script>
</head>

<body>

<!-- Navigation -->
<? include('_header.php'); ?>
<div class="formSection">
    <? $signupMenu 'subject' ?>
    <? include('_signupTutorMenu.php'?>
    <div class="TutorForm">
        <form action="_process.php" method="post" enctype="multipart/form-data" id="LiForm">
            <input type="hidden" name="action" value="signup_subject"/>
            <input type="hidden" name="lang" value="<?= $lang ?>"/>

            <div class="FormHeading"><?=_lang("Let us know more about you!")?></div>
            <div class="InputDataIII">
                <div class="BoxTitle"><font style="color:red;">*</font><?=_lang("Expected Students Age")?></div>
                <? foreach ($rows_expstudentage as $row_expstudentage) { ?>
                    <?
                    $sql                 
"select * from `tutor_expstudentage` where tutormain_id = ? and mas_expstudentage = ? and deleted = ?";
                    
$parameters          = array($row['id'], $row_expstudentage['id'], 0);
                    
$count_expstudentage bind_pdo($sql$parameters"selectone");
                    
?>
                    <input name="expstudentage_id[]" type="checkbox" value="<?= $row_expstudentage['id'?><? if ($count_expstudentage['id']){ ?>checked<? ?>>
                    <?= $row_expstudentage['name_' get_langcode()] ?>
                <? ?>
                <div style="color:#F00; display:none;" class="error" id="expstudentageError"><?=_lang("Please select Expected Students Age.")?></div>
            </div>
            <div class="TabSection">
                <div class="BoxTitle"><font style="color:red;">*</font><?=_lang("Select teaching musical instruments")?> <font color="#0012ff" style="font-size:12px; font-weight:100;">(<?=_lang("If you teach more than 1 musical instrument, please click musical instrument 2 / musical instrument 3")?>) (<?=html_entity_decode(_lang("Please click <a href=teaching_list.php target=_blank>here</a> to view teaching list of qualified musical instruments."))?>)</font></div>
                <div style="color:#F00; display:none;" class="error" id="expectchargeError"><?=_lang("Please select a teaching musical instruments")?></div>
                <ul class="nav nav-tabs" id="myTab">
                    <? for ($i 1$i <= 10$i++) { ?>
                        <li <? if ($i == 1){ ?>class="active"<? ?>>
                            <a data-target="#instrument<?= $i ?>" data-toggle="tab" style="cursor:pointer;"><?=_lang("Musical Instrument")?>
                                <?= $i ?>
                            </a></li> 
                    <? ?>
                </ul>
                <div class="tab-content" style="border:1px solid #ddd; border-top:0px; padding:15px;">
                    <? for ($i 1$i <= 10$i++) { ?>
                        <?
                        $sql          
"select * from tutor_charge where tutormain_id = ? and instrument_no = ? and deleted = ?";
                        
$parameters   = array($row['id'], $i0);
                        
$count_charge bind_pdo($sql$parameters"selectone");
                        
//print_r($count_charge);
                        
?>
                        <!-- Tab <?= $i ?> -->
                        <div class="tab-pane <? if ($i == 1) { ?>active<? ?>" id="instrument<?= $i ?>">
                            <div class="Expection">
                                <div class="HalfLeft">
                                    <div class="BoxTitle"><?=_lang("Musical Instrument")?></div>
                                    <select name="tutor_expectcharge[mas_instrument<?= $i ?>]" class="form-control">
                                        <option value="">-<?=_lang("Musical Instrument")?>-</option>
                                        <? foreach ($rows_instrument_type as $row_instrument_type) { ?>
                                            <?
                                            $sql             
"select * from master_type_code where typeid = ? and extra1 = ? and deleted = ? order by sort asc";
                                            
$parameters      = array('INSTRUMENT'$row_instrument_type['code'], 0);
                                            
$rows_instrument bind_pdo($sql$parameters"selectall");
                                            
?>
                                            <optgroup label="<?= $row_instrument_type['name_' $lang?>">
                                                <? foreach ($rows_instrument as $row_instrument) { ?>
                                                    <option value="<?= $row_instrument['id'?><? if ($count_charge['mas_instrument'] == $row_instrument['id']){ ?>selected<? ?>>
                                                        <?= $row_instrument['name_' $lang?>
                                                    </option>
                                                <? ?>
                                            </optgroup>
                                        <? ?>
                                    </select>
                                </div>
                            </div>
                            <div class="ChargeTable">
                                <div class="BoxTitle"><font style="color:red;">*</font><?=_lang("Expected Fee")?> ($)</div>
                                <div style="color:#F00; display:none;" class="error" id="expectchargeError<?=$i?>"><?=_lang("Please enter at least one expected charge.")?></div>
                                <table class="table">
                                    <thead>
                                    <tr>
                                        <th><?=_lang('Grade')?></th>
                                        <th>30 <?=_lang('mins')?></th>
                                        <th>45 <?=_lang('mins')?></th>
                                        <th>60 <?=_lang('mins')?></th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <? for ($a 1$a <= 9$a++) {
                                        if (
$count_charge['id']) {
                                            
$sql                "select * from tutor_expectcharge where charge_id = ? and type = ? and grade = ? and deleted = ?";
                                            
$parameters         = array($count_charge['id'], 'fee'$a0);
                                            
$count_expectcharge bind_pdo($sql$parameters"selectone");
                                        }
                                        
?>
                                        <tr>
                                            <th scope="row">
                                                <? if($a==9){?>
                      <?=_lang("Over level 8")?>
                      <? }else{?>
                      <?=$a?>
                      <? }?></th>
                                            <td>
                                                <input name="tutor_expectcharge[charge_30min<?= $i ?>_<?= $a ?>]" type="text" class="inputPrice expectcharge" value="<?= $count_expectcharge['charge_30min'?>">
                                            </td>
                                            <td>
                                                <input name="tutor_expectcharge[charge_45min<?= $i ?>_<?= $a ?>]" type="text" class="inputPrice expectcharge" value="<?= $count_expectcharge['charge_45min'?>">
                                            </td>
                                            <td>
                                                <input name="tutor_expectcharge[charge_60min<?= $i ?>_<?= $a ?>]" type="text" class="inputPrice expectcharge" value="<?= $count_expectcharge['charge_60min'?>">
                                            </td>
                                        </tr>
                                    <? ?>
                                    </tbody>
                                </table>
                                <hr>
                                <div class="BoxTitle"><font style="color:red;">*</font><?=_lang("Trial Fee")?> ($) <font color="#0012ff" style="font-size:12px; font-weight:100;">(預設試堂為2堂,音樂圈會收取當中1堂試堂費或HKD150(以較高者為準)作行政費)</font></div>
                                <div style="color:#F00; display:none;" class="error" id="testchargeError<?=$i?>"><?=_lang("Please enter at least one trial fee.")?></div>
                                <table class="table" style="margin-bottom:0px;">
                                    <thead>
                                    <tr>
                                        <th><?=_lang('Grade')?></th>
                                        <th>30 <?=_lang('mins')?></th>
                                        <th>45 <?=_lang('mins')?></th>
                                        <th>60 <?=_lang('mins')?></th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <? for ($a 1$a <= 3$a++) { ?>
                                        <?
                                        
if ($count_charge['id']) {
                                            
$sql                "select * from tutor_expectcharge where charge_id = ? and type = ? and grade = ? and deleted = ?";
                                            
$parameters         = array($count_charge['id'], 'tfee'$a0);
                                            
$count_expectcharge bind_pdo($sql$parameters"selectone");
                                        }
                                        
?>
                                        <tr>
                                            <th scope="row"><? if ($a == 1) { ?>
                                                    1 - 2
                                                <? } else if ($a == 2) { ?>
                                                    3 - 5
                                                <? } else if ($a == 3) { ?>
                                                    <?=_lang("6 or above 6")?>
                                                <? ?></th>
                                            <td>
                                                <input type="text" name="tutor_expectcharge[t_charge_30min<?= $i ?>_<?= $a ?>]" value="<?= $count_expectcharge['charge_30min'?>" class="inputPrice testcharge">
                                            </td>
                                            <td>
                                                <input type="text" name="tutor_expectcharge[t_charge_45min<?= $i ?>_<?= $a ?>]" value="<?= $count_expectcharge['charge_45min'?>" class="inputPrice testcharge">
                                            </td>
                                            <td>
                                                <input type="text" name="tutor_expectcharge[t_charge_60min<?= $i ?>_<?= $a ?>]" value="<?= $count_expectcharge['charge_60min'?>" class="inputPrice testcharge">
                                            </td>
                                        </tr>
                                    <? ?>
                                    <tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    <? ?>
                    <div style="clear:both;"></div>
                </div>

                <div class="HalfLeft">
                    <div class="BoxTitle"><?=_lang("Provide Accompaniment")?></div>
                    <input type="checkbox" name="canaccompany" value="1" <? if ($row['canaccompany'] == 1){ ?>checked<? ?>>
                    <?=_lang("Possible")?>
                </div>
                <div class="AdditionalCharge">
                    <div class="BoxTitle"><?=_lang("Additional Charge for Visit Home in Each Lesson")?><font color="#0012ff" style="font-size:12px; font-weight:100;">(<?=_lang("Can leave blank")?>)</font></div>
                    <?
                        $sql        
"select * from tutor_teachareacode where tutormain_id = ? and deleted = ?";
                        
$parameters = array($row['id'], 0);
                        
$count_area bind_pdo($sql$parameters"selectall");

                        foreach (
$count_area as $res_area) {
                            
$sql          "select * from master_type_code where typeid = ? and id = ? and deleted = ?";
                            
$parameters   = array('TEACH_POSITIONCODE'$res_area['mas_teachareacode'], 0);
                            
$row_position bind_pdo($sql$parameters"selectone");
                            
?>
                            <div class="ChargeArea">
                                <?= $row_position['name_'.$lang?>
                                <input name="area[id][]" type="hidden" value="<?= $res_area['id'?>">
                                <input class="inputCharge" name="area[studenhome_addcharge][]" placeholder="$0.00" value="<?= $res_area['studenhome_addcharge'?>">
                            </div>
                        <? ?>
                </div>
            </div>
            <input type="submit" value="<?=_lang("Next Step")?>" class="submitBTN">
        </form>
    </div>
</div>
<? include('_footer.php'?>
</body>
</html>