function workspace_list_files in Workspace 6
Menu callback. List file attachments managed by upload.module.
Parameters
$account: User object representing user whose workspace is being listed.
1 string reference to 'workspace_list_files'
- workspace_menu in ./
workspace.module - Implementation of hook_menu().
File
- ./
workspace.module, line 397 - Presents a user-centric view of content.
Code
function workspace_list_files($account) {
global $user;
drupal_set_title(t('Workspace: @name', array(
'@name' => $account->name,
)));
$max = isset($user->workspaces) ? $user->workspaces['default']['maxfilenames'] : 50;
$download = t('download');
$rows = array();
$header = array(
array(
'data' => t('Filename'),
'field' => 'f.filename',
),
array(
'data' => t('Type'),
'field' => 'f.filemime',
),
array(
'data' => t('Modified'),
'field' => 'f.timestamp',
'sort' => 'desc',
),
array(
'data' => t('Size'),
'field' => 'f.filesize',
),
array(
'data' => t('Operations'),
),
);
$cols = 6;
$sql = "SELECT u.nid, f.filemime, f.filename, f.filesize, f.timestamp, f.filepath\n FROM {files} f\n LEFT JOIN {upload} u ON f.fid = u.fid\n WHERE f.uid = %d";
$result = pager_query($sql . tablesort_sql($header), $max, 2, NULL, $account->uid);
while ($row = db_fetch_object($result)) {
$rows[] = array(
l($row->filename, "node/{$row->nid}"),
$row->filemime,
format_date($row->timestamp, 'small'),
format_size($row->filesize),
l($download, file_create_url($row->filepath)),
);
}
return theme('workspace_list', $header, $rows, $max, $cols);
}