Rev 58 | Rev 61 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
<?php
function filesView( $parameters ) {
if ( isset( $parameters['device_id'] ) ) {
$where = "owner_type = 'd' and owner_id = $parameters[device_id]";
$join = 'join device on (device.device_id = file.owner_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=', 'file.file_id', 'file.name' );
//concat( '<a href=\"', file.file_id, '\"', 'target=\"_blank\">', file.name, '</a>')
$query = "select
file.file_id 'ID',\n
$nameField 'Name',
file.description 'Description',
file_mime_type.mime_type 'MIME',
file.added_date 'Added'
from file
left outer join file_mime_type using (file_mime_type_id)
$join
where
$where
order by file.name, file.added_date";
file_put_contents( '/home/rodolico/www/web/computer_asset_manager_v1/modules/file/queryout.sql', $query );
//print '<pre>' . print_r($query) . '</pre>';
return queryToTable( $query );
// put it into some kind of table. NOTE: description should be on mouseover
return null;
}
function queryHTMLLink ( $url, $hrefLink, $hrefDisplay ) {
return "concat( '<a href=\"', '$url', $hrefLink, '\"', 'target=\"_blank\">', $hrefDisplay, '</a>')";
}
?>