Current File : /home/inlingua/www/icentex/level_2.select.php
<?php
// Copyright, Panalink Infotech Limited. Created on: 09-07-2010
// Include header
include("header.php");
$_SESSION['courseId']=$_REQUEST['courseId'];
$_SESSION['c_level']=$_REQUEST['level'];
echo"<h3><a href='certificates.php?courseId=".$_REQUEST['courseId']."' target='_blank'>Download All Certificates</a></h3>";


echo "<div id='contentnew'>";


// 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();

// Records selection sql
$sqlQuery = "SELECT a.*,s.studentName FROM level_2 a left join  ingl_student
    s on s.recNo =a.student_recNo where a.courseId='".$_REQUEST['courseId']."'";

 //$sqlQuery = "SELECT * FROM level_2 where courseId='".$_REQUEST[courseId]."'";

// Prepare page navigation
$resultsPerPage = 20; // number of rows to return per page

// Prepare add on URL
$addOnUrl = "";

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'>";
echo "<tr valign='top' class='rowH'>";
//echo "<th><b>recNo</b></th>";
echo "<th><b>Name</b></th>";
echo "<th><b>Language</b></th>";
echo "<th><b>Course ID</b></th>";
echo "<th><b>Level</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())
{
	$queryCourse="select courseid,startdate,enddate,language,level from ingl_course where courseid='".$objectData[courseId]."'";
        $resultCourse=mysqli_query($conn,$queryCourse);
        $numCourse=mysqli_fetch_array($resultCourse);
$singlestd=$_REQUEST['courseId'].'&student_recNo='.$objectData['student_recNo'];
	echo "<tr valign='top' onmouseover=\"this.className='pa-row-highlight'\" onmouseout=\"this.className='pa-nor'\">";
	//echo "<td>$objectData[recNo]</td>";
echo "<td>$objectData[studentName]</td>";
echo "<td>$objectData[language]</td>";
echo "<td>$objectData[courseId]</td>";
echo "<td>$numCourse[level]</td>";

	echo "<td><a href='level_2.main.php?aC=sM&kV=". $objectData['recNo'] ."'>Modify</a> |";
	echo "<a href='level_2.main.php?aC=sV&kV=". $objectData['recNo'] ."'>View</a> |";
	echo " <a href='level_2.main.php?aC=sD&kV=". $objectData['recNo'] ."'>Delete</a> |";	
	echo " <a href='certificates-single.php?courseId=".$singlestd."' target='_blank'>Download Certificate</a></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-certificate.php";
?>