-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathattendanceview.php
227 lines (204 loc) · 5.13 KB
/
attendanceview.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
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
<?php
/**
* @System HP-pc Rax
* @author Rakshit shah <Rakshitshah1994@gmail.com>
* @copyright 2015-2017 |Rakshit shah
* @license http://rakshit.in/license/license.php | PHP License 3.0
* @version 1.1
* @since File available since Release 1.0.0
*/
session_start();
include("header.php");
include("conection.php");
include("modal.php");
?>
<script>
function getXMLHTTP() { //fuction to return the xml http object
var xmlhttp=false;
try{
xmlhttp=new XMLHttpRequest();
}
catch(e) {
try{
xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e1){
xmlhttp=false;
}
}
}
return xmlhttp;
}
function getCity(strURL) {
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('subdiv').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
</script>
<?php
if(isset($_GET['view']) && $_GET['view']== "delete")
// if($_GET["view"] == "delete")
{
mysql_query("DELETE FROM attendance WHERE attid ='$_GET[slid]'");
}
if(isset($_SESSION["userid"]))
{
if(isset($_GET["first"]))
{
}
else
{
$_GET["first"] =0;
$_GET["last"] = 10;
}
if(isset($_POST["button"]))
{
$resultax = mysql_query("SELECT * FROM attendance where subid='$_POST[subject]'");
}
else
{
$result = mysql_query("SELECT * FROM attendance LIMIT $_GET[first] , $_GET[last]");
}
$result1 = mysql_query("SELECT * FROM course LIMIT $_GET[first] , $_GET[last]");
$result2 = mysql_query("SELECT * FROM subject LIMIT $_GET[first] , $_GET[last]");
?>
<section id="page">
<header id="pageheader" class="normalheader">
<h2 class="sitedescription">
</h2>
</header>
<section id="contents">
<article class="post">
<header class="postheader">
<h2>Attendance Details</h2>
<p> </p>
<?php include("selectcss.php"); ?>
<p> </p>
</header>
<section class="entry">
<?php
if(mysql_num_rows($resultax) >= 1)
{
?>
<table width="490" border="1">
<tr>
<td width="36">Sl.No</td>
<td width="54">Student ID</td>
<td width="53">Student Name</td>
<td width="52">Subject</td>
<td width="50">Total Classes</td>
<td width="64">Attended Classes</td>
<td width="67">Percentage</td>
<td width="62"><strong>Action</strong></td>
</tr>
<?php
$i =$_GET[first]+1;
while($row = mysql_fetch_array($resultax))
{
echo "<tr>";
echo "<td> " . $i . "</td>";
echo "<td> " . $row['studid'] . "</td>";
$result5 = mysql_query("SELECT * FROM studentdetails where studid='$row[studid]'");
while($rowa= mysql_fetch_array($result5))
{
echo "<td> " . $rowa['studfname'] . " " . $rowa['studlname'] . "</td>";
}
$result55 = mysql_query("SELECT * FROM subject where subid='$row[subid]'");
while($rowasy= mysql_fetch_array($result55))
{
echo "<td> " . $rowasy['subname'] . "</td>";
}
echo "<td> " . $row['totalclasses'] . "</td>";
echo "<td> " . $row['attendedclasses'] . "</td>";
echo "<td> " . $row['percentage'] . "</td>";
echo "<td> <a href='viewrecords.php?slid=$row[attid]&view=attendance'><img src='images/view.png' width='32' height='32' /></a><a href='attendanceinsert.php?slid=$row[attid]&view=edit'><img src='images/edit.png' width='32' height='32' /><a href='attendanceview.php?slid=$row[attid]&view=delete'></a> </td>";
echo "</tr> ";
$i++;
}
$first=$_GET[first]-10;
$last= $_GET[last]- 10;
?>
<tr>
<td><?php
if($first <0)
{
}
else
{ ?>
<a href="attendanceview.php?first=<?php echo $first; ?>&last=<?php echo $last; ?>">
<?php
}
?><img src="images/previous.png" alt="" width="32" height="32" /></td>
<td><a href="attendance.php" ><img src="images/add.png" alt="" width="32" height="32" /></a></td>
<?php
$first=$_GET[first]+10;
$last = $_GET[last]+ 10;
?>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td><?php
if($first > mysql_num_rows($result))
{
}
else
{ ?>
<a href="attendanceview.php?first=<?php echo $first; ?>&last=<?php echo $last; ?>">
<?php
}
?><img src="images/next.png" alt="" width="32" height="32" /></td>
</tr>
</table></td>
</tr>
</table>
<?php
}
else
{
echo "<h2>No Records Found...</h2>";
}
?>
<?php
if($_SESSION["type"]=="admin")
{
?>
<p><a href="examview.php?first=<?php echo $first; ?>&last=<?php echo $last; ?>"><a href="attendance.php" ><strong>Add Attendance Records</strong></a></p>
<?php
}
?>
</section>
</article>
</section>
<?php
}
else
{
header("Location: admin.php");
}
if($_SESSION["type"]=="admin")
{
include("adminmenu.php");
}
else
{
include("lecturemenu.php");
}
include("footer.php"); ?>