Subversion Repositories computer_asset_manager_v1

Rev

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

<?php

   function attributeView( $parameters ) {
      //if ( isset( $parameters['device_id'] ) ) {
         $where = "attrib_device.device_id = $parameters[device_id]";
         $join = 'join device on (device.device_id = attrib_device.device_id)';
      /*
      } elseif ( isset( $parameters['site_id'] ) ) {
         $where = "owner_type = 's' and owner_id = $parameters[site_id]";
         $join = 'join site on (site.site_id = file.owner_id)';
      } elseif ( isset( $parameters['client_id'] ) ) {
         $where = "owner_type = 'c' and owner_id = $parameters[client_id]";
         $join = 'join client on (client.client_id = file.owner_id)';
      } else {
         return null;
      }
      */
      //$nameField = queryHTMLLink( 'modules/file/display.php?file_id=', 'attri', 'file.name', true );
      //$deleteField = queryHTMLLink( 'modules/file/delete.php?file_id=', 'file.file_id', "'Delete'" );
      //$editField = queryHTMLLink( 'modules/file/upload_file.html?file_id=', 'file.file_id', "'Edit'" );
      //concat( '<a href=\"', file.file_id, '\"', 'target=\"_blank\">', file.name, '</a>')      
      $query = "select 
                   attrib.name 'Name', 
                   attrib_device.value 'Description'
                from attrib_device
                     left outer join attrib using (attrib_id)
                     $join
                where
                   $where
                   and attrib_device.removed_date is null
                order by attrib.name, attrib_device.added_date";
      //print "<pre>$query</pre>";
      return queryToTable( $query );
   }
   
   function queryAttribHTMLLink ( $url, $hrefLink, $hrefDisplay, $newPage = false ) {
      return "concat( '<a href=\"', '$url', $hrefLink, '\"'," . ( $newPage ? " 'target=\"_blank\"', " : '' ) . "'>', $hrefDisplay, '</a>')";
   }

?>