Current File : /home/inlingua/www/noida/icentex/admin_fd/ingl_class.select.php |
<?php
// Copyright, Panalink Infotech Limited. Created on: 27-11-2010
// Include header
/*echo "<pre>";
print_r($_SESSION['branch']);
exit;*/
include "header_fd.php";
?>
<h3> Class</h3>
<div id="contentnew">
<a href="ingl_class.main.php">Add New Class</a>
<br>
<?php
echo "<br>";
function Certificate_d($courseId,$level)
{
if($level=="1A" || $level=="1B" || $level=="1B+"|| $level=="E1S2" || $level=="E1S2+")
{
$cert="certificate_1.php";
$tab="level_1";
}
elseif($level=="2A" || $level=="2B" || $level=="2A+" || $level=="2B+" || $level=="E2-S2" || $level=="E2-S2+"|| $level=="E2-S1"|| $level=="E2-S1+")
{
$cert="certificate_2.php";
$tab="level_2";
}
elseif($level=="3A" || $level=="3B" || $level=="E3-S1" || $level=="E3-S2")
{
$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";
}
elseif($level=="Private")
{
$cert="certificate_Private.php";
$tab="level_private";
}
else
{
$cert="#";
}
$queryC="select count(recNo) as tot from ".$tab." where courseId='".$courseId."'";
$resultC=mysql_query($queryC);
$countT=mysql_fetch_array($resultC);
if($countT['tot']>0)
{
$link="<a href='".$cert."?courseId=".$courseId."' target='_blank'><font size='1'>Download Certificate(".$countT[tot].")</font></a>";
}
else
{
$link="<font size='1'>Not Generated Yet</font>";
}
return $link;
}
///////////////////////////////////////////////////
function certificate_L($courseId)
{
$queryS="select count(recNo) as tot from ingl_student where courseId='".$courseId."'";
$resultS=mysql_query($queryS);
$countS=mysql_fetch_array($resultS);
if($countS[tot]>0)
{
$link="<a href='welcome_note_all.php?courseId=".$courseId."' target='_blank'><font size='1'>Download Letter(".$countS[tot].")</font></a>";
}
else
{
$link="<font size='1'>No Student 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();
?>
<table width="70%" border="0">
<form action="ingl_class.select.php">
<input type="hidden" name="search" value="1" />
<tr>
<td>Select Location</td>
<td > <?php
$query="select recNo as id ,location as description from timesheet_location ";
$res=mysql_query($query);
if(mysql_num_rows($res)>0)
{
echo "<select name='c_location' >";
echo"<option value='All'>All</option>";
while($rsult=mysql_fetch_array($res))
{
if($rsult['description']==$_SESSION['branch'])
{
echo "<option value='".$rsult['id']."' >".$rsult['description']."</option>";
}
else
{
echo "<option value='".$rsult['id']."' >".$rsult['description']."</option>";
}
}
echo "</select>";
}
?></td>
</tr>
<tr>
<td></td>
<td><input class="submit1" type="Submit" value="Search" /></td>
</tr>
</form>
</table>
<br>
<br>
<?php
// Records selection sql
$sqlQuery = "SELECT * FROM ingl_class";
if($_REQUEST['c_location']!="")
{
$sqlQuery .= " where c_location='".$_REQUEST['c_location']."' ";
}
if($_REQUEST['courseId']!="")
{
$sqlQuery .= " where courseid='".$_REQUEST['courseId']."' ";
}
if($_REQUEST['datepicker1'])
{
if(!$_REQUEST['datepicker2'])
{
$sqlQuery.=" && startdate = '".$_REQUEST['datepicker1']."' ";
}
else
{
$sqlQuery.=" && startdate >='".$_REQUEST['datepicker1']."' ";
}
}
if($_REQUEST['datepicker2'])
{
$sqlQuery.=" && startdate <='".$_REQUEST['datepicker2']."' ";
}
if(isset($_REQUEST['type']))
{
if($_REQUEST['type']=="current")
{
$sqlQuery.=" && startdate <= CURDATE() && enddate >=CURDATE() ";
}
else if($_REQUEST['type']=="upcoming")
{
$sqlQuery.=" && startdate > CURDATE() ";
}
else if($_REQUEST['type']=="completed")
{
$sqlQuery.=" && enddate < CURDATE() ";
}
else
{
}
}
$sqlQuery.=" order by id desc ";
//echo $sqlQuery;exit;
// Prepare page navigation
$resultsPerPage = 20; // number of rows to return per page
// Prepare add on URL
$addOnUrl = "&courseId=".$_REQUEST['courseId'];//."&datepicker1=".$_REQUEST['datepicker1']." & datepicker1=".$_REQUEST['datepicker2']
$offset=$_REQUEST['offset'];
if ($resultsPerPage > 0)
{ $prev_next_links = $dbObject->prev123Next($sqlQuery, $resultsPerPage,$addOnUrl);
//print_r($prev_next_links); exit;
$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');
}
//echo $sqlQuery;
// Select records from table
$selectedRecords = $dbObject->Select($sqlQuery);
echo "<table border='1' class='pa-nor' width='80%' cellspacing='0'>";
echo "<tr valign='top' class='rowH'>";
echo "<th><b>Location</b></th>";
echo "<th><b>Name</b></th>";
echo "<th><b>Capacity</b></th>";
echo "<th><b>Status</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())
{
/*echo "<pre>";
print_r($objectData);
exit;*/
$query2="select location from timesheet_location where recNo='".$objectData['c_location']."' ";
$res1=mysql_query($query2);
$row=mysql_fetch_assoc($res1);
echo "<tr valign='top' onmouseover=\"this.className='pa-row-highlight'\" onmouseout=\"this.className='pa-nor'\">";
echo "<td>$row[location]</td>";
echo "<td>$objectData[c_name]</td>";
echo "<td>$objectData[c_capacity]</td>";
echo "<td>$objectData[is_active]</td>";
echo "<td><a href='ingl_class.main.php?aC=sM&kV=". $objectData['id'] ."'>Modify</a> |";
echo "<a href='ingl_class.main.php?aC=sV&kV=". $objectData['id'] ."'>View</a> |";
echo " <a href='ingl_class.main.php?aC=sD&kV=". $objectData['id'] ."'>Delete</a><br>".Certificate_d($objectData['courseid'],$objectData['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
//
// Include footer
include "footer_fd.php";
require("05featuredemo1_fd.php");
//echo $sqlqureynew;
$dbObject->CloseConnection();
?>