/var/www/hkosl.com/imusiccircle/webadmin/course_index.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
<?php
    
require_once "check_login.php";
    
$page_settings = array(
        
'section'    => 'Master'// parent/page title
        
'subsection' => 'Lesson Detail'// page title
        
'domain'     => 'course'// table/model name
        
'access'     => 'GNu'// for permission
    
);


    
$sql         "select profile_id,user_id
            from `profile_user` as tb where user_id = ? and deleted = ? LIMIT 1"
;
    
$parameters  = array($_SESSION['cmsloginid'], 0);
    
$row_profile bind_pdo($sql$parameters"selectone");

    
$token = array();
    if(!empty(
$_GET["user_id"]) && ($_SESSION["cmsrole"] == "super_admin" || $_SESSION["cmsrole"] == "admin")){
        
$token explode("_"$_GET["user_id"]);
        
$row_profile['user_id'] = (int)$token[1];
    }

    
//if ($row_profile['profile_id'] == 4 || $row_profile['profile_id'] == 3) {
        
if ($row_profile['profile_id'] == || $token[0] == "student") {
            
$page_settings = array(
                
'formid'     => 'Co2'// for permission
                
'section'    => 'Master'// parent/page title
                
'subsection' => 'Lesson Detail'// page title
                
'domain'     => 'course'// table/model name
                
'access'     => 'GNu'// for permission
            
);
            
$sql99         "select id from `student_main` where cmsloginid = ? LIMIT 1";
            
$parameters99  = array((int)$row_profile['user_id']);
            
$row_user      bind_pdo($sql99$parameters99"selectone");
            
$sql           "select o.*,od.id as id2,od.datetime,od.tutor_status,od.student_status from order_detail as od,`order` as o where o.id = od.order_id and o.studentmain_id = ? and o.deleted = ? and o.status='paid' order by od.datetime desc";
        } else if (
$row_profile['profile_id'] == || $token[0] == "tutor") {
            
$page_settings = array(
                
'formid'     => 'Co1'// for permission
                
'section'    => 'Master'// parent/page title
                
'subsection' => 'Lesson Detail'// page title
                
'domain'     => 'course'// table/model name
                
'access'     => 'GNu'// for permission
            
);
            
$sql99         "select id from `tutor_main` where cmsloginid = ? LIMIT 1";
            
$parameters99  = array((int)$row_profile['user_id']);
            
$row_user      bind_pdo($sql99$parameters99"selectone");
            
$sql           "select o.*,od.id as id2,od.datetime,od.tutor_status,od.student_status from order_detail as od,`order` as o where o.id = od.order_id and o.tutormain_id = ? and o.deleted = ? and o.status='paid' order by od.datetime desc";
        }

        
$parameters       = array($row_user['id'], 0);
        
$all_product_info bind_pdo($sql$parameters"selectall");
    
