| Current Path : /home/bolconlineco/www/tutor/ |
| Current File : //home/bolconlineco/www/tutor/searchstudent.php |
<?php
ob_start();
session_start();
header("Expires: Sat, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: post-check=0, pre-check=0",false);
session_cache_limiter("must-revalidate");
?>
<?php //include('header.php'); ?>
<?php include('../includes/connection/func.inc.php')?>
<?php
if(!isset($_SESSION['tutor']) || $_SESSION['tutorrole'] != 3)
{
header("location:../index.php");
exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Expires" content="-1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Brentwood </title>
<link rel="stylesheet" href="../css/main.css" type="text/css" />
<script src="../js/jquery-1.8.2.min.js"></script>
<script src="../js/jquery.datepick.js"></script>
<link rel="stylesheet" href="../css/jquery.datepick.css" />
<script src="//cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="//cdn.datatables.net/1.10.9/css/jquery.dataTables.min.css">
</head>
<body>
<?php
$co=$_SESSION['tutor'];
$r=mysql_query("select * from tutor where email='$co'");
$rr=mysql_fetch_array($r);
$fn=$rr['firstname'];
$ln=$rr['lastname'];
$TuId=$rr['tutorId'];
?>
<div id="header">
<div id="header-wrap">
<h1><a href="#">BRENTWOOD admin</a></h1>
<div id="header-nav">
<h6>Welcome <?php echo 'Respected '.ucwords($fn). ' '.ucwords($ln);?></h6>
<ul>
<li><a href="dashbord.php">Home</a></li>
<li><a href="logout.php">Log out</a></li>
</ul>
</div>
</div><!--end header-wrap -->
<div id="menu">
<ul>
<!--<li><a href="programecoordinator.php">Program Coordinator</a></li>
<li><a href="student.php">Student Management</a></li>
<li class="active" ><a href="tutor.php">Tutor Management</a></li>
<li><a href="category.php">Category</a></li>-->
<?php
$username=$_SESSION['username'];
$result=mysql_query("select * from tutor where email='$username'");
$row=mysql_fetch_array($result);
$tid=$row['tutorId'];
$query1="select * from uploadassignment where tutorId='$tid' and uploadstatus=1";
$result1=mysql_query($query1) or die(mysql_error());
$num=mysql_num_rows($result1);
?>
<li><a href="courses.php">New Assignments( <?php echo $num.' New'; ?>)</a></li>
<!--<li><a href="viewcourse.php">View courses & student</a></li>-->
<li><a href="searchstudent.php">Custom Search</a></li>
<li><a href="changepassword.php">Change Password</a></li>
</ul>
</div>
</div><!--end header -->
<div id="wrapper">
<script>
$("document").ready(function(){
$("#datepicker").datepick({dateFormat:'dd/mm/yyyy'});
$("#datepicker2").datepick({dateFormat:'dd/mm/yyyy'});
$("#from").datepick({dateFormat:'dd/mm/yyyy'});
$("#to").datepick({dateFormat:'dd/mm/yyyy'});
$("#ddo").datepick({dateFormat:'dd/mm/yyyy'});
$("#taskfrom").datepick({dateFormat:'dd/mm/yyyy'});
$("#taskto").datepick({dateFormat:'dd/mm/yyyy'});
});
</script>
<div id="content">
<div id="frm">
</div>
<div id="data" style="display:inline-block">
<h2>Search Student</h2>
<form id="ID" action="" method="post" autocomplete="off" >
<div class="sbg">
<h4>Registration Date</h4>
<div> </div>
<label for="from">Form:</label><input type="text" name="registfrom" id="datepicker" />
<label for="to">To:</label><input type="text" name="registto" id="datepicker2" />
</div>
<div class="sbg">
<h4>Assignment Date</h4>
<div> </div>
<label for="from">Form:</label><input type="text" name="from" id="from" />
<label for="to">To:</label><input type="text" name="to" id="to"/>
</div>
<div class="sbg">
<h4>Task Date</h4>
<div> </div>
<label for="from">Form:</label><input type="text" name="taskfrom" id="taskfrom" />
<label for="to">To:</label><input type="text" name="taskto" id="taskto"/>
</div>
<!--<div id="search">
<div id="registdate">
<p>Registration Date</p>
Form:<input type="text" name="from" />
To:<input type="text" name="to" />
</div>
</div>-->
<ul class="col">
<li>
</li>
<li>
<label for="name"> Student Id:</label>
<input class="" type="text" id="name" name="studentId" value="" />
</li>
<li>
<label for="name"> First Name:</label>
<input class="" type="text" id="name" name="firstname" value="" />
</li>
<li>
<label for="name">Date of birth:</label>
<input class="" type="text" id="ddo" name="dob" value="" />
</li>
<li>
<label for="name">City:</label>
<input class="" type="text" id="name" name="city" value="" />
</li>
</ul>
<ul class="col">
<li>
<label for="name">Course:</label>
<select name="course" class="cstat" style="width:240px;">
<option value="">SELECT</option>
<?php
$query = "SELECT * FROM coursetutor where tutorId=".$rr['tutorId'];
$result = mysql_query($query) or die(mysql_error());
while($rowSet = mysql_fetch_array($result))
{
$query="select courseId,courseName from course where courseId=".$rowSet['courseId'];
$results=mysql_query($query) or die(mysql_error());
$set=mysql_fetch_array($results);
?>
<option value="<?php echo $set['courseId']; ?>"><?php echo $set['courseName']; ?></option>
<?php
}
?>
</select>
</li>
<li>
<label for="name">Last Name:</label>
<input class="" type="text" id="name" name="lastname" value="" />
</li>
<li>
<label for="name">Email:</label>
<input class="" type="text" id="name" name="email" value="" />
</li>
<li>
<label for="name">Country:</label>
<select name="country" class="cstat" style="width:240px;">
<option value="">Choose Country</option>
<?php
$query="select distinct country from student";
$result=mysql_query($query) or die(mysql_error());
while($row=mysql_fetch_array($result))
{
?>
<option value="<?php echo $row['country'];?>"><?php echo $row['country'];?></option>
<?php
}
?>
</select>
</li>
<li>
<label for="name">Status:</label>
<select name="status" class="cstat">
<option value="">Status</option>
<?php $select_status = "SELECT * FROM status WHERE Status = 1";
$select_status2 = mysql_query($select_status);
while($select_status3 = mysql_fetch_array($select_status2)){
?>
<option value="<?=$select_status3['StatusId'] ?>"><?php echo $select_status3['StatusName']; ?></option>
<? } ?>
</select>
</li>
<li>
<div id="btn">
<!--<input class="clear" type="reset" value="Clear" />-->
<input class="add2" type="submit" name="Search" value="Search" />
</div>
</li>
</ul>
</form>
</div>
<!-- Start of search -->
<?php
if(isset($_POST['Search']))
{
if(!empty($_POST['studentId']))
{
$studentId=sql_strip($_POST['studentId']);
$result=mysql_query("select * from student where rollno=(select rollno from assigncourse where rollno='$studentId' and tutorId='$TuId')");
}else if(!empty($_POST['email']))
{
$email=sql_strip($_POST['email']);
//$result=mysql_query("select * from student where email='$email'");
$result=mysql_query("select s.*,ac.* from student as s join assigncourse as ac on s.rollno=ac.rollno where
ac.tutorId='$TuId' and s.email='%$email%'");
}else if(!empty($_POST['firstname']))
{
$firstname=sql_strip($_POST['firstname']);
//$result=mysql_query("select * from student where fname='$firstname'");
$result=mysql_query("select s.*,ac.* from student as s join assigncourse as ac on s.rollno=ac.rollno where ac.tutorId='$TuId' and s.fname='%$firstname%' order by s.registrationdate");
//$num=mysql_num_rows($result);
}else if(!empty($_POST['lastname']))
{
$lastname=sql_strip($_POST['lastname']);
$result=mysql_query("select s.*,ac.* from student as s join assigncourse as ac on s.rollno=ac.rollno
where ac.tutorId='$TuId' and s.lname='%$lastname%' order by s.registrationdate");
}else if(!empty($_POST['country']))
{
$country=$_POST['country'];
$result=mysql_query("select s.*,ac.* from student as s join assigncourse as ac on s.rollno=ac.rollno where ac.tutorId='$TuId' and s.country='$country' order by s.registrationdate");
}else if(!empty($_POST['city']))
{
$city=sql_strip($_POST['city']);
//$result=mysql_query("select * from student where city='$city'");
$result=mysql_query("select s.*,ac.* from student as s join assigncourse as ac on s.rollno=ac.rollno where ac.tutorId='$TuId' and s.city='%$city%' order by s.registrationdate");
}else if(!empty($_POST['dob']))
{
$dob=$_POST['dob'];
$d1=explode('/',$dob);
$new=$d1[2].'-'.$d1[1].'-'.$d1[0];
$result=mysql_query("select * from student where dob='$new' order by registrationdate");
// $result=mysql_query("select s.*,ac.* from student as s join assigncourse as ac on s.rollno=ac.rollno
//where ac.tutorId='$TuId' and s.dob='$dob'");
}else if(!empty($_POST['registfrom']) && !empty($_POST['registto'])&& !empty($_POST['status'])){
$date2=$_POST['registfrom'];
$full2=explode('/',$date2);
$statuss=$_POST['status'];
$rfrom=$full2[2].'-'.$full2[1].'-'.$full2[0];
$date1=$_POST['registto'];
$full=explode('/',$date1);
$rto=$full[2].'-'.$full[1].'-'.$full[0];
$result=mysql_query("select s.*,ac.* from student as s join assigncourse as ac on s.rollno=ac.rollno join studentassignment as sa on ac.rollno=sa.rollno where as.AssignmentStatus=2 and
ac.tutorId='$TuId' and s.registrationdate between '$rfrom' and '$rto' and studentstatus='$statuss'");
}else if(!empty($_POST['registfrom']) && !empty($_POST['registto'])){
$date2=$_POST['registfrom'];
$full2=explode('/',$date2);
$rfrom=$full2[2].'-'.$full2[1].'-'.$full2[0];
$date1=$_POST['registto'];
$full=explode('/',$date1);
$rto=$full[2].'-'.$full[1].'-'.$full[0];
$result=mysql_query("select s.*,ac.* from student as s join assigncourse as ac on s.rollno=ac.rollno join studentassignment as sa on ac.rollno=sa.rollno where as.AssignmentStatus=2 and
ac.tutorId='$TuId' and s.registrationdate between '$rfrom' and '$rto' order by s.registrationdate");
}else if(!empty($_POST['taskfrom']) && !empty($_POST['taskto']))
{
$date2=$_POST['taskfrom'];
$full2=explode('/',$date2);
$taskfrom=$full2[2].'-'.$full2[1].'-'.$full2[0];
$date1=$_POST['taskto'];
$full=explode('/',$date1);
$taskto=$full[2].'-'.$full[1].'-'.$full[0];
$result=mysql_query("select s.*,t.* from student as s join tasks as t on s.rollno=t.rollno where
t.taskdate between '$taskfrom' and '$taskto' group by s.rollno order by t.taskdate,s.registrationdate ");
}
else if(!empty($_POST['from']) && !empty($_POST['to']))
{
$formm=date($_POST['from']);
$full1=explode('/',$formm);
$too=date($_POST['to']);
$full2=explode('/',$too);
$f=$full1[2].'-'.$full1[1].'-'.$full1[0];
$t=$full2[2].'-'.$full2[1].'-'.$full2[0];
$query="select distinct s.*,ua.* from student as s join uploadassignment as ua on s.rollno=ua.rollno where ua.uploadStatus=1 and ua.tutorId='$TuId' and ua.uploaddate between '$f' and '$t' group by s.rollno order by ua.uploaddate desc,s.registrationdate";
$result=mysql_query($query) or die(mysql_error());
}else if(!empty($_POST['course']))
{
//$category=sql_strip($_POST['category']);
$course=sql_strip($_POST['course']);
//$query="select * from assigncourse where categoryid='$category' and courseid='$course'";
//$result1=mysql_query($query) or die(mysql_error());
$query="select s.*,ac.* from student as s join assigncourse as ac on s.rollno=ac.rollno
where ac.tutorId='$TuId' and ac.courseid='$course' order by s.registrationdate";
$result=mysql_query($query) or die(mysql_error());
}else if(!empty($_POST['status']))
{
$status=sql_strip($_POST['status']);
//$result=mysql_query("select * from student where studentstatus='$status'");
$result=mysql_query("select s.*,ac.* from student as s join assigncourse as ac on s.rollno=ac.rollno where
ac.tutorId='$TuId' and s.studentstatus='$status' order by s.registrationdate");
}
if(@mysql_num_rows($result) > 0)
{
?>
<p style="float:none;"><?php
if(!empty($error))
{
echo $error; }?></p>
<div id="data">
<table width="100%" id="mytable1" border="0" cellspacing="0" cellpadding="0" class="tablestyle" style="margin-bottom:20px;"> <thead>
<tr id="title">
<th class="small-dd">Reg Date</th>
<th class="big" style="font-size:10px;">Course</th>
<th class="small-xx">ID</th>
<th class="small-x">First Name</th>
<th class="small-x">Last Name</th>
<th class="small-x">Country</th>
<th class="small-x">Tutor</th>
<th class="small-x">Task</th>
<th class="small-x">Assignment</th>
<th class="small-xx">Status</th>
</tr>
</thead>
<!-- end title -->
<tbody>
<?php
while($row=mysql_fetch_array($result))
{
?>
<tr class="even" style="font-size:12px;">
<td class="small-dd"><?php echo date('d/m/Y',strtotime($row['registrationdate']));?></td>
<?php
$qqq=mysql_query("select * from assigncourse where rollno=".$row['rollno']);
$fetch=mysql_fetch_array($qqq);
$qu3=mysql_query("select firstname,lastname from tutor where tutorId=".$fetch['tutorId']) or die(mysql_error());
$fetchs=mysql_fetch_array($qu3);
$course=mysql_query("select courseName from course where courseId=".$fetch['courseid']) or die(mysql_error());
$ff=mysql_fetch_array($course);
?>
<td class="big" style="width:353px"><?php echo $ff['courseName'];?></td>
<td class="small-xx"><a href="studentInfo.php?Id=<?php echo $row['rollno']; ?>" target="_new" ><?php echo $row['rollno'];?></a></td>
<td class="small-x"><?php echo $row['fname'];?></td>
<td class="small-x"><?php echo $row['lname']; ?></td>
<!--<th class="small">DOB</th>
<th class="small">Email</th>
<th class="small">City</th>-->
<td class="small-x"><?php echo $row['country'];?></td>
<td class="small-x"><?php echo $fetchs['firstname'].' '.$fetchs['lastname'];?></td>
<?php
$q=mysql_query("select * from studentassignment where rollno=".$row['rollno']." order by SAid desc limit 1") or die(mysql_error());
$date=mysql_fetch_array($q);
$qq01="select * from uploadassignment where rollno=".$row['rollno']." and
uploadstatus=1 order by uploaddate asc limit 1";
$rr=mysql_query($qq01) or die(mysql_error());
$dd=mysql_fetch_array($rr);
?>
<?php
$q="select * from tasks where taskstatus=0 and rollno=".$row['rollno'];
$r=mysql_query($q) or die(mysql_error());
?>
<td class="small-x"><?php
if(mysql_num_rows($r)>0)
{
while($rows=mysql_fetch_array($r))
{
$fulls=explode('-',$rows['taskdate']);
$year=$fulls[0];
$month=$fulls[1];
$day=$fulls[2];
$date=$day.'/'.$month.'/'.$year;
echo $date.'</br>';
}
}else
{
echo "No Tasks";
}
?></td>
<td class="small-x"><?php
if(!empty($date['AssignmentStatus']))
{
if(($date['AssignmentStatus']==1))
{
echo "N/A";
}else if($date['AssignmentStatus']==2){
if(empty($dd['uploaddate']))
{
echo "N/A";
}else{
$d1=$dd['uploaddate'];
$full=explode('-',$d1);
$year=$full[0];
$month=$full[1];
$day=$full[2];
$dat=$day.'/'.$month.'/'.$year;
echo $dat;
}
//echo "Tutor ($dat)";
}else if($date['AssignmentStatus']==3)
{
echo "N/A";
}
}
else
{
echo "N/A";
}
?></td>
<td class="small-xx"><?php
if($row['studentstatus']==1)
{
echo "Active";
}
else if($row['studentstatus']==2)
{
echo "InActive";
}else if($row['studentstatus']==3)
{
echo "Completed";
}else if($row['studentstatus']==4)
{
echo "Suspended";
}?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<script>
$(document).ready(function(){
$('#mytable1').dataTable({bFilter: false, bInfo: false, "bLengthChange": false});
});
</script>
</div>
<?php
}else
{
echo "No Records Founds in database";
}
}
?>
</div><!-- end data -->
</div> <!-- end content -->
</div><!-- end wrapper -->
<script language="javascript">
$("document").ready(function(){
var course=$('#course');
$("#category").change(function(){
var categoryId=$(this).val();
$.post('get_courses.php',{id:categoryId,tutorId:<?php echo $rr['tutorId'];?>},function(data){
course.html(data);
course.removeAttr('disabled');
})
});
});
</script>
<?php include('../includes/footer.php');?>