Current File : /home/inlingua/www/dwarka/icentex/admin_fd/ingl_student.select.php |
<?php
// Copyright, Panalink Infotech Limited. Created on: 27-11-2010
// Include header
include "header_fd.php";
?>
<h3> Student</h3>
<div id="contentnew">
<a href="ingl_student.main.php">Add New Student</a>
<br>
<?php
echo "<br>";
function Certificate_d($conn,$student,$level)
{
if($level=="1A" || $level=="1B")
{
$cert="certificate_1.php";
$tab="level_1";
}
elseif($level=="2A" || $level=="2B")
{
$cert="certificate_2.php";
$tab="level_2";
}
elseif($level=="3A" || $level=="3B")
{
$cert="certificate_3.php";
$tab="level_3";
}
elseif($level=="4")
{
$cert="certificate_4.php";
$tab="level_4";
}
elseif($level=="5")
{
$cert="certificate_5.php";
$tab="level_5";
}
else
{
$cert="#";
}
$queryC="select count(recNo) as tot from ".$tab." where student_recNo='".$student."'";
$resultC=mysqli_query($conn,$queryC);
$countT=@mysqli_fetch_array($resultC);
if($countT['tot']>0)
{
$link="<a href='".$cert."?student=".$student."' target='_blank'><font size='1'>Download Certificate</font></a>";
}
else
{
//$link="<a href='".$cert."?student=".$student."' target='_blank'><font size='1'>Download Certificate</font></a>";
$link="<font size='1'>Not Generated Yet</font>";
}
return $link;
}
// Include the database connection details
require('../dbConnection.php');
// Include common functions
require('../commonFunc.php');
// Include common functions
require('../globalVars.php');
// Include the table handler class
require('../dbHandler.class.php');
// Init and connect to database
$dbObject = new dbHandler();
$dbObject->connect();
//echo '<pre>';print_r($_SESSION);
?>
<?php if(isset($_SESSION['msgE']) && $_SESSION['msgE']!="") { echo "<font color='red'> The Login Ids - ".$_SESSION['msgE']." are already exists.So cannot be added.</font>";
unset ($_SESSION['msgE']);
}
?>
<form action="ingl_student.select.php">
<b>Search</b> <?php
$query="select * from ingl_course where branch='".$_SESSION['branch']."' order by recNo desc";
$res=mysqli_query($conn,$query);
if(mysqli_num_rows($res)>0)
{
echo "<select name='courseId' onchange='displaystudent(this.value)'>";
echo"<option value=''>Select Course ID</option>";
while($rsult=mysqli_fetch_array($res))
{
echo"<option value='".$rsult[recNo]."'" ;
if($_REQUEST['courseId']==$rsult[recNo]) echo "selected";
echo">".$rsult['courseid']."</option>";
}
echo"</select>";
}
else
{
echo "Please enter the Course ID ";
}
?>
and <b>Name</b> <input type="text" name="studentName" value="<?php echo $_REQUEST['studentName'] ?>" />
<input type="hidden" name="search" value="1" />
<input class="submit1" type="Submit" value="Search" />
</form>
<br>
<?php
if($_REQUEST['courseId']!="" && $_REQUEST['studentName']=="")
{
$sqlQuery = "SELECT s.*, c.courseid as ccourseid FROM ingl_student s left join ingl_course c on c.recNo = s.courseId
where s.branch='".$_SESSION['branch']."' && s.courseId='".$_REQUEST['courseId']."' order by s.studentName Asc";
}
elseif($_REQUEST['courseId']=="" && $_REQUEST['studentName']!="")
{
$sqlQuery = "SELECT s.*, c.courseid as ccourseid FROM ingl_student s left join ingl_course c on c.recNo = s.courseId where s.branch='".$_SESSION['branch']."' && s.studentName like '".$_REQUEST['studentName']."%' order by s.studentName Asc";
}
elseif($_REQUEST['courseId']!="" && $_REQUEST['studentName']!="")
{
$sqlQuery = "SELECT s.*, c.courseid as ccourseid FROM ingl_student s left join ingl_course c on c.recNo = s.courseId where s.branch='".$_SESSION['branch']."' && s.courseId='".$_REQUEST['courseId']."' && s.studentName like '".$_REQUEST['studentName']."%' order by s.studentName Asc";
}
else
{
// Records selection sql
$sqlQuery = "SELECT s.*, c.courseid as ccourseid FROM ingl_student s left join ingl_course c on c.recNo = s.courseId where s.branch='".$_SESSION['branch']."' order by s.studentName Asc";
}
// Prepare page navigation
$resultsPerPage = 20; // number of rows to return per page
isset($_REQUEST['offset'])?$offset =$_REQUEST['offset']:$offset ='0';
// Prepare add on URL
$addOnUrl = "&courseId=".$_REQUEST['courseId']."&studentName=".$_REQUEST['studentName'];
if ($resultsPerPage > 0)
{ $prev_next_links = $dbObject->prev123Next($sqlQuery, $resultsPerPage,$addOnUrl);
$sqlQuery .= " limit " . $offset . "," . $resultsPerPage ;
}
// Print navigation bar
function printArray($element) { echo "$element"; }
if ($resultsPerPage > 0 && $prev_next_links)
{ //echo "Page: ";
//array_walk($prev_next_links, 'printArray');
}
// Select records from table
$selectedRecords = $dbObject->Select($sqlQuery);
echo "<table border='1' class='pa-nor' cellspacing='0' width='100%'>";
echo "<tr valign='top' class='rowH'>";
echo "<th><b>Student Name</b></th>";
echo "<th><b>Course ID</b></th>";
echo "<th><b>Course Type</b></th>";
echo "<th><b>Login</b></th>";
echo "<th><b>Password</b></th>";
echo "<th>Action</th>";
echo "</tr>";
// If no records selected, print message
if (!$selectedRecords)
{ echo "<tr><td colspan='5'>There are no selected records</td></tr>"; }
while($objectData=$dbObject->SelectNext())
{
$level="select * from ingl_course where recNo='".$objectData[courseId]."'";
$resultL=mysqli_query($conn,$level);
$numL=mysqli_fetch_array($resultL);
if($objectData['course_type']=='part1'){
$coursetype="Part A";
}
else if($objectData['course_type']=='part2'){
$coursetype="Part B";
}else {
$coursetype="Complete";
}
echo "<tr valign='top' onmouseover=\"this.className='pa-row-highlight'\" onmouseout=\"this.className='pa-nor'\">";
echo "<td>$objectData[studentName]<br><a href='welcome_note.php?student=".$objectData['recNo']."' target='_blank'><font size='1'>Download Letter</font></a></td>";
echo "<td>$objectData[ccourseid]</td>";
echo "<td>$coursetype</td>";
echo "<td>$objectData[login]</td>";
echo "<td>$objectData[password]</td>";
echo "<td><a href='ingl_student.main.php?aC=sM&kV=". $objectData['recNo'] ."&courseId=".$_REQUEST['courseId']."&studentName=".$_REQUEST['studentName']."'>Modify</a> |";
echo "<a href='ingl_student.main.php?aC=sV&kV=". $objectData['recNo'] ."'>View</a> |";
echo " <a href='ingl_student.main.php?aC=sD&kV=". $objectData['recNo'] ."&courseId=".$_REQUEST['courseId']."&studentName=".$_REQUEST['studentName']."'>Delete</a><br>".Certificate_d($conn,$objectData['recNo'],$numL['level'])." </td>";
echo "</tr>";
}
print "</table>";
// Print navigation bar
if ($resultsPerPage > 0 && $prev_next_links)
{ echo "Page: ";
array_walk($prev_next_links, 'printArray');
}
?>
</div>
<?php
$dbObject->CloseConnection();
// Include footer
include "footer_fd.php";
?>