function theme_webfm_attachments in Web File Manager 5
Same name and namespace in other branches
- 5.2 webfm.module \theme_webfm_attachments()
Displays file attachments in table
2 theme calls to theme_webfm_attachments()
- webfm_attach_box in ./
webfm.module - Get and theme node attachments
- webfm_nodeapi in ./
webfm.module - Implementation of hook_nodeapi().
File
- ./
webfm.module, line 803
Code
function theme_webfm_attachments($files) {
global $base_url;
$header = array(
t('Attachment'),
);
if ($enable_date = variable_get('webfm_attach_date', '')) {
array_push($header, t('Date'));
}
if ($enable_size = variable_get('webfm_attach_size', '')) {
array_push($header, t('Size'));
}
$rows = array();
foreach ($files as $file) {
// 0 =inline : 1 = attach
$icon_path = $base_url . '/' . variable_get('webfm_icon_dir', '') . '/' . _webfm_get_icon($file->e);
$description = '';
if (variable_get('webfm_attach_desc', '') && !empty($file->fdesc)) {
$description = '<div class="att-fdesc">' . $file->fdesc . '</div>';
}
$filename = $file->ftitle ? $file->ftitle : $file->n;
if (variable_get('webfm_attach_new_window', '')) {
$href = array(
'data' => l('<img src="' . $icon_path . '" alt="[file]" title="Download ' . $filename . '"/> ', 'webfm_send/' . $file->id . '/1', array(
'title' => 'Download ' . $filename,
'target' => '_blank',
), '', '', '', TRUE) . l($filename, 'webfm_send/' . $file->id, array(
'title' => 'Open ' . $filename,
'target' => '_blank',
)) . $description,
'class' => 'att-title',
);
}
else {
$href = array(
'data' => l('<img src="' . $icon_path . '" alt="[file]" title="Download ' . $filename . '"/> ', 'webfm_send/' . $file->id . '/1', array(
'title' => 'Download ' . $filename,
), '', '', '', TRUE) . l($filename, 'webfm_send/' . $file->id, array(
'title' => 'Open ' . $filename,
)) . $description,
'class' => 'att-title',
);
}
$row = array();
array_push($row, $href);
if ($enable_date) {
$time = $file->fcreatedate ? date(webfm_get_date_format(), $file->fcreatedate) : date(webfm_get_date_format(), @filemtime($file->p . '/' . $file->n));
array_push($row, array(
'data' => $time,
'class' => 'att-time',
));
}
if ($enable_size) {
array_push($row, array(
'data' => format_size($file->s),
'class' => 'att-size',
));
}
array_push($rows, $row);
}
if (count($rows)) {
return theme('table', $header, $rows, array(
'id' => 'webfm-attach-list',
));
}
}