/var/www/hkosl.com/m.musiccircle/order_action.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
<?php
    
include('_init.php');

    if (
$_SESSION["is_student"] != && $_SESSION["is_tutor"] != 1) {
        
header("Location: index.php");
        exit;
    }

    
$page_settings['domain'] = "order";

    
$id     = (int)$_GET["id"];
    
$status $_GET['action'];

    if (
$_GET['fee']) {
        
$row        get_order((int)$_GET["id"]);
        
$sql        "update `order` set fee = ?, total_fee = ?,status = ? , lastupdate=?, lastupby=? where id = ?";
        
$parameters = array($_GET['fee'], ($_GET['fee'] * $row['course_count']), $status$nowdate$_SESSION['cmsloginid'], $id);
    } else {
        
$sql        "update `order` set status = ? , lastupdate=?, lastupby=? where id = ?";
        
$parameters = array($status$nowdate$_SESSION['cmsloginid'], $id);
    }
    
bind_pdo($sql$parameters);
    
send_order_notification($status$id);

    
$order      get_order($id);
    
$student_id $order["studentmain_id"];
    
$tutor_id   $order["tutormain_id"];
    if (
$_SESSION["is_tutor"] == 1) {
        
$user get_student($student_id);

        if (
$status == "approved") {
            
$notification_body _lang("學生已經確定你的試堂邀請。");
        } else if (
$status == "reject") {
            
$notification_body _lang("學生已經拒絕你的試堂邀請。");
        } else if (
$status == "cancel") {
            
//$notification_body = _lang("你有1個新留言,請回覆。");
        
}
    } else if (
$_SESSION["is_student"] == 1) {
        
$user get_tutor($tutor_id);

        if (
$status == "approved") {
            
$notification_body _lang("導師已經確定你的試堂邀請。");
        } else if (
$status == "reject") {
            
$notification_body _lang("導師已經拒絕你的試堂邀請。");
        } else if (
$status == "cancel") {
            
//$notification_body = _lang("你有1個新留言,請回覆。");
        
}
    }

    if(!empty(
$notification_body)){
        
$cmsloginid $user["cmsloginid"];
        
$notification_title  "MusicCircle";
        global 
$site_info;
        
$notification_url $site_info["app_url"]."order_form.php?id=".$id;
        
$app_notification_id create_app_notification($notification_title$notification_body"SENT""chat");
        
send_app_notification($app_notification_id$_SESSION["cmsloginid"], null$notification_title$notification_body$notification_url);
    }

    if (
$status == "approved") {
        
header("Location: order_form.php?id=" $id."&click_paypal=1");
    }else{
        
header("Location: order_form.php?id=" $id);
    }