Subversion Repositories computer_asset_manager_v1

Rev

Rev 61 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61 Rev 63
Line 11... Line 11...
11
         $where = "owner_type = 'c' and owner_id = $parameters[client_id]";
11
         $where = "owner_type = 'c' and owner_id = $parameters[client_id]";
12
         $join = 'join client on (client.client_id = file.owner_id)';
12
         $join = 'join client on (client.client_id = file.owner_id)';
13
      } else {
13
      } else {
14
         return null;
14
         return null;
15
      }
15
      }
16
      $nameField = queryHTMLLink( 'modules/file/display.php?file_id=', 'file.file_id', 'file.name' );
16
      $nameField = queryHTMLLink( 'modules/file/display.php?file_id=', 'file.file_id', 'file.name', true );
-
 
17
      $deleteField = queryHTMLLink( 'modules/file/delete.php?file_id=', 'file.file_id', "'Delete'" );
-
 
18
      $editField = queryHTMLLink( 'modules/file/upload_file.html?file_id=', 'file.file_id', "'Edit'" );
17
      //concat( '<a href=\"', file.file_id, '\"', 'target=\"_blank\">', file.name, '</a>')      
19
      //concat( '<a href=\"', file.file_id, '\"', 'target=\"_blank\">', file.name, '</a>')      
18
      $query = "select 
20
      $query = "select 
19
                   file.file_id 'ID',\n
21
                   file.file_id 'ID',\n
20
                   $nameField 'Name', 
22
                   $nameField 'Name', 
21
                   file.description 'Description', 
23
                   file.description 'Description', 
22
                   file_mime_type.mime_type 'MIME', 
24
                   file_mime_type.mime_type 'MIME', 
23
                   file.added_date 'Added'
25
                   file.added_date 'Added',
-
 
26
                   concat( $deleteField, ' ', $editField ) 'Action'
24
                from file 
27
                from file 
25
                     left outer join file_mime_type using (file_mime_type_id)
28
                     left outer join file_mime_type using (file_mime_type_id)
26
                     $join
29
                     $join
27
                where
30
                where
28
                   $where
31
                   $where
-
 
32
                   and file.removed_date is null
29
                order by file.name, file.added_date";
33
                order by file.name, file.added_date";
30
      //file_put_contents( '/home/rodolico/www/web/computer_asset_manager_v1/modules/file/queryout.sql', $query );
34
      //file_put_contents( '/home/rodolico/www/web/computer_asset_manager_v1/modules/file/queryout.sql', $query );
31
      //print '<pre>' . print_r($query) . '</pre>';
35
      //print '<pre>' . print_r($query) . '</pre>';
-
 
36
      //file_put_contents( '/home/rodolico/www/web/computer_asset_manager_v1/modules/file/table.html', queryToTable( $query ) );
32
      return queryToTable( $query );
37
      return queryToTable( $query );
33
      // put it into some kind of table. NOTE: description should be on mouseover
-
 
34
      return null;
-
 
35
   }
38
   }
36
   
39
   
37
   function queryHTMLLink ( $url, $hrefLink, $hrefDisplay ) {
40
   function queryHTMLLink ( $url, $hrefLink, $hrefDisplay, $newPage = false ) {
38
      return "concat( '<a href=\"', '$url', $hrefLink, '\"', 'target=\"_blank\">', $hrefDisplay, '</a>')";
41
      return "concat( '<a href=\"', '$url', $hrefLink, '\"'," . ( $newPage ? " 'target=\"_blank\"', " : '' ) . "'>', $hrefDisplay, '</a>')";
39
   }
42
   }
40
 
43
 
41
?>
44
?>