Repository navigation
Expand file tree
/
Copy pathcomment-request.php
More file actions
108 lines (105 loc) · 4.55 KB
/
Copy pathcomment-request.php
File metadata and controls
108 lines (105 loc) · 4.55 KB
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
<?php
require 'paths.php'; // Include Paths
require $func . 'connect.php'; //Connect To Database
$userId = $adminType = '';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$userId = $_COOKIE['user-id'];
$stmt = $conn->prepare('SELECT `admin_type` FROM `admins` WHERE `user_id` = ?');
$stmt ->execute(array($userId));
$row = $stmt->fetch();
$adminType = $row['admin_type'];
// Get Admin Name
$adminName = $conn->prepare('SELECT `user_nic_name` FROM `users` WHERE `user_id` = ?');
$adminName ->execute(array($userId));
$adm = $adminName->fetch();
$adminName = $adm['user_nic_name'];
//Fetch Course Requests For This Admin
$req = $conn->prepare('SELECT `other_desc`, `other_course`, other_id FROM `others` WHERE `other_admin_id` = ? and `other_status` =0');
$req ->execute(array($adminType));
$res = $req->fetchall();
foreach ($res as $re) {?>
<li class="row">
<span class="mat-name"><?php
//Fetch Course Name
if(strlen($adminType)== 1){
$adminType = '000' . $adminType;
} else if(strlen($adminType)==2){
$adminType = '00' . $adminType;
} else if(strlen($adminType)==3){
$adminType = '0' . $adminType;
}
if($adminType[3] == 1) {
$cour = $conn->prepare('SELECT `name` FROM `uni_mand_courses` WHERE `id` = ?');
$cour ->execute(array($re['other_course']));
$courseName = $cour->fetch();
echo $courseName['name'];
} elseif ($adminType[3] == 2) {
$cour = $conn->prepare('SELECT `name` FROM `uni_opt_courses` WHERE `id` = ?');
$cour ->execute(array($re['other_course']));
$courseName = $cour->fetch();
echo $courseName['name'];
} elseif ($adminType[3] == 3) {
$cour = $conn->prepare('SELECT `name` FROM `coll_mand_courses` WHERE `id` = ?');
$cour ->execute(array($re['other_course']));
$courseName = $cour->fetch();
echo $courseName['name'];
} elseif ($adminType[3] == 4) {
$cour = $conn->prepare('SELECT `name` FROM `sp_mand_courses` WHERE `id` = ?');
$cour ->execute(array($re['other_course']));
$courseName = $cour->fetch();
echo $courseName['name'];
} elseif ($adminType[3] == 5) {
$cour = $conn->prepare('SELECT `name` FROM `sp_opt_courses` WHERE `id` = ?');
$cour ->execute(array($re['other_course']));
$courseName = $cour->fetch();
echo $courseName['name'];
} elseif ($adminType[3] == 6) {
$cour = $conn->prepare('SELECT `name` FROM `uni_other_courses` WHERE `id` = ?');
$cour ->execute(array($re['other_course']));
$courseName = $cour->fetch();
echo $courseName['name'];
}
?></span>
<span class="comm-content" req-id="<?php echo $re['other_id'] ; ?>"><?php echo $re['other_desc']; ?></span>
<div class="tow-btn">
<button class="accept hoverable" onclick="
var reqId = $(this).parent().siblings('.comm-content').attr('req-id'),
that = $(this);
$.ajax({
type: 'POST',
url: 'accept-comment-req.php',
data: {
'reqId' : reqId
},
success : function(data) {
that.closest('li').remove();
},
error : function(){
alert('Whoops! This didn\'t work. Please contact us.');
}
});
">قبول</button>
<button class="den hoverable"onclick="
var reqId = $(this).parent().siblings('.comm-content').attr('req-id'),
that = $(this);
$.ajax({
type: 'POST',
url: 'del-comment-req.php',
data: {
'reqId' : reqId
},
success : function(data) {
that.closest('li').remove();
},
error : function(){
alert('Whoops! This didn\'t work. Please contact us.')
}
});
">رفض</button>
</div>
</li>
<?php }
} else {
header('Location: http://localhost/eduMedia/');
exit;
}