Subversion Repositories computer_asset_manager_v1

Rev

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

Rev Author Line No. Line
41 rodolico 1
<?php 
46 rodolico 2
   include_once( '../../header.php' );
3
   include_once( './functions.php' );
47 rodolico 4
   define ( DEBUG, false );
41 rodolico 5
?>
6
<?xml version="1.0" encoding="utf-8"?>
7
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
8
<html xmlns="http://www.w3.org/1999/xhtml">
9
   <head>
10
      <title>Computer Asset Management Program - MODULE NAME - PAGE NAME</title>
11
      <link rel="stylesheet" type="text/css" href="../../camp.css">
12
   </head>
13
   <body>
14
      <?php include_once('../../menu.php'); ?>
15
      <div id="content">
47 rodolico 16
         <?php if ( DEBUG ) { print "<pre>"; print_r( $_REQUEST ); print "</pre>\n"; } ?>
46 rodolico 17
      <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
18
         <table border='1'>
19
            <tr>
20
               <td>Client</td>
21
               <td>
22
                  <select name='client_id'>
23
                     <option value=-1 selected>All</option>
24
                  <?php print queryToSelect( 'select client_id,name from client where removed_date is null order by name'); ?>
25
                  </select>
26
               </td>
27
            </tr>
28
            <tr>
29
               <td>Machine</td>
30
               <td>
31
                  <select name='device_id'>
32
                     <option value=-1 selected>All</option>
47 rodolico 33
                     <option value='null'>Available</option>
46 rodolico 34
                  <?php print queryToSelect( "select device.device_id,device.name from device where device_type_id in (select device_type_id from device_type where show_as_system = 'Y') order by device.name"); ?>
35
                  </select>
36
               </td>
37
            </tr>
38
            <tr>
39
               <td>Product</td>
40
               <td>
41
                  <select name='license_product_id'>
42
                     <option value=-1 selected>All</option>
43
                  <?php print queryToSelect( 'select license_product_id,name from license_product order by name'); ?>
44
                  </select>
45
               </td>
46
            </tr>
47
            <tr>
48
               <td>*Product</td>
49
               <td><input type='text' name='product' width='20'></td>
50
            </tr>
51
            <tr>
52
               <td>*License</td>
53
               <td><input type='text' name='license' width='20'> 
54
               (<input type="checkbox" name="history" value="history"> show history)
55
               </td>
56
            </tr>
57
            <tr>
58
               <td colspan='2' align='center'><input type="submit" value="Show Results" name="submit"></td>
59
            </tr>
60
         </table>
61
         <p>* These items will search for substrings</p>
47 rodolico 62
         <p align='center'><a href='edit.html?license_id=-1'>Add new License</a></p>
46 rodolico 63
         <hr>
64
         </form>
65
         <?php 
47 rodolico 66
            if ( isset( $_POST["submit"] ) && $_POST["submit"] == 'Show Results' ) {
46 rodolico 67
               $filter = array();
68
               if ( ! isset( $_REQUEST['history'] ) ) $filter[] = 'license.removed_date is null';
69
               foreach ( array( 'client_id','device_id','license_product_id' ) as $field ) {
70
                  if ( $_REQUEST[$field] > -1 ) 
47 rodolico 71
                     $filter[] = ( $_REQUEST[$field] == 'null' ? "$field is " : "$field = " ) . $_REQUEST[$field];
46 rodolico 72
               } // foreach
73
               if ( $_REQUEST['product'] )
74
                  $filter[] = "license_product.name like '%" . $_REQUEST['product'] . "%'";
75
               if ( $_REQUEST['license'] )
76
                  $filter[] = "license.license like '%" . $_REQUEST['license'] . "%'";
77
 
78
               $query = insertValuesIntoQuery( SQL_SHOW_LICENSE,
79
                            array('whereClause' => implode( ' and ', $filter )
80
                                                                  ));
47 rodolico 81
               if ( DEBUG ) print "<pre>$query</pre>";
46 rodolico 82
               print queryToTable( $query );
47 rodolico 83
            } elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'move' ) {
42 rodolico 84
         ?>
46 rodolico 85
         <p>Moving license from current workstation to new machine. Select target machine below</p>
86
         <pre><?php print getDescription( $_REQUEST['license_id'] ); ?></pre>
87
         <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
47 rodolico 88
            <input type='hidden' name='license_id' value='<?php print $_REQUEST['license_id'] ?>' />
46 rodolico 89
            <table>
90
            <tr>
91
               <td>Select new Machine</td>
92
               <td>
93
                  <select name='new_device'>
94
                     <option value=-1 selected>Remove Only</option>
95
                  <?php print queryToSelect( "select device_id,name from view_device_systems where removed_date is null order by name"); ?>
96
                  </select>
97
               </td>
98
            </tr>
47 rodolico 99
            <tr>
100
               <td colspan='2' align='center'><input type="submit" value="Move License" name="submit"></td>
101
            </tr>
46 rodolico 102
            </table>
103
         </form>
104
         <?php
47 rodolico 105
         } elseif ( isset( $_REQUEST['submit'] ) && $_REQUEST['submit'] == 'Move License' ) {
106
            moveLicense( $_REQUEST['license_id'], $_REQUEST['new_device'] );
46 rodolico 107
         }
108
         ?>
41 rodolico 109
      </div>
110
   </body>
111
</html>