-
Notifications
You must be signed in to change notification settings - Fork 41
/
faculty.php
152 lines (149 loc) · 6.48 KB
/
faculty.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
<?php
/**
* Homepage of HOD and faculty level users, provides interfaces to add/delete courses
* @author Avin E.M
*/
require_once('functions.php');
if(!sessionCheck('logged_in'))
{
header("Location: ./login.php");
die();
}
require_once('connect_db.php');
if(!isset($_SESSION['faculty']))
$_SESSION['faculty'] = $_SESSION['uName'];
if(!sessionCheck('level','faculty'))
{
if(!empty($_GET['faculty']))
{
$query = $db->prepare('SELECT uName FROM faculty where uName = ? AND dept_code=?');
$query->execute([$_GET['faculty'],$_SESSION['dept']]);
$fac = $query->fetch();
if(!empty($fac['uName']))
$_SESSION['faculty'] = $_GET['faculty'];
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>QuickSlots</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
<link rel="stylesheet" type="text/css" href="css/styles.css">
<link rel="stylesheet" type="text/css" href="css/dashboard.css">
<link rel="stylesheet" type="text/css" href="css/chosen.css">
<script type="text/javascript" src="js/jquery.min.js" ></script>
<script type="text/javascript" src="js/form.js"></script>
<script type="text/javascript" src="js/chosen.js"></script>
<script type="text/javascript">
$(function()
{
$("#main_menu a").each(function() {
if($(this).prop('href') == window.location.href || window.location.href.search($(this).prop('href'))>-1)
{
$(this).parent().addClass('current');
document.title+= " | " + this.innerHTML;
return false;
}
})
$("option[value=<?=$_SESSION['faculty']?>]").attr('selected', 'selected');
$("select").chosen();
$("#faculty").change(function(){
window.location.href='faculty.php?faculty='+this.value;
})
})
</script>
</head>
<body>
<div id="header">
<div id="account_info">
<div class="infoTab"><div class="fixer"></div><div class="dashIcon usr"></div><div id="fName"><?=$_SESSION['fName']?></div></div>
<div class="infoTab"><div class="fixer"></div><a href="logout.php" id="logout"><div class="dashIcon logout"></div><div>Logout</div></a></div>
</div>
<div id="header_text">QuickSlots v1.0</div>
</div>
<div id="shadowhead">Manage Courses</div>
<div id="nav_bar">
<ul class="main_menu" id="main_menu">
<?php
if(sessionCheck('level','dean'))
echo '<li class="limenu"><a href="dean.php">Manage Timetables</a></li>
<li class="limenu"><a href="manage.php?action=departments">Manage Departments</a></li>
<li class="limenu"><a href="manage.php?action=faculty">Manage Faculty</a></li>
<li class="limenu"><a href="manage.php?action=batches">Manage Batches</a></li>
<li class="limenu"><a href="manage.php?action=rooms">Manage Rooms</a></li>';
?>
<li class="limenu"><a href="faculty.php">Manage Courses</a></li>
<li class="limenu"><a href="allocate.php">Allocate Timetable</a></li>
<li class="limenu"><a href="./">View Timetable</a></li>
</ul>
</div>
<div id="content">
<div class="inline">
<?php if($_SESSION['level']!="faculty") : ?>
<div class="title" style="padding-bottom: 20px">
<span class="inline" style="vertical-align: middle;padding:10px 0 0 10px">Faculty:</span>
<select name="fac_id" id="faculty" data-placeholder="Choose Faculty...">
<?php
$query = $db->prepare('SELECT * FROM faculty where dept_code=?');
$query->execute([$_SESSION['dept']]);
foreach($query->fetchall() as $fac)
echo "<option value=\"{$fac['uName']}\">{$fac['fac_name']} ({$fac['uName']})</option>";
?>
</select>
</div>
<?php endif; ?>
<div class="box">
<div class="boxbg"></div>
<div class="information"><div class="add icon"></div></div>
<div class="title">Add Course</div>
<div class="elements">
<form method="post" action="courses.php?action=add">
<input type="text" name="cId" class="styled details" required pattern="[^ :]{2,20}" title="2 to 20 characters without spaces" placeholder="Course ID" />
<input type="text" name="cName" class="styled details" required pattern=".{6,100}" title="6 to 100 characters" placeholder="Course Name" />
<select name="batch[]" id="allowed" multiple="" class="stretch" data-placeholder="Allowed Batches..." required>
<?php
foreach($db->query('SELECT * FROM batches') as $batch)
echo "<option value=\"{$batch['batch_name']} : {$batch['batch_dept']}\">{$batch['batch_name']} : {$batch['batch_dept']} ({$batch['size']})</option>";
?>
</select>
<div class="left">
<input type="checkbox" class="styled" id="allowConflict" value="1" name="allowConflict">
<label for="allowConflict">Allow conflicting allocations</label>
</div>
<div class="blocktext info"></div>
<div class="center button">
<button>Add</button>
</div>
</form>
</div>
</div>
<div class="box">
<div class="boxbg"></div>
<div class="information"><div class="icon remove"></div></div>
<div class="title">Delete Course</div>
<div class="elements">
<form method="post" action="courses.php?action=delete" class="confirm">
<select name="cId" class="updateSelect stretch" data-placeholder="Choose Course..." required>
<option label="Choose Course..."></option>
<?php
$query = $db->prepare('SELECT * FROM courses where fac_id = ?');
$query->execute([$_SESSION['faculty']]);
while($course = $query->fetch())
echo "<option value=\"{$course['course_id']}\">{$course['course_name']} ({$course['course_id']})</option>"
?>
</select>
<input type="hidden" id="confirm_msg" value="Are you sure you want to delete the selected course?">
<div class="blocktext info"></div>
<div class="center button">
<button>Delete</button>
</div>
</form>
</div>
</div>
</div>
</div>
<div id="footer">Powered by <a href="https://github.com/0verrider/QuickSlots">QuickSlots v1.0</a></div>
</body>
</html>