-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfac_asn.php
More file actions
284 lines (244 loc) · 9.14 KB
/
fac_asn.php
File metadata and controls
284 lines (244 loc) · 9.14 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
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Welcome to SIS</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet" type="text/css">
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">
<link href="css/templatemo_style.css" rel="stylesheet" type="text/css">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="sidebar/styles.css">
<link rel="stylesheet" href="pure/pure-min.css">
<script src="sidebar/jquery-latest.js" type="text/javascript"></script>
<script src="sidebar/script.js"></script>
<link rel="icon" type="image/png" href="/dbms/logo/logo.png">
</head>
<body class="templatemo-bg-gray">
<?php
// Get the data
$id = $_SESSION["id"];
$password = $_SESSION["pwd"];
$name = $_SESSION["name"];
$dept = $_SESSION["dept"];
$_SESSION["record"] = false;
// Create connection to database
$server = "localhost:6994";
$username = "TEACHER";
$passwd = "teacher";
$dbname = "studentinfodb";
$con = new mysqli($server, $username, $passwd, $dbname);
if($con->connect_error)
{
echo "<div id=\"try\">
<h1 class=\"margin-bottom-15\">OOPS !!! Something went wrong.</h1> Please submit a <a href=\"contact/contact.html\">Bug Report,</a> Or<a href=\"login.html\"> Try Again </a>
</div>";
$_SESSION["login"] = false;
die();
}
// Check for valid id and password
$query = "SELECT f_id, passwd FROM faculty_login WHERE f_id = '$id' AND passwd = '$password'";
$tmp = $con->query($query);
$row = mysqli_num_rows($tmp);
if($row < 1)
{
echo "<div id=\"try\">
<h1 class=\"margin-bottom-15\">PLEASE ENTER A CORRECT ID OR PASSWORD</h1>
Please<a href=\"login.html\"> Try Again</a>
</div>";
$_SESSION["login"] = false;
die();
}
else
$validate = true;
// Fetch the courses Currently teaching
$query = "SELECT course_code FROM teaching_info WHERE f_id = '$id'";
$tmp = $con->query($query);
$row = mysqli_num_rows($tmp);
if($row < 1)
$set_course = false;
else
$set_course = true;
// Fetch given assignments
$query = "SELECT *
FROM assignment as A
WHERE A.course_code in (SELECT course_code
FROM teaching_info as T
WHERE T.f_id = '$id')";
$asnList = $con->query($query);
if(mysqli_num_rows($asnList) < 1)
$list = false;
else
$list = true;
//-----------------------------------------------------------------------------------------------------------------------
// Now the main part starts
if($validate)
{
// set the session
$_SESSION["logged"] = true;
echo "
<div id=\"title\"><strong><center>
STUDENT INFORMATION SYSTEM<br><center>NIT HAMIRPUR</strong>
</div>
<div id=\"mcont\">
<div id=\"mnu\">
<div id=\"txt\">Welcome $name</div>
<ul style='margin-left: 45%'>
<li><a href=\"fac_dash.php\">Home</a></li>
<li><a href=\"fac_teach.php\">Teaching info</a></li>
<li><a href=\"fac_class.php\">Student Record</a></li>
<li><a href=\"fac_asn.php\">Assignments</a></li>
<li><a href=\"fac_query.php\">Student queries</a></li>
<li><a href=\"facUinfo.php\">Update info</a></li>
<li><a href=\"logout.php\">Logout</a></li>
</ul>
</div> <!-- end menu -->
<div id=\"ctnt\">";
if(!$_SESSION["give"] && !$_SESSION["view"])
echo "<div id=\"infoheadteacher\"><br><u><strong>Assignments</strong></u></div>";
if($_SESSION["view"])
echo "<div id=\"infoheadteacher\"><br><u><strong>Assignments given</strong></u></div>";
echo "<div id=\"info\">";
?>
<div>
<?php
{
// TO choose
if (!$_SESSION["give"] && !$_SESSION["view"])
{
echo "
<div class=\"col-md-12\" style='margin-left: 35%;margin-top: 5%'>
<form class=\"col-md-6\"style='width: 30%' action='asn.php' method='post'>
<input type=\"text\" name=\"TYPE\"hidden value=\"view\">
<input type=\"submit\" value=\"View given assignments\" class=\"btn btn-info\">
</form>
<form class=\"col-md-6\" action='asn.php' method='post'>
<input type=\"text\" hidden name=\"TYPE\" value=\"give\">
<input type=\"submit\" value=\"Give new assignment\" class=\"btn btn-info\">
</form>
</div>
";
}
// To give assnmnt
if($_SESSION["give"])
{
echo "<div class=\"container\" style=\"margin-top: -6%;margin-left: 50%;margin-bottom: .5%\">
<div class=\"col-md-6\">
<p class=\"text-center margin-bottom-15\" style=\"margin-bottom: 0%\"><strong><u>New
Assignment</strong></u></p>
<form class=\"form-horizontal templatemo-contact-form-2 templatemo-container\"
role=\"form\" action=\"asn.php\" method=\"post\">
<div class=\"form-group\">
<div class=\"col-sm-3\">
<div class=\"templatemo-input-icon-container\">
<label for=\"course\" class=\"control-label\" >Course</label>
<select id=\"course\" class=\"form-control\" required name=\"course1\">
<option value=\"\">Select Course Code</option>";
while($list = $tmp->fetch_assoc())
echo "<option value=\"".$list["course_code"]. "\">". $list["course_code"]. "</option>";
echo"
</select>
</div>
</div>
<div class=\"col-sm-4\">
<div class=\"templatemo-input-icon-container\">
<label for=\"course\" class=\"control-label\" >Assignment no.</label>
<input required type=\"number\" class=\"form-control\" name=\"no\" id=\"name\"
placeholder=\"Assingment no.\">
</div>
</div>
<div class=\"col-sm-5\">
<div class=\"templatemo-input-icon-container\">
<label for=\"date\" class=\"control-label\" >Due date</label>
<input required type=\"date\" class=\"form-control\" name=\"date\" id=
\"date\">
</div>
</div>
<div class=\"col-sm-12\">
<div class=\"templatemo-input-icon-container\">
<label for=\"description\" class=\"control-label\" >Description</label>
<textarea required class=\"form-control\"
name=\"descp\"
id=\"description\" placeholder=\"Description\"></textarea>
</div>
</div>
<div class=\"col-md-12\">
<input type=\"text\" name=\"TYPE\"hidden value=\"new\">
<input type=\"submit\" value=\"Give Assignment\" class=\"btn btn-warning pull-right\">
</div>
</div>
</form>
<div class=\"row\"></div>
</div>
</div>";
} // ENd if
// TO see given assignments
if ($_SESSION["view"])
{
if($list)
{
echo "
<div id=\"tablTeach\" style='margin-top: 10%;margin-left: 35%; float: left'>
<table class=\"table2\">
<thead>
<tr>
<th></th>
<th scope=\"col\" abbr=\"Starter\">Course </th>
<th scope=\"col\" abbr=\"Medium\">Assignment no.</th>
<th scope=\"col\" abbr=\"Medium\">Given on</th>
<th scope=\"col\" abbr=\"Medium\">Due by</th>
</tr> ";
while ($result = $asnList->fetch_assoc()) {
echo "<tr>
<th scope=\"row\"></th>";
echo "<td style=\"border-radius:6px;
border:groove;\"><center>" . $result["course_code"] . "</td>" .
"<td style=\"border-radius:6px;
border:groove;\"><center>" . $result["assignNo"] . "</td>" .
"<td style=\"border-radius:6px;
border:groove;\"><center>" . $result["handOutDate"] . "</td>" .
"<td style=\"border-radius:6px;
border:groove;\"><center>" . $result["dueDate"] . "</td>";
echo "</tr>";
}// closed while
}// Closed display if
else // If no assignment given
{
echo "<div style='margin-top: 10%;margin-left: 55%'><br><strong>No Assignments given</strong></div>";
}
echo "
<form action=\"goback.php\" method=\"post\">
<input type='submit'
class='btn btn-info' style='float: right;margin-right: -20%;margin-top:15%;width:
20%' value='Go Back'>
<input type='text' hidden name=\"TYPE\" value=\"assignment\">
</form>";
}// Closed if
}// Closed php
?>
</tbody>
</table>
</div>
</div><!--end table-->
</div> <!--end info-->
</div> <!--end content-->
<!--Sidebar-->
<?php
echo "</div>
";
}
?>
<div id="footer">
Developed By: Prateek Prasher and Arnav Dhiman, CSED NIT-Hamirpur
<br>Found a bug ? <a href="contact/contact.html">Contact us.</a>
</div>
</body>
</html>