Subversion Repositories computer_asset_manager_v1

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 rodolico 1
<?php
2
   include_once( './maintenance_library.php' );
3
   include_once( '../../header.php' ); 
4
   if ($_POST['id']) {
5
      $id = $_POST['id'];
6
      if ( $_POST['mode'] == 'edited' ) { // we have just edited this record
7
         postChanges($id);
8
         $id = '';
9
      }
10
   }
11
   if ( $_POST['mode'] == 'added' ) { // we have added a record
12
      $result = postChanges();
13
      $id = '';
14
   }
15
 
16
?>
17
<?xml version="1.0" encoding="utf-8"?>
18
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
19
<html xmlns="http://www.w3.org/1999/xhtml">
20
<head>
21
  <title>CAMP - Edit Maintenance Schedule</title>
22
  <link rel="stylesheet" type="text/css" href="../../camp.css">
23
</head>
24
<body>
25
<?php include_once('../../menu.php'); ?>
26
<div id="content">
27
  <?php
28
     if ( $id ) { // we are either editing an existing entry, or adding a new one
29
  ?>
30
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
31
     <?php print EditMaintenanceRecord($id); ?>
32
  </form>
33
 
34
  <?php
35
     } else {
36
  ?>
37
  <?php if ( $result ) { print_r($result); } ?>
38
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
39
                                <input type="submit" name="Add New Entry" value="Add New Entry">
40
                                <input type="hidden" name="id" value="-1">
41
  </form>
42
 
43
    <table>
44
       <?php 
45
          $formStringStart = '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" enctype="multipart/form-data">
46
                                <input type="submit" name="Edit" value="Edit">
47
                                <input type="hidden" name="id" value="';
48
 
49
          $formStringEnd = '"></form>';
50
          print queryToTable("
51
                  select concat('$formStringStart', maintenance_schedule_id, '$formStringEnd') 'Edit',
52
                         concat(client.name, ' - ', site.name) 'Client',
53
                         device.name 'Device',
54
                         maintenance_task.description 'Task',
55
                         schedule,
56
                         login.email 'Tech',
57
                         date(maintenance_schedule.added_date) 'Added' 
58
                  from maintenance_schedule join login using (login_id)
59
                       join maintenance_task using (maintenance_task_id)
60
                       join device using (device_id)
61
                       join site using (site_id)
62
                       join client using (client_id)
63
                  where maintenance_schedule.removed_date is null
64
                        and device.removed_date is null
65
                        and site.removed_date is null
66
                        and client.removed_date is null
67
                  order by concat(client.name, ' - ', site.name), device.name,maintenance_task.description
68
                  "); 
69
       ?>
70
       <tr>
71
          <td colspan='2' align="center">
72
             <input type="submit" name="showmaintenance" value="Show Report" />
73
          </td>
74
       </tr>
75
    </table>
76
   <?php } ?>
77
</div>
78
 
79
</body>
80
</html>
81