Created
April 10, 2016 07:32
-
-
Save hissy/d176d659ea407bfffa941e52e2103155 to your computer and use it in GitHub Desktop.
#concrete5 retrieve file download statistics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$conn = Database::connection(); | |
$qb = $conn->createQueryBuilder(); | |
$qb->select('*') | |
->from('DownloadStatistics') | |
->orderBy('timestamp', 'ASC'); | |
if ($startdate = $_GET['startdate']) { | |
$qb->andWhere( | |
$qb->expr()->gt('timestamp', ':startdate') | |
)->setParameter('startdate', $startdate); | |
} | |
if ($enddate = $_GET['enddate']) { | |
$qb->andWhere( | |
$qb->expr()->lt('timestamp', ':enddate') | |
)->setParameter('enddate', $enddate); | |
} | |
$results = $qb->execute(); | |
while ($row = $results->fetch()) { | |
$f = File::getByID($row['fID']); | |
$fv = $f->getVersion($row['fvID']); | |
$ui = UserInfo::getByID($row['uID']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment