| 1 | rodolico | 1 | <?php 
 | 
        
           | 20 | rodolico | 2 |    include_once( 'header.php' );
 | 
        
           |  |  | 3 |   | 
        
           |  |  | 4 |    //include_once( 'DBTemplate.class.php' );
 | 
        
           | 1 | rodolico | 5 | ?>
 | 
        
           |  |  | 6 | <?xml version="1.0" encoding="utf-8"?>
 | 
        
           |  |  | 7 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 | 
        
           |  |  | 8 | <html xmlns="http://www.w3.org/1999/xhtml">
 | 
        
           |  |  | 9 | <head>
 | 
        
           |  |  | 10 |   <title>Daily Data - Computer Asset Management Program</title>
 | 
        
           |  |  | 11 |    <script language="javascript"> 
 | 
        
           |  |  | 12 |    function eToggle(anctag,darg) 
 | 
        
           |  |  | 13 |    {
 | 
        
           |  |  | 14 |      var ele = document.getElementById(darg);
 | 
        
           |  |  | 15 |      var text = document.getElementById(anctag);
 | 
        
           |  |  | 16 |      if(ele.style.display == "block") 
 | 
        
           |  |  | 17 |      {
 | 
        
           |  |  | 18 |        ele.style.display = "none";
 | 
        
           |  |  | 19 |        text.innerHTML = "Show " + darg;
 | 
        
           |  |  | 20 |      }
 | 
        
           |  |  | 21 |      else 
 | 
        
           |  |  | 22 |      {
 | 
        
           |  |  | 23 |       ele.style.display = "block";
 | 
        
           |  |  | 24 |       text.innerHTML = "Hide " + darg;
 | 
        
           |  |  | 25 |      }
 | 
        
           |  |  | 26 |    } 
 | 
        
           |  |  | 27 |    </script>
 | 
        
           |  |  | 28 |   <link rel="stylesheet" type="text/css" href="camp.css">
 | 
        
           |  |  | 29 | </head>
 | 
        
           |  |  | 30 | <body>
 | 
        
           |  |  | 31 | <?php 
 | 
        
           |  |  | 32 |    include_once('menu.php'); 
 | 
        
           |  |  | 33 | ?>
 | 
        
           |  |  | 34 | <div id="content">
 | 
        
           | 20 | rodolico | 35 |   | 
        
           | 1 | rodolico | 36 | <?php
 | 
        
           | 20 | rodolico | 37 |    print '<pre>' . print_r( $_SESSION, true ) . print '</pre>';
 | 
        
           |  |  | 38 |   | 
        
           |  |  | 39 |   | 
        
           |  |  | 40 |    /*global $DATABASE_DEFINITION;
 | 
        
           | 1 | rodolico | 41 |    $camp = new DBDatabase( 'camp', $DATABASE_DEFINITION );
 | 
        
           |  |  | 42 |    $whereClause = array('removed is null');
 | 
        
           |  |  | 43 |    $owners = $camp->getTable('owners');
 | 
        
           |  |  | 44 |    $owners->toArray( array( 'where' => array('removed is null') ) );
 | 
        
           |  |  | 45 |   | 
        
           |  |  | 46 |    DBTemplate::$templatePath = '/home/rodolico/www/web/camp/templates/';
 | 
        
           |  |  | 47 |    DBTemplate::$autoSave = true;
 | 
        
           |  |  | 48 |    $template = new DBTemplate( $owners, 'list' );
 | 
        
           |  |  | 49 |    //print "<pre>" . print_r( $template, true ) . "</pre>";
 | 
        
           |  |  | 50 |   | 
        
           |  |  | 51 |    try {
 | 
        
           |  |  | 52 |       $template->loadTemplate( 'list' );
 | 
        
           |  |  | 53 |    } catch ( EXCEPTION $e ) {
 | 
        
           |  |  | 54 |       print "<h3>" . $e->getMessage() . "</h3>";
 | 
        
           |  |  | 55 |    }
 | 
        
           |  |  | 56 |    print $template->process();
 | 
        
           |  |  | 57 |    print "<pre>" . print_r( $template, true ) . "</pre>";
 | 
        
           |  |  | 58 |   | 
        
           |  |  | 59 | /*
 | 
        
           |  |  | 60 |   | 
        
           |  |  | 61 |     $list = $owners->toHTML( 'list', 
 | 
        
           |  |  | 62 |             array(
 | 
        
           |  |  | 63 |                 'where' => $whereClause,
 | 
        
           |  |  | 64 |                 'order' => array('name'),
 | 
        
           |  |  | 65 |                 'link' => array('pre' => 'id=', 'value' => 'id', 'post' => '&action=view' )
 | 
        
           |  |  | 66 |              ) 
 | 
        
           |  |  | 67 |            );
 | 
        
           |  |  | 68 |     print $list;
 | 
        
           |  |  | 69 | */
 | 
        
           |  |  | 70 | /*    unset( $_SESSION['debug'] );
 | 
        
           |  |  | 71 |     include( 'Template.class.php' );
 | 
        
           |  |  | 72 |     $template = new SmartyTemplate;
 | 
        
           |  |  | 73 |     global $DATABASE_DEFINITION;
 | 
        
           |  |  | 74 |     $camp = new DBDatabase( 'camp', $DATABASE_DEFINITION );
 | 
        
           |  |  | 75 |     $ownersDisplay='all'; // assume we will display the owners list
 | 
        
           |  |  | 76 |     $whereClause = array('removed is null');
 | 
        
           |  |  | 77 |     $template->assign( 'owners', 
 | 
        
           |  |  | 78 |          $camp->getTable('owners')->toArray( 
 | 
        
           |  |  | 79 |            array(
 | 
        
           |  |  | 80 |               'where' => $whereClause,
 | 
        
           |  |  | 81 |               'order' => array('name'),
 | 
        
           |  |  | 82 |            ) 
 | 
        
           |  |  | 83 |          ) 
 | 
        
           |  |  | 84 |     );
 | 
        
           |  |  | 85 |   | 
        
           |  |  | 86 |     if ( isset( $_REQUEST['owner_id'] ) ) { // we have one owner selected
 | 
        
           |  |  | 87 |        $ownersDisplay = 'none'; // by default, close up the full owners list if we have one selected
 | 
        
           |  |  | 88 |        $whereClause[] = 'owners.id = ' .  $_REQUEST['owner_id'];
 | 
        
           |  |  | 89 |        $template->assign( 'owner', 
 | 
        
           |  |  | 90 |             $camp->getTable('owners')->toArray( 
 | 
        
           |  |  | 91 |               array(
 | 
        
           |  |  | 92 |                  'where' => $whereClause,
 | 
        
           |  |  | 93 |                  'order' => array('name'),
 | 
        
           |  |  | 94 |               ) 
 | 
        
           |  |  | 95 |             ) 
 | 
        
           |  |  | 96 |        );
 | 
        
           |  |  | 97 |        $equipmentDisplay = 'all';
 | 
        
           |  |  | 98 |        // grab all of the equipment owned by owner
 | 
        
           |  |  | 99 |        $whereClause = array('devices.removed is null',
 | 
        
           |  |  | 100 |                             'devices.owner_id=' . $_REQUEST['owner_id'],
 | 
        
           |  |  | 101 |                             'devices.device_type_id in (select id from device_types where system = 1)'
 | 
        
           |  |  | 102 |                            );
 | 
        
           |  |  | 103 |        $template->assign( 'equipment', 
 | 
        
           |  |  | 104 |             $camp->getTable('devices')->toArray( 
 | 
        
           |  |  | 105 |               array(
 | 
        
           |  |  | 106 |                  'where' => $whereClause,
 | 
        
           |  |  | 107 |                  'order' => array('name'),
 | 
        
           |  |  | 108 |               ) 
 | 
        
           |  |  | 109 |             ) 
 | 
        
           |  |  | 110 |        );
 | 
        
           |  |  | 111 |        if ( isset( $_REQUEST['device_id'] ) ) {
 | 
        
           |  |  | 112 |           $equipmentDisplay = 'none';
 | 
        
           |  |  | 113 |           $template->assign('device', 
 | 
        
           |  |  | 114 |               $camp->getTable('devices')->toArray( 
 | 
        
           |  |  | 115 |                 array(
 | 
        
           |  |  | 116 |                    'where' => array( 'devices.id = ' . $_REQUEST['device_id'] ),
 | 
        
           |  |  | 117 |                 ) 
 | 
        
           |  |  | 118 |               ) 
 | 
        
           |  |  | 119 |          );
 | 
        
           |  |  | 120 |          // get the subinformation on this device
 | 
        
           |  |  | 121 |          $template->assign( 'device_makeup',
 | 
        
           |  |  | 122 |             $camp->getTable('devices')->toArray(
 | 
        
           |  |  | 123 |                array(
 | 
        
           |  |  | 124 |                   'where' => array( 
 | 
        
           |  |  | 125 |                         'devices.parent_id=' . $_REQUEST['device_id'],
 | 
        
           |  |  | 126 |                         'devices.removed is null'
 | 
        
           |  |  | 127 |                         ),
 | 
        
           |  |  | 128 |                   'order' => array('device_types.name')
 | 
        
           |  |  | 129 |                )
 | 
        
           |  |  | 130 |             )
 | 
        
           |  |  | 131 |          );
 | 
        
           |  |  | 132 |          // get the attributes of the device also
 | 
        
           |  |  | 133 |          $template->assign( 'attributes',
 | 
        
           |  |  | 134 |             $camp->getTable('attributes_devices')->toArray(
 | 
        
           |  |  | 135 |                array(
 | 
        
           |  |  | 136 |                   'where' => array( 
 | 
        
           |  |  | 137 |                         'attributes_devices.device_id=' . $_REQUEST['device_id'],
 | 
        
           |  |  | 138 |                         'attributes_devices.removed is null'
 | 
        
           |  |  | 139 |                         ),
 | 
        
           |  |  | 140 |                   'order' => array( 'attributes.name' )
 | 
        
           |  |  | 141 |                   //'order by' => array('devices.name')
 | 
        
           |  |  | 142 |                )
 | 
        
           |  |  | 143 |             )
 | 
        
           |  |  | 144 |          );
 | 
        
           |  |  | 145 |       } // if device_id
 | 
        
           |  |  | 146 |       $template->assign( 'ownersDisplay', $ownersDisplay );
 | 
        
           |  |  | 147 |       $template->assign( 'equipmentDisplay', $equipmentDisplay );
 | 
        
           |  |  | 148 |    } // if there is a client id requested
 | 
        
           |  |  | 149 |    //$template->assign( 'debug', $_SESSION['debug']);
 | 
        
           |  |  | 150 |    //$template->debugging = true;
 | 
        
           |  |  | 151 |    //$template->display_errors = true;
 | 
        
           |  |  | 152 |    $template->display('owners_list.tpl');
 | 
        
           |  |  | 153 |   | 
        
           |  |  | 154 | */
 | 
        
           |  |  | 155 |   | 
        
           |  |  | 156 | ?>
 | 
        
           |  |  | 157 | </div>
 | 
        
           |  |  | 158 | </body>
 | 
        
           |  |  | 159 | </html>
 | 
        
           |  |  | 160 |   |