Subversion Repositories computer_asset_manager_v1

Rev

Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed

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