Exporting File Statistics

Permalink
Is there any way to download the existing file statistics into a spreadsheet format, or any type of file? I could manually type each user who has downloaded the file, but I figured there must be an easier method.

 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi maxxb1242,

"I could manually type each user who has downloaded the file"

Just to clarify, what approach would you be using to do this?

I ask because there is a DownloadStatistics table that looks to be available using the getDownloadStatistics() method.
https://github.com/concrete5/concrete5/blob/8.1.0/concrete/src/Entit...

You could create a dashboard single page that gets all files that have been downloaded at least once using the getTotalDownloads() method. You could then loop through each of those files to get the download statistics like user ID, file ID, and the timestamp. The user ID can be used to get the user name. The file ID can be used to get the file name. The timestamp would need to be formatted. This information could be added to an array and eventually exported as a CSV file.
https://github.com/concrete5/concrete5/blob/8.1.0/concrete/src/Entit...
maxxb1242 replied on at Permalink Reply
To answer your question, I would just be entering the data into a .cvs or .xls spreadsheet.

How would I go about implementing the php code? Would that just be done by creating a dashboard page?

I'm not as experienced with php, but I'm aware of the fundamentals.

Thank you again.
MrKDilkington replied on at Permalink Reply
MrKDilkington
@maxxb1242

There is documentation for single pages you can review:
https://documentation.concrete5.org/developers/working-with-pages/si...

I am afraid what I described might be challenging without knowledge of developing with concrete5 and PHP.
Gondwana replied on at Permalink Reply
Gondwana
If you won't need to do this often, you might be able to find which database table the info is in, and query it to get the data (eg, using phpmyadmin). You could then paste that into a spreadsheet. Some reformatting may be required en route.