Subversion Repositories computer_asset_manager_v1

Rev

Blame | Last modification | View Log | Download | RSS feed

<?php 
   include_once( './sysinfo.php' );
   include_once( '../../header.php' ); 
   if (UnknownEntries() == 0) { // we are through with the processing
      redirectPage('index.html');
   } elseif ($_POST['action'] == 'client') { // They want to process some clients
      $results = processUnknownClients();
   } elseif ($_POST['action'] == 'device') { // processing some devices
      $results = processUnknownDevices();
   }
?>
<?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 - SysInfo</title>
    <link rel="stylesheet" type="text/css" href="../../camp.css">
  </head>
  <body>
    <?php include_once('../../menu.php'); ?>
    <div id="content">
      <h1>
         Process Unknown Entries
      </h1>
      <FORM action="<?php print $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data">
         <table border="1" align="center">
            <?php
               $query = 'select min(unknown_entry_id) entry,client_name from unknown_entry where client_name not in (select name from client union select alias from client_alias) and processed_date is null group by client_name';
               $data = queryDatabaseExtended( $query );
               if ( $data['count'] ) {
            ?>
            <input type='hidden' name='action' value='client' />
            <caption>Process Unknown Clients</caption>
            <thead>
               <tr>
                  <th>New</th>
                  <th>Alias For</th>
                  <th>Entry</th>
               </tr>
            </thead>
            <tbody>
               <?php
                  foreach ($data['data'] as $thisRow => $values) {
               ?>
               <tr>
                  <td>
                     <input type="checkbox" name="new_<?php print $values['entry']; ?>" />
                  </td>
                  <td>
                     <select name="alias_for_<?php print $values['entry']; ?>">
                        <option selected="selected" value='0'>Not an Alias</option>
                        <?php print queryToSelect('select client_id,name from client order by name'); ?>
                     </select>
                  </td>
                  <td>
                     <?php print $values['client_name']; ?>
                  </td>
               </tr>
               <?php 
                     } // foreach
                  } else { // no clients, so let's look for new devices
                     $query = 'select min(unknown_entry_id) entry, min(report_date) reported, client_name, device_name 
                               from unknown_entry 
                               where processed_date is null 
                               group by client_name,device_name 
                               order by client_name,device_name, reported';
                     $data = queryDatabaseExtended( $query );
                     if ( $data['count'] ) { 
            ?>
            <input type='hidden' name='action' value='device' />
            <caption>Process Unknown Devices</caption>
            <thead>
               <tr>
                  <th>New</th>
                  <th>Alias For</th>
                  <th>Client Name</th>
                  <th>Initial Report Date</th>
                  <th>Entry</th>
               </tr>
            </thead>
            <tbody>
               <?php
                  foreach ($data['data'] as $thisRow => $values) {
               ?>
               <tr>
                  <td>
                     <input type="checkbox" name="new_<?php print $values['entry']; ?>" />
                  </td>
                  <td>
                     <select name="alias_for_<?php print $values['entry']; ?>">
                        <option selected="selected" value='0'>Not an Alias</option>
                        <?php print queryToSelect("select device_id,device.name from device join device_type using (device_type_id) where device_type.show_as_system = 'Y' order by name"); ?>
                     </select>
                  </td>
                  <td>
                     <?php print $values['client_name']; ?>
                  </td>
                  <td>
                     <?php print $values['reported']; ?>
                  </td>
                  <td>
                     <?php print $values['device_name']; ?>
                  </td>
               </tr>
               <?php 
                      } // foreach
                   } // if data['count']
                } // if..else 
               ?>
               <tr>
                  <td colspan="5" align="center">
                     <input name='Submit' type="submit" />
                  </td>
               </tr>
           </tbody>
        </table>
      </form>
    </div>
  </body>
</html>