-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathlist_courses_appointed.php
executable file
·153 lines (140 loc) · 7.1 KB
/
list_courses_appointed.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
if(!loggedIn()){
die();
exit();
}
?>
<!-- Content Header (Page header) -->
<!-- DATA TABLES -->
<link href="css/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<section class="content-header">
<h1>
Course Allotment
<small>View all assigned courses</small>
</h1>
<ol class="breadcrumb">
<li><a href="home.php"><i class="fa fa-dashboard"></i> Home</a></li>
<li><a href="#">Course allotment</a></li>
<li class="active">View all assigned courses</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div id="update">
</div>
<div class="row" id="content_area">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">List of all Courses with respective Teacher</h3>
</div><!-- /.box-header -->
<div class="box-body table-responsive">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Course Code</th>
<th>Course Name</th>
<th>Department</th>
<th>Semester</th>
<th>Appointed Teacher</th>
<th> </th>
</tr>
</thead>
<tbody>
<?php
$i=0;
$c = new Course();
$courses = $c->getAllAppointed();
while(!empty($courses) && $course = $courses->fetch_object()){
$i++;
?>
<tr id="<?php echo 'assigned_row_id'.$i; ?>">
<td><?php echo $course->course_code; ?></td>
<td>
<?php
$cc = new Course();
$cc->getInfobyId($course->course_code);
echo $cc->getCourseName();
unset($cc);
?>
</td>
<td><?php
$d = new Department();
$d->getInfo($course->course_dep);
echo $d->getDepName();
unset($d);
?>
</td>
<td><?php echo $course->course_sem; ?></td>
<td><?php
$t = new Teacher();
$t->getInfo($course->teacher_id);
echo $t->getName();
unset($t);
?>
</td>
<td><button class="btn btn-default" onClick="edit_assigned_feild(<?php echo $course->id . ',\'' . $course->course_code. '\',' . $course->course_dep. ',' . $course->course_sem ; ?>);" > Edit </button>
<button class="btn btn-danger" onClick="delete_assigned(<?php echo $course->id . ',\'' . $course->course_code. '\',' . $course->course_dep. ',' . $course->course_sem ; ?>);" >Remove</button>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<th>Course Code</th>
<th>Course Name</th>
<th>Department</th>
<th>Semester</th>
<th>Appointed Teacher</th>
<th> </th>
</tr>
</tfoot>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div>
</div>
</section><!-- /.content -->
<!-- Edit modal -->
<div id="editModal" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="editArea">Update here</h4>
</div>
</div>
</div>
</div>
<!-- jQuery 2.0.2 -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<!-- DATA TABES SCRIPT -->
<script src="js/plugins/datatables/jquery.dataTables.js" type="text/javascript"></script>
<script src="js/plugins/datatables/dataTables.bootstrap.js" type="text/javascript"></script>
<!-- AdminLTE App -->
<script src="js/AdminLTE/app.js" type="text/javascript"></script>
<!--Page Script -->
<script type="text/javascript">
$(function() {
$("#example1").dataTable();
});
function edit_assigned_feild($id,$course_code,$course_dep,$course_sem,$course_teacher){
if(confirm('Are you sure, you want to edit this entry?')){
$('#editModal').modal();
$('#editArea').load('edit_assigned.php?id='+$id+'&cid='+$course_code+'&did='+$course_dep+'&cs='+$course_sem);
}
}
function save_edit_a(){
$('#editModal').modal('hide');
$('#content_area').load('ajax/load_assigned.php');
}
function delete_assigned($id,$course_code,$course_dep,$course_sem,$course_teacher){
if(confirm('Are you sure, you want to remove this entry?')){
$('#update').load('ajax/remove_assigned.php?id='+$id+'&cid='+$course_code+'&did='+$course_dep+'&cs='+$course_sem);
}
}
</script>