Current File : /home/inlingua/public_html/dwarka/icentex/timesheet.select.php |
<?php
// Copyright, Panalink Infotech Limited. Created on: 22-05-2010
// Include header
include "header.php";
//echo "<br>";
echo'<div id="contentnew"><h3> Saved Timesheet</h3>';
echo"<div style='margin-left:10px;'>";
echo"<div><a href='timesheet.php'>Add New Timesheet</a></div>";
// 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 * FROM timesheet where status_send='0' && approve_status=1 && instructorId='".$_SESSION[id]."' order by recNo desc";
// Prepare page navigation
$resultsPerPage = 20; // number of rows to return per page
$offset=$_REQUEST['offset'];
// 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='0' class='pa-nor' cellspacing='0' width='100%'>";
echo "<tr valign='center' class='rowH' style='height:30px;'>";
//echo "<th><b>recNo</b></th>";
echo "<th><b>From Date</b></th>";
echo "<th><b>To Date</b></th>";
echo "<th><b>Location</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>"; }
$i=1;
while($objectData=$dbObject->SelectNext())
{
if($i%2==0) $bgcolor='#F3F3F3';
else $bgcolor='#EBEBEB';
echo "<tr valign='top' style='background:$bgcolor;height:25px;' onmouseover=\"this.className='pa-row-highlight'\" onmouseout=\"this.className='pa-nor'\" >";
//echo "<td>$objectData[recNo]</td>";
echo "<td>$objectData[fromDate]</td>";
echo "<td>$objectData[toDate]</td>";
echo "<td>$objectData[location]</td>";
echo "<td><a href='timesheet.main.php?aC=sM&kV=". $objectData['recNo'] ."'>Modify</a> | ";
echo "<a href='timesheet.main.php?aC=sV&kV=". $objectData['recNo'] ."'>View</a> | ";
echo " <a href='timesheet.main.php?aC=sD&kV=". $objectData['recNo'] ."'>Delete</a></td>";
echo "</tr>";
$i++;
}
print "</table>";
// Print navigation bar
if ($resultsPerPage > 0 && $prev_next_links)
{ echo "Page: ";
array_walk($prev_next_links, 'printArray');
}
?>
</div></div>
<br>
<br>
<?php
$dbObject->CloseConnection();
// Include footer
include "footer.php";
?>