/var/www/hkosl.com/alliancealliance/training_services_detail.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
<?php
    
require_once('webadmin/basic_info.php');

    if (empty(
$_GET["id"])) {
        echo 
"<script>alert('Cannot find the relevant data.'); location.href='index.php';</script>";
        exit;
    }

    
$this_menu_info get_menu_info((int)$_GET["id"]);

    
//check if this menu has sub menu
    
$sql "select * from menu where parent_id = ? and deleted = ?";
    
$parameters = array($this_menu_info["id"], 0);
    
$sub_menu_info bind_pdo($sql$parameters"selectall");

    
$sql                  "select * from course_category where menu_id = ? and status = ? and deleted = ? order by sort ASC";
    
$parameters           = array((int)$_GET["id"], 10);
    
$course_category_info bind_pdo($sql$parameters"selectall");
?>

<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
    <?php require_once("html_head.php"?>

    <!-- pop up -->    <!-- Add fancyBox main JS and CSS files -->
    <script type="text/javascript" src="js/fancybox2/source/jquery.fancybox.js?v=2.1.5"></script>
    <link rel="stylesheet" type="text/css" href="js/fancybox2/source/jquery.fancybox.css?v=2.1.5" media="screen"/>

    <script type="text/javascript">
        function get_training_center_info(training_center_id) {
            var xmlhttp;

            if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            }
            else {// code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                    //document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
                    //console.log(xmlhttp.responseText);
                    var result = $.trim(xmlhttp.responseText);

                    if (result != "0") {
                        var obj = JSON.parse(result);
                        $(".tc_code").text(obj.code);
                        $(".tc_name").text(obj.name_<?=$langcode?>);
                        $(".tc_address").text(obj.address_<?=$langcode?>);
                        $(".tc_tel").text(obj.tel);
                        $(".tc_fax").text(obj.fax);
                        $(".tc_email").text(obj.email);
                        $(".tc_desc").text(obj.desc_<?=$langcode?>);
                        console.log(result);
                    }
                }
            }

            xmlhttp.open("POST", "_ajax.php?for=get_training_center_info", true);
            xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            xmlhttp.send("training_center_id=" + training_center_id);
        }

        $(document).ready(function () {
            $(".fancybox").fancybox({
                maxWidth: 400,
                maxHeight: 400,
                fitToView: false,
                width: '70%',
                height: '40%',
                autoSize: false,
                closeClick: false,
                openEffect: 'none',
                closeEffect: 'none'
            });

            $(".fancybox").on("click", function () {
                get_training_center_info(this.id);
            });
        });
    </script>
</head>

<body>

<?php require_once("google_analysis.php"); ?>

