Location: PHPKode > projects > PhpMyInventory > pmi281/showfull.php
<?
  Include("Includes/global.inc.php");
  checkPermissions(2, 1800);

  if ($notify != "") {
      switch ($notify) {
          case "insert":
              $strError = "Record added successfully.";
              break;
            case "update":
              $strError = "Record updated successfully.";
              break;
          default:
              $strError = $notify;
              break;
      }
  }

  writeHeader("Detailed View");
  declareError(TRUE);

  # with this in place we can strip out spare qstrings?
  $strSQLx  = "SELECT sparePart FROM hardware WHERE pk_asset=$hardwareID";
  $resultx  = dbquery($strSQLx);
  $rowx     = mysql_fetch_row($resultx);
  $spare    = $rowx[0];

   if ($hardwareID AND ($spare === "0")) { // Asset has been selected
       $strSQL = "SELECT * FROM hardware as h, hw_types as t, tblSecurity as s WHERE 
         s.id=h.userID AND h.type=t.type_pk AND h.pk_asset=$hardwareID AND t.accountID=$accountID";
   } elseif ($hardwareID AND ($spare > 0)) {
       $strSQL = "SELECT * FROM hardware as h, hw_types as t WHERE 
         h.type=t.type_pk AND h.pk_asset=$hardwareID AND t.accountID=$accountID";
       $result = dbquery($strSQL);
   }

   $result = dbquery($strSQL);

   While ($row = mysql_fetch_array($result)) {
      $type_desc        = $row["type_desc"];
      $serial_num       = $row["serial_num"];
      $spare            = $row["sparePart"];
      $strHwStatus      = $row["hardwareStatus"];
      $strIP            = $row["ipAddress"];
      If ($spare === "0") {
          $intUserID        = $row["id"];
          $strFirstName     = $row["firstName"];
          $strMiddleInit    = $row["middleInit"];
          $strLastName      = $row["lastName"];
      }

    ?>
      <p>
      <table border='0' cellpadding='0' cellspacing='0'><tr><td valign='top'>
      <table border='0' cellpadding='4' cellspacing='0'>
    <?
      If ($spare === "1") {
           $strUserName = "Spare";
           $intUserID = 0;
      } ElseIf ($spare === "2") {
           $strUserName = "Independent";
           $intUserID = 0;
      } Else {
           $strUserName = buildName($strFirstName, $strMiddleInit, $strLastName, 1);
      }
    ?>
   <TR class='<? echo alternateRowColor(); ?>'>
      <TD><b>User:</b></TD>
      <TD><? echo $strUserName; ?></TD></TR>
   <TR class='<? echo alternateRowColor(); ?>'>
      <TD><b>Type:</b></TD>
      <TD><? echo $type_desc; ?></TD></TR>
   <TR class='<? echo alternateRowColor(); ?>'>
      <TD><b>S/N:</b></TD>
      <TD><? echo writeNA($serial_num); ?></TD></TR>
   <TR class='<? echo alternateRowColor(); ?>'>
      <TD><b>Status: &nbsp;</b></TD>
      <TD><? echo writeStatus($strHwStatus); ?></TD></TR>
   <TR class='<? echo alternateRowColor(); ?>'>
      <TD><b>IP: &nbsp;</b></TD>
      <TD><? echo writeNA($strIP); ?></TD></TR>
   </table></td>
   <td width='12'>&nbsp;</td><td valign='top'>
    <?
      If ($sessionSecurity < 2) {
    ?>
      <ul>
        <li style='line-height: 150%'><a href='move_hardware.php?hardware_id=<?=$hardwareID;?>&spare=<?=$spare;?>'>Change User</a>
        <li style='line-height: 150%'><a HREF="admin_hardware.php?id=<?=$hardwareID;?>&spare=<?=$spare;?>">Edit System</A>
        <?
          If ($sessionSecurity < 1) {
        ?>
        <li style='line-height: 150%'><A HREF="delete.php?hardwareID=<?=$hardwareID;?>" onClick="return warn_on_submit('You are about to delete a system from the inventory!\nThis will also delete the software and peripherals associated with this system.');">Delete System</A>
        <?
          }
        ?>
        <!--<li style='line-height: 150%'><a href='showfull.php?hardwareID=<?=$hardwareID?>&addComment=1'>Add comment</a>-->
        <li style='line-height: 150%'>Set status: &nbsp;
             <a href='showfull.php?hardwareID=<?=$hardwareID?>&setStatus=w&spare=<?=$spare;?>'>Working</a> &nbsp; |&nbsp;
             <a href='showfull.php?hardwareID=<?=$hardwareID?>&setStatus=n&spare=<?=$spare;?>'>Needs Service</a> &nbsp; |&nbsp;
             <a href='showfull.php?hardwareID=<?=$hardwareID?>&setStatus=i&spare=<?=$spare;?>'>In Service</a>
      </ul>
    <? 
      } Else {
         echo "&nbsp;";
      }
    ?>
   </td></tr></table>
<?
      buildlist($hardwareID, $intUserID, 1);
   }

   writeFooter();
?>
Return current item: PhpMyInventory