| 24 |
exit(json_encode($result_set)); |
exit(json_encode($result_set)); |
| 25 |
} |
} |
| 26 |
|
|
| 27 |
|
// Load section setting |
| 28 |
$sql = "SELECT * FROM section_config WHERE SID = $sid AND enable"; |
$sql = "SELECT * FROM section_config WHERE SID = $sid AND enable"; |
| 29 |
|
|
| 30 |
$rs = mysqli_query($db_conn, $sql); |
$rs = mysqli_query($db_conn, $sql); |
| 37 |
exit(json_encode($result_set)); |
exit(json_encode($result_set)); |
| 38 |
} |
} |
| 39 |
|
|
| 40 |
if($row = mysqli_fetch_array($rs)) |
if ($row = mysqli_fetch_array($rs)) |
| 41 |
{ |
{ |
| 42 |
$result_set["data"] = array( |
$result_set["data"] = array( |
| 43 |
"sid" => $sid, |
"sid" => $sid, |
| 45 |
"comment" => $row["comment"], |
"comment" => $row["comment"], |
| 46 |
"ex_update" => $row["ex_update"], |
"ex_update" => $row["ex_update"], |
| 47 |
"section_hierachy" => array(), |
"section_hierachy" => array(), |
| 48 |
|
"masters" => array(), |
| 49 |
); |
); |
| 50 |
} |
} |
| 51 |
else |
else |
| 59 |
|
|
| 60 |
mysqli_free_result($rs); |
mysqli_free_result($rs); |
| 61 |
|
|
| 62 |
|
// Load section master |
| 63 |
|
$sql = "SELECT section_master.UID, username, major, begin_dt, end_dt FROM section_master |
| 64 |
|
INNER JOIN user_list ON section_master.UID = user_list.UID |
| 65 |
|
WHERE SID = $sid AND section_master.enable AND (NOW() BETWEEN begin_dt AND end_dt) |
| 66 |
|
ORDER BY major DESC, begin_dt ASC, end_dt ASC"; |
| 67 |
|
|
| 68 |
|
$rs = mysqli_query($db_conn, $sql); |
| 69 |
|
if ($rs == false) |
| 70 |
|
{ |
| 71 |
|
$result_set["return"]["code"] = -2; |
| 72 |
|
$result_set["return"]["message"] = "Query section master error: " . mysqli_error($db_conn); |
| 73 |
|
|
| 74 |
|
mysqli_close($db_conn); |
| 75 |
|
exit(json_encode($result_set)); |
| 76 |
|
} |
| 77 |
|
|
| 78 |
|
while ($row = mysqli_fetch_array($rs)) |
| 79 |
|
{ |
| 80 |
|
array_push($result_set["data"]["masters"], array( |
| 81 |
|
"uid" => $row["UID"], |
| 82 |
|
"username" => $row["username"], |
| 83 |
|
"major" => $row["major"], |
| 84 |
|
"begin_dt" => $row["begin_dt"], |
| 85 |
|
"end_dt" => $row["end_dt"], |
| 86 |
|
)); |
| 87 |
|
} |
| 88 |
|
mysqli_free_result($rs); |
| 89 |
|
|
| 90 |
// Load section list |
// Load section list |
| 91 |
$sql = "SELECT SID, section_config.CID, section_config.title AS s_title, section_class.title AS c_title |
$sql = "SELECT SID, section_config.CID, section_config.title AS s_title, section_class.title AS c_title |
| 92 |
FROM section_config INNER JOIN section_class ON section_config.CID = section_class.CID |
FROM section_config INNER JOIN section_class ON section_config.CID = section_class.CID |