<?php
session_start();
include("header.php");
$stat=1;
$sy=0;

if($_POST['action']!="")
	$action = $_POST['action'];
else if($_GET['action']!="")
	$action = $_GET['action'];


if(trim($_POST['stat']) !="")
   $stat=$_POST['stat'];
else if(trim($_GET['stat']) !="")
   $stat=$_GET['stat'];


if(trim($_POST['id']) !="")
   $sy=$_POST['id'];
elseif(trim($_GET['id']) !="")
   $sy=$_GET['id'];

if(strtoupper(trim($action)) == "UPDATE")
{
	$strSql = mysql_query("update ma_schoolyear set sStatus='".$stat."' where syID='".$sy."'");
}
?>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
	<tr><td></td><td align="center" class="fs14"><u><b>School Year</b></u></td></tr>
	<tr><td width="200" class="fs12" valign="top">
	<?php include("sidemenu.php"); ?>
	</td>
		<td width="680" class="fs12" valign="top">
			<table width="608" cellpadding="1" cellspacing="1" border="0">
				<tr align="center"><td width="70%"></td><td width="15%"></td><td width="15%"></td></tr>
			<?php
			$strSql = mysql_query("SELECT * FROM ma_schoolyear order by syID");
			$rsc = @mysql_num_rows($strSql);
			If ($rsc>0)
			{
				$i=1;
				while($rs=@mysql_fetch_array($strSql))
				{
					$sStatus="In-active";
					$statVal=1;
					if ($rs['sStatus'] == 1)
					{
						$sStatus="Active";
						$statVal=0;
					}
					echo "<tr><td colspan='3'><hr /></td></tr>"; 
					echo "<tr><td>&nbsp;(".$i.")&nbsp;".trim($rs['syName'])."</td>";
					echo "<td align='center'><a href='schoolYearUpdate.php?id=".$rs['syID']."'>Update</a></td><td align='center'><a href='schoolYear.php?action=update&stat=".$statVal."&id=".$rs['syID']."'>".$sStatus."</a></td></tr>";
					$i++;
				}
			}
			echo "<tr><td colspan='3'><hr /></td></tr>";
			echo "<tr><td></td><td colspan='2' align='center'><a href='schoolYearNew.php'>Create New School Year</a></td></tr>";
			?>
			</table></td></tr>
</table>
<?php include("footer.php");?>