Subversion Repositories computer_asset_manager_v1

Rev

Rev 86 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

<?php 
   include_once( '../../header.php' );
   include_once( './functions.php' );
   include_once( '../../includes/functions.php' );
   define ( DEBUG, false );
?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <title>Computer Asset Management Program - MODULE NAME - PAGE NAME</title>
      <link rel="stylesheet" type="text/css" href="../../camp.css">
   </head>
   <body>
      <?php include_once('../../menu.php'); ?>
      <div id="content">
         <?php if ( DEBUG ) { print "<pre>"; print_r( $_REQUEST ); print "</pre>\n"; } ?>
      <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
         <table border='1'>
            <tr>
               <td>Client</td>
               <td>
                  <select name='client_id'>
                     <option value=-1 selected>All</option>
                  <?php print queryToSelect( getClients() ); ?>
                  </select>
               </td>
            </tr>
            <tr>
               <td>Machine</td>
               <td>
                  <select name='device_id'>
                     <option value=-1 selected>All</option>
                     <option value='null'>Available</option>
                  <?php print queryToSelect( getAllDevices() ); ?>
                  </select>
               </td>
            </tr>
            <tr>
               <td>Product</td>
               <td>
                  <select name='license_product_id'>
                     <option value=-1 selected>All</option>
                  <?php print queryToSelect( 'select license_product_id,name from license_product order by name'); ?>
                  </select>
               </td>
            </tr>
            <tr>
               <td>*Product</td>
               <td><input type='text' name='product' width='20'></td>
            </tr>
            <tr>
               <td>*License</td>
               <td><input type='text' name='license' width='20'> 
               (<input type="checkbox" name="history" value="history"> show history)
               </td>
            </tr>
            <tr>
               <td colspan='2' align='center'><input type="submit" value="Show Results" name="submit"></td>
            </tr>
         </table>
         <p>* These items will search for substrings</p>
         <p align='center'><a href='edit.html?license_id=-1'>Add new License</a></p>
         <hr>
         </form>
         <?php 
            if ( isset( $_POST["submit"] ) && $_POST["submit"] == 'Show Results' ) {
               $filter = array();
               if ( ! isset( $_REQUEST['history'] ) ) $filter[] = 'license.removed_date is null';
               foreach ( array( 'client_id','device_id','license_product_id' ) as $field ) {
                  if ( $_REQUEST[$field] > -1 ) 
                     $filter[] = ( $_REQUEST[$field] == 'null' ? "$field is " : "$field = " ) . $_REQUEST[$field];
               } // foreach
               if ( $_REQUEST['product'] )
                  $filter[] = "license_product.name like '%" . $_REQUEST['product'] . "%'";
               if ( $_REQUEST['license'] )
                  $filter[] = "license.license like '%" . $_REQUEST['license'] . "%'";
               $filter[] = $_SESSION['where_clause'];
               $query = insertValuesIntoQuery( SQL_SHOW_LICENSE,
                            array('whereClause' => implode( ' and ', $filter )
                                                                  ));
               if ( DEBUG ) print "<pre>$query</pre>";
               print queryToTable( $query );
            } elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'move' ) {
         ?>
         <p>Moving license from current workstation to new machine. Select target machine below</p>
         <pre><?php print getDescription( $_REQUEST['license_id'] ); ?></pre>
         <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
            <input type='hidden' name='license_id' value='<?php print $_REQUEST['license_id'] ?>' />
            <table>
            <tr>
               <td>Select new Machine</td>
               <td>
                  <select name='new_device'>
                     <option value=-1 selected>Remove Only</option>
                  <?php print queryToSelect( getAllDevices() ); ?>
                  </select>
               </td>
            </tr>
            <tr>
               <td colspan='2' align='center'><input type="submit" value="Move License" name="submit"></td>
            </tr>
            </table>
         </form>
         <?php
         } elseif ( isset( $_REQUEST['submit'] ) && $_REQUEST['submit'] == 'Move License' ) {
            moveLicense( $_REQUEST['license_id'], $_REQUEST['new_device'] );
         }
         ?>
      </div>
   </body>
</html>