Rev 1 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
<?php
include_once( '../../header.php' );
include_once( './maintenance_library.php' );
include_once( './database/php' );
if ($_POST['id']) {
$id = $_POST['id'];
if ( $_POST['mode'] == 'edited' ) { // we have just edited this record
postChanges($id);
$id = '';
}
}
if ( $_POST['mode'] == 'added' ) { // we have added a record
$result = postChanges();
$id = '';
}
?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CAMP - Edit Maintenance Schedule</title>
<link rel="stylesheet" type="text/css" href="../../camp.css">
</head>
<body>
<?php include_once('../../menu.php'); ?>
<div id="content">
<?php
if ( $id ) { // we are either editing an existing entry, or adding a new one
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<?php print EditMaintenanceRecord($id); ?>
</form>
<?php
} else {
?>
<?php if ( $result ) { print_r($result); } ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<input type="submit" name="Add New Entry" value="Add New Entry">
<input type="hidden" name="id" value="-1">
</form>
<table>
<?php
$formStringStart = '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" enctype="multipart/form-data">
<input type="submit" name="Edit" value="Edit">
<input type="hidden" name="id" value="';
$formStringEnd = '"></form>';
print queryToTable("
select concat('$formStringStart', maintenance_schedule_id, '$formStringEnd') 'Edit',
concat(client.name, ' - ', site.name) 'Client',
device.name 'Device',
maintenance_task.description 'Task',
schedule,
login.email 'Tech',
date(maintenance_schedule.added_date) 'Added'
from maintenance_schedule join login using (login_id)
join maintenance_task using (maintenance_task_id)
join device using (device_id)
join site using (site_id)
join client using (client_id)
where maintenance_schedule.removed_date is null
and device.removed_date is null
and site.removed_date is null
and client.removed_date is null
order by concat(client.name, ' - ', site.name), device.name,maintenance_task.description
");
?>
<tr>
<td colspan='2' align="center">
<input type="submit" name="showmaintenance" value="Show Report" />
</td>
</tr>
</table>
<?php } ?>
</div>
</body>
</html>