Subversion Repositories computer_asset_manager_v1

Rev

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