-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_lecture_details.php
121 lines (116 loc) · 7.38 KB
/
edit_lecture_details.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
<?php include'header.php'; ?>
<div class="pcoded-content">
<div class="pcoded-inner-content">
<div class="main-body">
<div class="page-body">
<div class="card">
<div class="card-header">
<h5>Edit Lecture name and duration of class</h5>
</div>
<div class="card-block">
<div class="table-responsive dt-responsive">
<table class="table table-striped table-bordered table-hover nowrap" id="basic-btn">
<thead>
<tr class="table-primary">
<th>#</th>
<th>Class</th>
<th>level</th>
<th>Lecturer</th>
<th>Duration (in hours)</th>
<th>Class Size</th>
<th>Save</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<?php
$sql =mysqli_query($db, "select * from vw_lecture_details_full order by combined_count desc");
$sn= 0;
while($lecture = $sql -> fetch_assoc()){
$lects=explode(',', $lecture['combined_list']);
$sn++;
?>
<tr>
<form action="actions/edit_lecture_details_p.php" method="post">
<input type="hidden" name="ldid" value="<?php echo $lecture['LDID']; ?>" >
<td><?php echo $sn; ?></td>
<td><?php
$view= " ";
foreach($lects as $val){
$course=mysqli_fetch_assoc(mysqli_query($db, "select * from vw_full_course where course_id=(select course_id from lecture where lecture_id=".$val.")"));
$dept=mysqli_fetch_assoc(mysqli_query($db, "select * from vw_full_course where department_id=".$course['department_id']));
$level=mysqli_fetch_assoc(mysqli_query($db, "select * from vw_full_course where level_id=".$course['level_id']));
$view.=$course['course_code'].'('.$dept['dept_code'].'), ';
}
echo substr($view, 0, -2);
?></td>
<td><?php echo $level['level_name']; ?></td>
<td>
<select name="lecturer">
<option value="">--Select--</option>
<?php
$lecturer_sql= mysqli_query($db, "select * from lecturer order by surname");
while($lecturer = $lecturer_sql -> fetch_assoc()){
?>
<option value="<?php echo $lecturer['lecturer_id']; ?>">
<?php echo $lecturer['surname']; ?>
</option>
<?php } ?>
</select>
</td>
<td>
<input type="text" name="duration" value="<?php echo $lecture['duration']; ?>" >
</td>
<td><?php echo $lecture['combined_population']; ?></td>
<td>
<input type="submit" value="save" class="btn btn-primary">
</td>
<td>
<input type="button" value="Del" id="<?php echo $lecture['LDID']; ?>" onclick="del(<?php echo $lecture['LDID']; ?>)" class="btn btn-danger" style="padding: 10px; margin-left:20px;">
</td>
</form>
</tr>
<?php } ?>
</tbody>
<tfoot>
<tr>
<th>#</th>
<th>Class</th>
<th>level</th>
<th>Lecturer</th>
<th>Duration (in hours)</th>
<th>Class Size</th>
<th>Save</th>
<th>Delete</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function del(id) {
var info = 'id=' + id;
if (confirm("Are you sure you want to delete this record?")) {
var html = $.ajax({
type: "GET",
url: "actions/edit_lecture_details_p.php",
data: info,
async: false,
success: function () {
window.location.reload(true);
}
}).responseText;
}
}
</script>
<?php include'footer_view.php'; ?>