views inegration
palik - May 15, 2007 - 05:52
| Project: | download_count |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Hello
i need to show table made by views, and 'download count' column that would show how many times files from node were downloaded...
i started reading views docs how to do this, but my ideas ended up with thiss little function, that shows count for only first file in node:
function download_count_views_tables() {
$tables['files'] = array (
"name" => "files",
"join" => array(
"left" => array(
"table" => "node",
"field" => "nid"
),
"right" => array(
"field" => "nid"
),
),
);
$tables['file_downloads'] = array (
"name" => "file_downloads",
'fields' => array(
'count' => array(
'name' => t('Files: Download Count'),
'sortable' => true,
'help' => t('Times file were downloaded from that node'),
),
),
"join" => array(
"left" => array(
"table" => "files",
"field" => "filename"
),
"right" => array(
"field" => "filename"
),
),
);
return $tables;
}Any hints how to make this count all files?

#1
Patch at http://drupal.org/node/235844 might be a start for this.