<?php require_once('../Connections/Policies.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE Administrative SET Title=%s, Category=%s, Subject=%s, Effective=%s, Reviewed=%s, Purpose=%s WHERE policyid=%s",
GetSQLValueString($_POST['Title'], "text"),
GetSQLValueString($_POST['Category'], "text"),
GetSQLValueString($_POST['Subject'], "text"),
GetSQLValueString($_POST['Effective'], "text"),
GetSQLValueString($_POST['Reviewed'], "text"),
GetSQLValueString($_POST['Purpose'], "text"),
GetSQLValueString($_POST['policyid'], "int"));
mysql_select_db($database_Policies, $Policies);
$Result1 = mysql_query($updateSQL, $Policies) or die(mysql_error());
$updateGoTo = "admin_menu.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$maxRows_Policies = 1;
$pageNum_Policies = 0;
if (isset($_GET['pageNum_Policies'])) {
$pageNum_Policies = $_GET['pageNum_Policies'];
}
$startRow_Policies = $pageNum_Policies * $maxRows_Policies;
mysql_select_db($database_Policies, $Policies);
$query_Policies = "SELECT * FROM Administrative ORDER BY Title ASC";
$query_limit_Policies = sprintf("%s LIMIT %d, %d", $query_Policies, $startRow_Policies, $maxRows_Policies);
$Policies = mysql_query($query_limit_Policies, $Policies) or die(mysql_error());
$row_Policies = mysql_fetch_assoc($Policies);
if (isset($_GET['totalRows_Policies'])) {
$totalRows_Policies = $_GET['totalRows_Policies'];
} else {
$all_Policies = mysql_query($query_Policies);
$totalRows_Policies = mysql_num_rows($all_Policies);
}
$totalPages_Policies = ceil($totalRows_Policies/$maxRows_Policies)-1;
$queryString_Policies = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Policies") == false &&
stristr($param, "totalRows_Policies") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Policies = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Policies = sprintf("&totalRows_Policies=%d%s", $totalRows_Policies, $queryString_Policies);
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
http://www.w3.org/TR/html4/loose.dtd
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Main Menu</title>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
color: #FFFFFF;
}
body {
background-color: #446294;
}
a:link {
color: #FFFFFF;
}
a:hover {
color: #000000;
}
a:visited {
color: #FFFFFF;
}
-->
</style>
<style type="text/css">
<!--
.style1 {
font-size: 16px;
color: #000000;
}
-->
</style>
</head>
<body>
<?php
include("../FCKeditor/fckeditor.php") ;
?>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><div align="center"><img src="../Images/SBMGnew.gif" width="227" height="120"></div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="25" align="left"><img src="../Images/end.gif" width="25" height="25"></td>
<td width="750"><div align="center">Tit<strong><span class="style1">Update Administrative Policy </span></strong>le</div></td>
<td width="25" align="right"><img src="../Images/end2.gif" width="25" height="25"></td>
</tr>
<tr>
<td colspan="3"><hr width="800" size="1" color="black"></td>
</tr>
</table>
<br>
<blockquote>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center">
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td align="right" valign="top" nowrap>Title:</td>
<td align="left" valign="top"><input type="text" name="Title" value="<?php echo $row_Policies['Title']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap>Category:</td>
<td align="left" valign="top"><input type="text" name="Category" value="<?php echo $row_Policies['Category']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap>Subject:</td>
<td align="left" valign="top"><input type="text" name="Subject" value="<?php echo $row_Policies['Subject']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap>Effective:</td>
<td align="left" valign="top"><input type="text" name="Effective" value="<?php echo $row_Policies['Effective']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap>Reviewed:</td>
<td align="left" valign="top"><input type="text" name="Reviewed" value="<?php echo $row_Policies['Reviewed']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap>Purpose:</td>
<td align="left" valign="top"><input type="text" name="Purpose" value="<?php echo $row_Policies['Purpose']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap>Description:</td>
<td align="left" valign="top"><?php
$oFCKeditor = new FCKeditor('Description') ;
$oFCKeditor->BasePath = '/FCKeditor/';
$oFCKeditor->Width = '700' ;
$oFCKeditor->Height = '500' ;
$oFCKeditor->Value = $row_Policies['Description'];
$oFCKeditor->Create() ;
?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td align="left" valign="top"><input type="submit" value="Update Policy"></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="policyid" value="<?php echo $row_Policies['policyid']; ?>">
</form>
<p> </p>
</div></td>
</tr>
<tr>
<td> <div align="center">
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center"><?php if ($pageNum_Policies > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Policies=%d%s", $currentPage, 0, $queryString_Policies); ?>"><img src="First.gif" border=0></a>
<?php } // Show if not first page ?>
</td>
<td width="31%" align="center"><?php if ($pageNum_Policies > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Policies=%d%s", $currentPage, max(0, $pageNum_Policies - 1), $queryString_Policies); ?>"><img src="Previous.gif" border=0></a>
<?php } // Show if not first page ?>
</td>
<td width="23%" align="center"><?php if ($pageNum_Policies < $totalPages_Policies) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Policies=%d%s", $currentPage, min($totalPages_Policies, $pageNum_Policies + 1), $queryString_Policies); ?>"><img src="Next.gif" border=0></a>
<?php } // Show if not last page ?>
</td>
<td width="23%" align="center"><?php if ($pageNum_Policies < $totalPages_Policies) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Policies=%d%s", $currentPage, $totalPages_Policies, $queryString_Policies); ?>"><img src="Last.gif" border=0></a>
<?php } // Show if not last page ?></td>
</tr>
</table>
</div>
<div align="center"></div></td>
</tr>
<tr>
<td><hr width="800" size="1" color="black"></td>
</tr>
<tr>
<td> <div align="center"></div></td>
</tr>
</table>
</blockquote>
</body>
</html>
<?php mysql_free_result($Policies); ?>
