Subversion Repositories computer_asset_manager_v2

Rev

Rev 1 | Blame | Last modification | View Log | RSS feed

<?php 
   include_once( 'header.php' );
   
   //include_once( 'DBTemplate.class.php' );
?>
<?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>Daily Data - Computer Asset Management Program</title>
   <script language="javascript"> 
   function eToggle(anctag,darg) 
   {
     var ele = document.getElementById(darg);
     var text = document.getElementById(anctag);
     if(ele.style.display == "block") 
     {
       ele.style.display = "none";
       text.innerHTML = "Show " + darg;
     }
     else 
     {
      ele.style.display = "block";
      text.innerHTML = "Hide " + darg;
     }
   } 
   </script>
  <link rel="stylesheet" type="text/css" href="camp.css">
</head>
<body>
<?php 
   include_once('menu.php'); 
?>
<div id="content">
   
<?php
   print '<pre>' . print_r( $_SESSION, true ) . print '</pre>';
   
   
   /*global $DATABASE_DEFINITION;
   $camp = new DBDatabase( 'camp', $DATABASE_DEFINITION );
   $whereClause = array('removed is null');
   $owners = $camp->getTable('owners');
   $owners->toArray( array( 'where' => array('removed is null') ) );
   
   DBTemplate::$templatePath = '/home/rodolico/www/web/camp/templates/';
   DBTemplate::$autoSave = true;
   $template = new DBTemplate( $owners, 'list' );
   //print "<pre>" . print_r( $template, true ) . "</pre>";
   
   try {
      $template->loadTemplate( 'list' );
   } catch ( EXCEPTION $e ) {
      print "<h3>" . $e->getMessage() . "</h3>";
   }
   print $template->process();
   print "<pre>" . print_r( $template, true ) . "</pre>";

/*
    
    $list = $owners->toHTML( 'list', 
            array(
                'where' => $whereClause,
                'order' => array('name'),
                'link' => array('pre' => 'id=', 'value' => 'id', 'post' => '&action=view' )
             ) 
           );
    print $list;
*/
/*    unset( $_SESSION['debug'] );
    include( 'Template.class.php' );
    $template = new SmartyTemplate;
    global $DATABASE_DEFINITION;
    $camp = new DBDatabase( 'camp', $DATABASE_DEFINITION );
    $ownersDisplay='all'; // assume we will display the owners list
    $whereClause = array('removed is null');
    $template->assign( 'owners', 
         $camp->getTable('owners')->toArray( 
           array(
              'where' => $whereClause,
              'order' => array('name'),
           ) 
         ) 
    );
    
    if ( isset( $_REQUEST['owner_id'] ) ) { // we have one owner selected
       $ownersDisplay = 'none'; // by default, close up the full owners list if we have one selected
       $whereClause[] = 'owners.id = ' .  $_REQUEST['owner_id'];
       $template->assign( 'owner', 
            $camp->getTable('owners')->toArray( 
              array(
                 'where' => $whereClause,
                 'order' => array('name'),
              ) 
            ) 
       );
       $equipmentDisplay = 'all';
       // grab all of the equipment owned by owner
       $whereClause = array('devices.removed is null',
                            'devices.owner_id=' . $_REQUEST['owner_id'],
                            'devices.device_type_id in (select id from device_types where system = 1)'
                           );
       $template->assign( 'equipment', 
            $camp->getTable('devices')->toArray( 
              array(
                 'where' => $whereClause,
                 'order' => array('name'),
              ) 
            ) 
       );
       if ( isset( $_REQUEST['device_id'] ) ) {
          $equipmentDisplay = 'none';
          $template->assign('device', 
              $camp->getTable('devices')->toArray( 
                array(
                   'where' => array( 'devices.id = ' . $_REQUEST['device_id'] ),
                ) 
              ) 
         );
         // get the subinformation on this device
         $template->assign( 'device_makeup',
            $camp->getTable('devices')->toArray(
               array(
                  'where' => array( 
                        'devices.parent_id=' . $_REQUEST['device_id'],
                        'devices.removed is null'
                        ),
                  'order' => array('device_types.name')
               )
            )
         );
         // get the attributes of the device also
         $template->assign( 'attributes',
            $camp->getTable('attributes_devices')->toArray(
               array(
                  'where' => array( 
                        'attributes_devices.device_id=' . $_REQUEST['device_id'],
                        'attributes_devices.removed is null'
                        ),
                  'order' => array( 'attributes.name' )
                  //'order by' => array('devices.name')
               )
            )
         );
      } // if device_id
      $template->assign( 'ownersDisplay', $ownersDisplay );
      $template->assign( 'equipmentDisplay', $equipmentDisplay );
   } // if there is a client id requested
   //$template->assign( 'debug', $_SESSION['debug']);
   //$template->debugging = true;
   //$template->display_errors = true;
   $template->display('owners_list.tpl');

*/
    
?>
</div>
</body>
</html>