//}
?>
<!DOCTYPE html>
<html>
<head>
    <?php require_once "_html_head.php"?>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <?php require_once "_header.php"?>
    <?php require_once "_menu.php"?>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                <?= _lang($page_settings['subsection']) ?>
                <small>
                    <?= _lang("Index"?>
                </small>
            </h1>
            <ol class="breadcrumb">
                <li>
                    <?= _lang("Home"?>1
                </li>
                <li class="active"><a href="<?= $page_settings['domain'?>_index.php"><i class="fa"></i>
                        <?= _lang($page_settings['subsection']) ?>
                    </a></li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">

            <!-- Your Page Content Here -->

            <!-- main table -->
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <?php if($_SESSION["cmsrole"] == "super_admin" || $_SESSION["cmsrole"] == "admin"){ ?>
                            <div class="box-header with-border">
                                <form method="GET" class="myform">
                                    <div class="table-filters">
                                        <div class="col-sm-2 col-md-1 form-group" style="width:60px;">
                                            <label><?= _lang("User"?></label>
                                        </div>
                                        <div class="col-sm-10  col-md-3 ">
                                            <?php
                                                $sql 
"select * from tutor_main where status = ? and deleted = ? and approved = ?";
                                                
$parameters = array(401);
                                                
$all_tutors bind_pdo($sql$parameters"selectall");

                                                
$sql ="select * from student_main where status = ? and deleted = ? and approved = ?";
                                                
$parameters = array(401);
                                                
$all_students bind_pdo($sql$parameters"selectall");

                                            
?>
                                            <select id="user_list" name="user_id" class="form-control input-sm" onchange="location.href='<?= $page_settings['domain'?>_index.php?user_id='+this.value;">
                                                <?php
                                                    
foreach ($all_tutors as $row){
                                                        echo 
"<option value='tutor_".$row["cmsloginid"]."' ".(isset($_GET["user_id"]) && "tutor_".$row["cmsloginid"] == $_GET["user_id"] ? "selected""").">"._lang("Tutor").": ".$row["nickname"]."</option>";
                                                    }

                                                    foreach (
$all_students as $row){
                                                        echo 
"<option value='student_".$row["cmsloginid"]."' ".(isset($_GET["user_id"]) && "student_".$row["cmsloginid"] == $_GET["user_id"] ? "selected""").">"._lang("Student").": ".$row["contactname"]."</option>";
                                                    }
                                                
?>
                                            </select>
                                        </div>

                                    </div>
                                </form>
                            </div>
                            <!-- /.box-header -->
                        <?php ?>
                        
                        <div class="box-body">
                            <div class="scroll_left_right_container">
                                <div class="scroll_left_right"><img src="../img/scroll_left_right.png"></div>
                            </div>

                            <div class="table-responsive">
                                <table id="example2" class="table table-bordered table-hover datatable-with-filter">
                                    <thead>
                                    <tr>
                                        <th style="min-width: 120px;" class="no-filter"><?= lang("上課日期/時間"?></th>
                                        <th style="min-width: 100px;"><?= lang("Order No."?></th>
                                        <th style="min-width: 100px;"><?= lang("工作號碼"?></th>
                                        <th style="min-width: 100px;"><?= lang("Tutor Name"?></th>
                                        <th style="min-width: 100px;"><?= lang("Student Name"?></th>
                                        <th style="min-width: 100px;" class="no-filter"><?= lang("上課地區"?></th>
                                        <th style="min-width: 120px;" class="no-filter"><?= lang("學習時間長度"?></th>
                                        <th class="no-filter" style="width: 100px">
                                            <!--
                          <a href="<?= $page_settings['domain'?>_form.php" class="btn btn-sm btn-primary pull-right">
                          <?= _lang('Create'?></a>-->
                                        </th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php
                                        
foreach ($all_product_info as $row) {
                                            
//Status
                                            
if (isset($_GET["show"]) && !empty($_GET["show"])) {
                                                
$show "&show=all";
                                            } else {
                                                
$show "";
                                            }
                                            
$row_tutor   get_tutor($row['tutormain_id']);
                                            
$row_student get_student($row['studentmain_id']);
                                            
$row_job     get_studentpostjob($row['job_id']);

                                            
$sql            "select name_cn,name_en from master_type_code where id = ? and typeid = 'INSTRUMENT' LIMIT 1";
                                            
$parameters     = array($row_job['mas_instrument']);
                                            
$row_instrument bind_pdo($sql$parameters"selectone");

                                            
$sql           "select name_cn,name_en from master_type_code where id = ? and typeid = 'TEACH_POSITIONCODE' LIMIT 1";
                                            
$parameters    = array($row['mas_residencecode']);
                                            
$row_residence bind_pdo($sql$parameters"selectone");
                                            
?>
                                            <tr>
                                                <td style="width:150px;"><?= $row['datetime'?></td>
                                                <td class='listtxt' style='padding-left:5'><?= $row["order_no"?></td>
                                                <td class='listtxt' style='padding-left:5'><?= $row_job['postjob_no'?>
                                                    - <?= $row_instrument['name_cn'?></td>
                                                <td><?= $row_tutor["tutor_no"?>
                                                    - <?= $row_tutor["nickname"?></td>
                                                <td><?= $row_student["student_no"?>
                                                    - <?= $row_student["contactname"?></td>
                                                <td style="width:100px;"><?= $row_residence["name_cn"?></td>
                                                <td style="width:100px;"><?= $row['course_length'?>
                                                    <?= _lang("mins"?></td>
                                                <td class="tr">
                                                    <div class="btn-group">
                                                        <a href="<?= $page_settings['domain'?>_form.php?id=<?= $row['id2'?>" class="btn btn-sm btn-primary">
                                                            <i class="fa fa-pencil" aria-hidden="true"></i> </a>
                                                    </div>
                                                </td>
                                            </tr>
                                        <?php ?>
                                    </tbody>

                                </table>
                            </div>

                        </div>
                        <!-- /.box-body -->
                    </div>
                    <!-- /.box -->
                </div>
                <!-- /.col -->
            </div>
            <!-- /.row -->

            <!-- End of Your Page Content Here -->

        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->

    <?php require_once "_footer.php"?>
    <?php require_once "_aside.php"?>
</div>
<!-- ./wrapper -->

<!-- REQUIRED JS SCRIPTS -->
<?php require_once "_html_script.php"?>
<script src="../js/select2/select2.min.js"></script>
<link href="../js/select2/select2.min.css" rel="stylesheet">

<script type="text/javascript">
    $(function () {
        $("#user_list").select2({
            width: "100%",
            placeholder: "<?=_lang("Select Tutor / Student")?>"
        });
    });
</script>
</body>
</html>