/* * This page is to outline all of the views built into reports v2. * It's used as the main page as it also lists the current reports by type * and the current in-progress reports by staff member. * All the different views are self explanatory by their names. */ if (!check_perms('admin_reports')) { error(403); } View::show_header('Reports V2!', 'reportsv2'); //Grab owner's ID, just for examples $DB->query("SELECT ID, Username FROM users_main ORDER BY ID ASC LIMIT 1"); list($OwnerID, $Owner) = $DB->next_record(); $Owner = display_str($Owner); ?>
$DB->query("
SELECT
um.ID,
um.Username,
COUNT(r.ID) AS Reports
FROM reportsv2 AS r
JOIN users_main AS um ON um.ID=r.ResolverID
WHERE r.LastChangeTime > NOW() - INTERVAL 24 HOUR
GROUP BY r.ResolverID
ORDER BY Reports DESC");
$Results = $DB->to_array();
?>
Reports resolved in the last 24 hours
$DB->query(" SELECT um.ID, um.Username, COUNT(r.ID) AS Reports FROM reportsv2 AS r JOIN users_main AS um ON um.ID=r.ResolverID WHERE r.LastChangeTime > NOW() - INTERVAL 1 WEEK GROUP BY r.ResolverID ORDER BY Reports DESC"); $Results = $DB->to_array(); ?> Reports resolved in the last week
$DB->query(" SELECT um.ID, um.Username, COUNT(r.ID) AS Reports FROM reportsv2 AS r JOIN users_main AS um ON um.ID=r.ResolverID WHERE r.LastChangeTime > NOW() - INTERVAL 1 MONTH GROUP BY r.ResolverID ORDER BY Reports DESC"); $Results = $DB->to_array(); ?> Reports resolved in the last month
$DB->query(" SELECT um.Username, COUNT(r.ID) AS Reports FROM reportsv2 AS r JOIN users_main AS um ON um.ID=r.ResolverID GROUP BY r.ResolverID ORDER BY Reports DESC"); $Results = $DB->to_array(); ?> Reports resolved since Reports v2 (2009-07-27)
Different view modes by personBy ID of torrent reported:
By group ID of torrent reported:
By report ID:
By reporter ID:
By uploader ID:
By resolver ID:
For browsing anything more complicated than these, use the search feature. |
$DB->query("
SELECT
r.ResolverID,
um.Username,
COUNT(r.ID) AS Count,
COUNT(tasted.Tasted) AS Tasted
FROM reportsv2 AS r
LEFT JOIN users_main AS um ON r.ResolverID=um.ID
LEFT JOIN torrents AS tasted ON tasted.ID=r.TorrentID AND tasted.Tasted = '1'
WHERE r.Status = 'InProgress'
GROUP BY r.ResolverID");
$Staff = $DB->to_array();
?>
Currently assigned reports by staff member
Different view modes by report type$DB->query(" SELECT r.Type, COUNT(r.ID) AS Count FROM reportsv2 AS r WHERE r.Status='New' GROUP BY r.Type"); $Current = $DB->to_array(); if (!empty($Current)) { ?>
|