Subversion Repositories computer_asset_manager_v1

Rev

Rev 88 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 rodolico 1
<?php 
38 rodolico 2
   /* Revision History:
3
    * 20161217 RWR
4
    *    Added indicator on mouseover of system if it is a DOMU or a DOM0
5
    *    showing the relationship.
6
    */
1 rodolico 7
   include_once( './maintenance_library.php' );
8
   include_once( '../../header.php' ); 
9
?>
10
<?xml version="1.0" encoding="utf-8"?>
11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
12
<html xmlns="http://www.w3.org/1999/xhtml">
13
<head>
14
  <title>Daily Data - Computer Asset Management Program</title>
15
  <link rel="stylesheet" type="text/css" href="../../camp.css">
91 rodolico 16
  <script src="../../siblinghide.js"></script>
1 rodolico 17
</head>
18
<body>
19
<?php include_once('../../menu.php'); ?>
20
<div id="content">
21
  <?php 
22
     if ( $_POST['postmaintenance'] ) {
23
        postMaintenance();
24
     }
25
     if ($_POST['endDate']) { 
26
         $values = array();
87 rodolico 27
         $values[] = $_SESSION['where_clause'];
1 rodolico 28
         $values[] = 'DATEDIFF(DATE_ADD(maintenance_performed.maintenance_date, INTERVAL schedule DAY), ' . $_POST['endDate'] . ') <= 0';
29
         $_SESSION['do_maintenance_endDate'] = $_POST['endDate'];
30
         if ($_POST['select_client']) {
88 rodolico 31
            $values[] = 'client_id = ' . $_POST['select_client'];
1 rodolico 32
            $_SESSION['do_maintenance_select_client'] = $_POST['select_client'];
33
         }
34
         if ($_POST['select_tech']) {
35
            $values['endDate'] = 'login.login_id = ' . $_POST['select_tech'];
36
            $_SESSION['do_maintenance_select_tech'] = $_POST['select_tech'];
37
         }
38
         $sql = insertValuesIntoQuery(SQL_GET_OUTSTANDING_MAINTENANCE,array( 'additionalWhere' => implode(' and ', $values)));
39
         // print '<pre>' . $sql . '</pre>';
40
         if (! $result = queryDatabaseExtended($sql) ) {
41
            print "No Maintenance Scheduled<br>";
42
         } else {
43
         $result = $result['data'];
44
   ?>
45
      <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
46
      <table border="1">
47
         <?php
48
            $currentSite = '';
49
            $currentDevice = '';
50
            for ( $row = 0; $row < count($result); $row++ ) {
51
               $thisRow = $result[$row];
52
               if ( $thisRow['Site'] != $currentSite) {
53
                  $currentSite = $thisRow['Site'];
54
                  print "<tr><td colspan='20' align='center'>$currentSite</td></tr>\n";
55
               }
56
               if ( $thisRow['Device Name'] != $currentDevice) {
57
                  $currentDevice = $thisRow['Device Name'];
37 rodolico 58
                  if ( $thisRow['Restrictions'] ) {
91 rodolico 59
                     $restrictions = $thisRow['Restrictions'];
60
                     //$currentDevice .= '<span class="restrictions"> - ' . $thisRow['Restrictions'] . '</span>';
61
                  } else {
62
                     $restrictions = '';
37 rodolico 63
                  }
1 rodolico 64
                  $notes = $thisRow['Device Notes'];
38 rodolico 65
                  $title = $notes;
66
                  $xenRelationships = getDOMUDOM0( $thisRow['Device ID'] );
67
                  if ( $xenRelationships ) {
68
                     if ( $xenRelationships['id'] ) { // a DOMU
69
                        $title .= "<br />\n--DOMU on " . $xenRelationships['name'];
70
                     } else { // a DOM0
71
                        $title .= "<br />\n++DOM0 containing following virtuals";
72
                        foreach ( $xenRelationships as $domu ) {
73
                           $title .= "<br />\n&nbsp;&nbsp;&nbsp;&nbsp;" . $domu['name'];
74
                        }
75
                     } // if..else
76
                  } // if $xenRelationships
91 rodolico 77
                  #$title = removeBlankLines(cleanLineReturn( $title ));
38 rodolico 78
 
1 rodolico 79
                  // put the stuff to convert notes to correct format, &#10;&#13; &#10;&#13;
91 rodolico 80
                  print "<tr><td colspan='20'><table width='100%' border='1' class='header-table sibling-hide'><tr><td align='left' width='33%' class='activator'>$currentDevice</td><td width='33%' class='hidden'>$title</td><td width='33%' class='hidden'>$restrictions</td></tr></table></td></tr>\n";
1 rodolico 81
               }
82
               ?>
83
               <tr>
84
                  <td valign='top' width='50' align='right'>
85
                     <INPUT type='checkbox' name='performed_<?php print $thisRow['ID']; ?>'>
86
                  </td>
87
                  <td valign='top'>
88
                     <input type='text' name='datedone_<?php print $thisRow['ID']; ?>' size="9" value="<?php print date('Ymd'); ?>">
89
                  </td>
90
                  <td>
91
                     <textarea name="notes_<?php print $thisRow['ID']; ?>" cols="20" rows="1"></textarea>
92
                  </td>
93
                  <td valign='top' title="<?php print htmlentities($thisRow['Task Notes']); ?>">
94
                     <?php print $thisRow['Task']; ?>
95
                  </td>
96
                  <td valign='top'>
97
                     <?php print $thisRow['Date Due'] . ' (' . $thisRow['Due'] . ' days)'; ?>
98
                  </td>
99
                  <td valign='top'>
100
                     <select name="technician_<?php print $thisRow['ID']; ?>">
85 rodolico 101
                     <?php print queryToSelect(getTechs(), "select " . $_SESSION['login_id'] ); ?>
1 rodolico 102
                     </select>
103
                  </td>
104
               </tr>
105
         <?php
106
            }
107
         ?>   
108
         <tr>
109
            <td colspan="20" align="center">
110
               <input type="submit" name="postmaintenance" value="Post Maintenance" />
111
            </td>
112
         </tr>
113
      </table>
114
      </form>
115
  <?php 
116
        } // if results
117
     } //if we have a valid query ?>
118
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
119
    <table>
120
       <tr>
121
          <td>
122
             Ending Date (yyyymmdd)
123
          </td>
124
          <td>
125
             <input type="text" name="endDate" value="<?php print $_SESSION['do_maintenance_endDate'] ? $_SESSION['do_maintenance_endDate'] : date('Ymd', strtotime('+1 week')); ?>">
126
          </td>
127
       </tr>
128
       <tr>
129
          <td>
130
             Client
131
          </td>
132
          <td>
133
             <select name='select_client' >
134
                <option value='0'>All</option>
85 rodolico 135
                <?php print queryToSelect( getClients(), $_SESSION['do_maintenance_select_client'] ); ?>
1 rodolico 136
             </select>
137
          </td>
138
       </tr>
139
       <tr>
140
          <td>
141
             Technician
142
          </td>
143
          <td>
144
             <select name='select_tech'>
145
                <option value='0'>All</option>
146
                   <?php 
85 rodolico 147
                      print queryToSelect(getTechs(), $_SESSION['do_maintenance_select_tech'] ); 
1 rodolico 148
                   ?>
149
             </select>
150
          </td>
151
       </tr>
152
       <tr>
153
          <td colspan='2' align="center">
154
             <input type="submit" name="showmaintenance" value="Show Maintenance" />
155
          </td>
156
       </tr>
157
    </table>
158
 
159
  </form>
160
</div>
161
 
162
</body>
163
</html>
164