<?php require_once("html_header.php"?>

<section id="content" class="training_services_detail">

    <div id="training_center" style="display:none; margin:0 auto; font-size: 16px;">
        <h2 style="text-align: center">Training Center</h2>
        <hr>
        <table>
            <tr>
                <td>Code:</td>
                <td class="tc_code"></td>
            </tr>

            <tr>
                <td>Name:</td>
                <td class="tc_name"></td>
            </tr>

            <tr>
                <td>Address:</td>
                <td class="tc_address"></td>
            </tr>

            <tr>
                <td>Telephone:</td>
                <td class="tc_tel"></td>
            </tr>

            <tr>
                <td>Fax:</td>
                <td class="tc_fax"></td>
            </tr>

            <tr>
                <td>Email:</td>
                <td class="tc_email"></td>
            </tr>

            <tr>
                <td>Description:</td>
                <td class="tc_desc"></td>
            </tr>
        </table>
    </div>

    <?php require_once("banner.php"?>

    <div class="container">
        <div style="padding-top: 20px;">
            <div style="padding-bottom: 20px; border-bottom: 1px solid #d4d4d4;">
                <div class="head_title">
                    <?= $this_menu_info["title_" $langcode?>
                </div>

                <div style="padding-top: 30px; text-align: justify;">
                    <?= $this_menu_info["desc_" $langcode?>
                </div>
            </div>

            <?php if (!empty($course_category_info) && ($this_menu_info["level_num"] == || empty($sub_menu_info))){ ?>
            <div style="margin-top: 40px;">
                <div class="head_title">
                    COURSE
                </div>

                <!-- course -->
                <?php
                    
foreach ($course_category_info as $course_category) {
                        if(!empty(
$course_category["icon_".$langcode])){
                            echo 
'<div style="display: inline-block;"><img src="images/course_category/'.$course_category["icon_".$langcode].'" style="width:50px;"></div><div class="page_subtitle1" style="padding-left: 5px;padding-bottom: 0; display: inline-block;">
                                    ' 
$course_category["name_" $langcode] . '
                                    <p class="txt" style="padding: 5px 0;">' 
$course_category["desc1_" $langcode] . '</p>
                                </div>'
;
                        }else{
                            echo 
'<div class="page_subtitle1" style="padding-bottom: 0">
                                    ' 
$course_category["name_" $langcode] . '
                                    <p class="txt" style="padding: 5px 0;">' 
$course_category["desc1_" $langcode] . '</p>
                                </div>'
;
                        }

                        echo 
'<div>
                                    <table id="index_course_table">
                                        <tr class="head_title">
                                            <th style="border-top-left-radius: 10px; width: 23%">Course Code</th>
                                            <th style="width: 19%;">Date</th>
                                            <th style="width: 10%;">Fee(HKD)</th>
                                            <th style="width: 15%;">Venue</th>
                                            <th style="width: 10%;">Time</th>
                                            <th style="width: 15%;">Medium of Instruction</th>
                                            <th style="border-top-right-radius: 10px; width: 8%;">Enroll</th>
                                        </tr>'
;

                        
$sql         "select * from course where course_category_id = ? and status = ? and deleted = ? order by code ASC";
                        
$parameters  = array($course_category["id"], 10);
                        
$course_info bind_pdo($sql$parameters"selectall");

                        if (!empty(
$course_info)) {
                            foreach (
$course_info as $course) {
                                
$start_date = new DateTime($course["start_date"]);
                                
$end_date = new DateTime($course["end_date"]);

                                
$venue_list               "";
                                
$selected_training_center explode(","$course["training_center_id"]);

                                foreach (
$selected_training_center as $selected_center) {
                                    
$sql                  "select * from training_center where id = ? and deleted = ?";
                                    
$parameters           = array($selected_center0);
                                    
$training_center_info bind_pdo($sql$parameters"selectone");

                                    
$venue_list .= '<a id="' $training_center_info["id"] . '" class="fancybox" href="#training_center">' $training_center_info["name_" $langcode] . "</a> / ";
                                }

                                
$venue_list substr_replace($venue_list"", -3);

                                if(
$course["start_date"] == $course["end_date"]){
                                    
$date_info $start_date->format("d M Y");
                                }else{
                                    
$date_info $start_date->format("d M Y") . ' to ' $end_date->format("d M Y");
                                }

                                echo 
'<tr class="_tr">
                                            <td>' 
$course["code"] . '</td>
                                            <td>' 
$date_info.'</td>
                                            <td>$' 
floatval($course["fee"]) . '-</td>
                                            <td><a href="#">' 
$venue_list '</a> </td>
                                            <td>' 
$course["time"] . '</td>
                                            <td>' 
$course["medium_of_instruction_" $langcode] . '</td>
                                        '
;

                                if (
$course["valid_apply"] == 1) {

                                    
//check if end date before 7 days
                                    
if(check_course_valid_apply($course["id"])){
                                        echo 
'<td>
                                                <a href="enrollment.php?cid=' 
$course["course_category_id"] . '&id=' $course["id"] . '">
                                                    <img src="images/icon_apply.png" />
                                                </a>
                                            </td>'
;
                                    }else{
                                        echo 
'<td>Closed</td>';
                                    }

                                } else {
                                    echo 
'<td>'.$course["stop_applying_text_".$langcode].'</td>';
                                }

                                echo 
'</tr>';
                            }
                        }

                        echo 
'</table><div style="padding: 5px 0;">' $course_category["desc2_" $langcode] . '</div>';
                    }
                
?>
            </div>
            <?php ?>
        </div>

        <div style="padding-top: 50px;">
            For more information, please contact us by filling the
            <a href="contact_us.php" style="text-decoration: underline; color: #10218B">Enquiry Form</a>
        </div>
    </div>

</section>

<?php require_once("html_footer.php"); ?>

</body>
</html>