<?php
/*
* Created on Jul 23, 2009
*
* Author:: Muhammed Nilufer Nilar
*
*/
require_once('../classes/Plan.php');
if( isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == false ) {
//echo "dfsd";exit;
//echo "<pre>";print_r($_GET);print_r($_POST);print_r($_SESSION);exit;
header("Location: ./login.php");
exit();
}
//if(!$_SESSION['loggedin']) {
////echo "<pre>";print_r($_GET);print_r($_POST);print_r($_SESSION);exit;
// header("Location: ./login.php");
//// exit();
//}
//if(!isset($_GET['code'])){
// //$obj = new SupportRequest();
// //echo "text";
// flushPlanTemplate();
//}
function flushPlanTemplate($obj=null, $msg=null){
?>
<html>
<head>
<title>Plan Form</title>
<link rel="stylesheet" type="text/css" href="../templates/css/css.css">
<!-- Author: Bazillyo - hide@address.com - http://www.geocities.com/bazillyo/spiffy/calendar/ -->
<!-- Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/ -->
</head>
<body>
<div id="spiffycalendar" class="text"></div>
<h2>Plan Form</h2>
<?php if($msg != null){
echo $msg;
}
?>
<form name='planForm' id='planForm' onsubmit='validate' method='POST' action='../controllers/PlanController.php?code=add'>
<input type='hidden' name='id' id='id' <?php if($obj != null) echo "value=" . $obj->id; ?> />
<table>
<tr class="odd">
<td><label><?php echo "Plan Name";?></label></td>
<td><input type='text' name='txtname' size="40" id='txtname' <?php if($obj != null) echo 'value="' . $obj->name . '"'; ?>/></td>
</tr>
<tr class="even">
<td><label><?php echo "Description";?></label></td>
<td><textarea name='txtdescription' id='txtdescription' cols="35" rows="3"><?php if($obj != null) echo $obj->description; ?></textarea></td>
</tr>
<tr class="odd">
<td><input type='submit' name='submit' id='submit' value='Save'/></td>
<td><?php if($obj != null) echo "Last modified on $obj->lastUpdatedOn by $obj->lastUpdatedBy"; ?></td>
</tr>
</table>
</form>
</body>
</html>
<?php
}
function flushListTemplate($plansArr, $numOfpages, $pgNo){
?>
<html>
<head>
<title>Plans List</title>
<link rel="stylesheet" type="text/css" href="../templates/css/css.css">
</head>
<body>
<?php
$i = 1;
echo "Go to page ";
while($numOfpages != 0){
if( $i != $pgNo){
echo "<a href='../controllers/PlanController.php?code=all&pgno=$i'>$i</a>   ";
}
else{
echo "$i   ";
}
$numOfpages--;
$i++;
}
?>
<h2>Plans complete list</h2>
<!-- todo tableborder to be shown -->
<div class='tableDiv'>
<table id='RequestList' >
<tr>
<th>ID</th>
<th>Plan Name</th>
<th>Last Updated On</th>
<th>Last Updated By</th>
<th>Delete</th>
</tr>
<?php
$rowCount = 1;
foreach($plansArr as $plan){
?>
<tr class='<?php echo ($rowCount%2==0)?"even":"odd" ; $rowCount++; ?>'>
<td><?php echo $plan->id; ?></td>
<td><a href="../controllers/PlanController.php?code=single&id=<?php echo $plan->id; ?>"><?php echo $plan->name; ?></a></td>
<td><?php echo $plan->lastUpdatedOn; ?></td>
<td><?php echo $plan->lastUpdatedBy; ?></td>
<td class="redhighlight"><a href="../controllers/PlanController.php?code=delete&id=<?php echo $plan->id; ?>"><img src="../templates/images/delete4.png" width="35px" height="20px" alt="Delete"/></a></td>
</tr>
<?php
}
?>
</table>
</div>
</body>
</html>
<?php
}
?>