/var/www/hkosl.com/imusiccircle/webadmin/course_process.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
<?php
    
require_once "check_login.php";
    
    
$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");
    
    
$message "";
    
$id = (int)$_POST['id'];
    
    if((
$row_profile['profile_id'] == || $row_profile['profile_id'] == 2) && $_POST["solution_status"] == ){
        
$page_settings['domain'] = "course";

        
$sql "select * from order_detail 
        INNER JOIN `order` ON `order`.id = order_detail.order_id
        where order_detail.id = ?"
;
        
$parameters = array($id);
        
$result bind_pdo($sql$parameters"selectone");

        if(
$result["student_status"] == && $row["solution_status"] == 0){
            
$sql "update order_detail set solution_status = ? where id = ?";
            
$parameters = array(1$id);
            
bind_pdo($sql$parameters);
        }
    }
    
    if(
$_POST["deduct_tutorial_mins"] == && ($row_profile['profile_id'] == || $row_profile['profile_id'] == 2)){
        
$page_settings['domain'] = "course";

        
$sql "select * from order_detail 
        INNER JOIN `order` ON `order`.id = order_detail.order_id
        where order_detail.id = ?"
;
        
$parameters = array($id);
        
$result bind_pdo($sql$parameters"selectone");

        if(
$result["tutor_status"] == 1){
            
$sql "update order_detail set deduct_tutorial_mins = ?, deduct_tutorial_mins_date=? where id = ?";
            
$parameters = array(1date("Y-m-d H:i:s"), $id);
            
bind_pdo($sql$parameters);

            
$sql "update tutor_main set tutorial_mins=tutorial_mins-? where id = ?";
            
$parameters = array($result["course_length"], $result["tutormain_id"]);
            
bind_pdo($sql$parameters);
        }
    }

    if(
$row_profile['profile_id'] == 4){
        
$page_settings = array(
            
'formid'     => 'Co2'// for permission
            
'section'    => 'Master'// parent/page title
            
'subsection' => 'Lesson History'// page title
            
'domain'     => 'course'// table/model name
            
'access'     => 'GNu'// for permission
        
);
        unset(
$tmpdata);
        
$tmpdata['student_status'] = $_POST['student_status'];
        
$tmpdata['complaint'] = $_POST['complaint'];
        
$sql mysql_install($tmpdata,'order_detail','edit','id');
        
$tmpdata['id'] = $id;
        
$arraykey=array_keys($tmpdata);
        unset(
$parameters);
        for(
$i=0;$i<count($arraykey);$i++){
            
$parameters[$i]=$tmpdata[$arraykey[$i]];
        }
        
bind_pdo($sql$parameters);
        
insert_notification('ORDER_COMPLAIN''order_detail'$id0);
    }else if(
$row_profile['profile_id'] == 3){
        
$page_settings = array(
            
'formid'     => 'Co1'// for permission
            
'section'    => 'Master'// parent/page title
            
'subsection' => 'Tutorial History'// page title
            
'domain'     => 'course'// table/model name
            
'access'     => 'GNu'// for permission
        
);
        unset(
$tmpdata);
        
$tmpdata['tutor_status'] = $_POST['tutor_status'];
        
$sql mysql_install($tmpdata,'order_detail','edit','id');
        
$tmpdata['id'] = $id;
        
$arraykey=array_keys($tmpdata);
        unset(
$parameters);
        for(
$i=0;$i<count($arraykey);$i++){
            
$parameters[$i]=$tmpdata[$arraykey[$i]];
        }
        
bind_pdo($sql$parameters);

        if(
$_SESSION["is_tutor"]==&& $_SESSION["member_login"] > 0){
            
$sql "select * from order_detail
            INNER JOIN `order` ON `order`.tutormain_id = ? and order_detail.id = ?"
;
            
$parameters = array($_SESSION["member_login"], (int)$id);
            
$result bind_pdo($sql$parameters"selectone");

            if(!empty(
$result)){
                
$sql "update tutor_main set tutorial_mins=tutorial_mins+? where id = ?";
                
$parameters = array($result["course_length"], $_SESSION["member_login"]);
                
bind_pdo($sql$parameters);
            }

        }

    }

    
header("Location: course_form.php?id=".$id);
?>