Gazelle/sections/reportsv2/views.php

314 lines
7.6 KiB
PHP
Raw Permalink Normal View History

2011-03-28 14:21:28 +00:00
<?
/*
2012-12-21 08:00:21 +00:00
* This page is to outline all of the views built into reports v2.
2011-03-28 14:21:28 +00:00
* It's used as the main page as it also lists the current reports by type
2012-12-21 08:00:21 +00:00
* and the current in-progress reports by staff member.
2011-03-28 14:21:28 +00:00
* All the different views are self explanatory by their names.
*/
2013-05-04 08:00:48 +00:00
if (!check_perms('admin_reports')) {
2011-03-28 14:21:28 +00:00
error(403);
}
2012-10-11 08:00:15 +00:00
View::show_header('Reports V2!', 'reportsv2');
2012-08-19 08:00:19 +00:00
2011-03-28 14:21:28 +00:00
2013-03-05 08:00:26 +00:00
//Grab owner's ID, just for examples
2013-05-27 08:00:58 +00:00
$DB->query("
SELECT ID, Username
FROM users_main
ORDER BY ID ASC
LIMIT 1");
2011-03-28 14:21:28 +00:00
list($OwnerID, $Owner) = $DB->next_record();
$Owner = display_str($Owner);
?>
2012-08-19 08:00:19 +00:00
<div class="header">
<h2>Reports v2 Information!</h2>
2013-10-09 08:01:03 +00:00
<? include('header.php'); ?>
2012-08-19 08:00:19 +00:00
</div>
2013-10-10 08:01:46 +00:00
<div class="thin float_clear">
<div class="two_columns pad">
2011-03-28 14:21:28 +00:00
<?
2013-05-04 08:00:48 +00:00
$DB->query("
SELECT
um.ID,
um.Username,
COUNT(r.ID) AS Reports
FROM reportsv2 AS r
2013-10-29 08:01:29 +00:00
JOIN users_main AS um ON um.ID = r.ResolverID
2013-05-04 08:00:48 +00:00
WHERE r.LastChangeTime > NOW() - INTERVAL 24 HOUR
GROUP BY r.ResolverID
ORDER BY Reports DESC");
2011-03-28 14:21:28 +00:00
$Results = $DB->to_array();
?>
2013-10-09 08:01:03 +00:00
<h3>Reports resolved in the last 24 hours</h3>
2013-10-10 08:01:46 +00:00
<table class="box border">
<tr class="colhead">
<td class="colhead_dark">Username</td>
<td class="colhead_dark number_column">Reports</td>
2011-03-28 14:21:28 +00:00
</tr>
2013-10-29 08:01:29 +00:00
<?
foreach ($Results as $Result) {
2011-03-28 14:21:28 +00:00
list($UserID, $Username, $Reports) = $Result;
2013-10-29 08:01:29 +00:00
if ($Username == $LoggedUser['Username']) {
$RowClass = ' class="rowa"';
} else {
$RowClass = '';
}
2011-03-28 14:21:28 +00:00
?>
2013-10-29 08:01:29 +00:00
<tr<?=$RowClass?>>
2011-03-28 14:21:28 +00:00
<td><a href="reportsv2.php?view=resolver&amp;id=<?=$UserID?>"><?=$Username?></a></td>
2013-08-28 23:08:41 +00:00
<td class="number_column"><?=number_format($Reports)?></td>
2011-03-28 14:21:28 +00:00
</tr>
2013-10-29 08:01:29 +00:00
<?
}
?>
2011-03-28 14:21:28 +00:00
</table>
<?
2013-05-04 08:00:48 +00:00
$DB->query("
SELECT
um.ID,
um.Username,
COUNT(r.ID) AS Reports
FROM reportsv2 AS r
2013-10-29 08:01:29 +00:00
JOIN users_main AS um ON um.ID = r.ResolverID
2013-05-04 08:00:48 +00:00
WHERE r.LastChangeTime > NOW() - INTERVAL 1 WEEK
GROUP BY r.ResolverID
ORDER BY Reports DESC");
2011-03-28 14:21:28 +00:00
$Results = $DB->to_array();
?>
2013-10-09 08:01:03 +00:00
<h3>Reports resolved in the last week</h3>
2013-10-10 08:01:46 +00:00
<table class="box border">
<tr class="colhead">
<td class="colhead_dark">Username</td>
<td class="colhead_dark number_column">Reports</td>
2011-03-28 14:21:28 +00:00
</tr>
2013-10-29 08:01:29 +00:00
<?
foreach ($Results as $Result) {
2013-01-06 08:00:28 +00:00
list($UserID, $Username, $Reports) = $Result;
2013-10-29 08:01:29 +00:00
if ($Username == $LoggedUser['Username']) {
$RowClass = ' class="rowa"';
} else {
$RowClass = '';
}
2011-03-28 14:21:28 +00:00
?>
2013-10-29 08:01:29 +00:00
<tr<?=$RowClass?>>
2012-12-27 08:00:27 +00:00
<td><a href="reportsv2.php?view=resolver&amp;id=<?=$UserID?>"><?=$Username?></a></td>
2013-08-28 23:08:41 +00:00
<td class="number_column"><?=number_format($Reports)?></td>
2011-03-28 14:21:28 +00:00
</tr>
2013-10-29 08:01:29 +00:00
<?
}
?>
2011-03-28 14:21:28 +00:00
</table>
<?
2013-05-04 08:00:48 +00:00
$DB->query("
SELECT
um.ID,
um.Username,
COUNT(r.ID) AS Reports
FROM reportsv2 AS r
2013-10-29 08:01:29 +00:00
JOIN users_main AS um ON um.ID = r.ResolverID
2013-05-04 08:00:48 +00:00
WHERE r.LastChangeTime > NOW() - INTERVAL 1 MONTH
GROUP BY r.ResolverID
ORDER BY Reports DESC");
2011-03-28 14:21:28 +00:00
$Results = $DB->to_array();
?>
2013-10-09 08:01:03 +00:00
<h3>Reports resolved in the last month</h3>
2013-10-10 08:01:46 +00:00
<table class="box border">
<tr class="colhead">
<td class="colhead_dark">Username</td>
<td class="colhead_dark number_column">Reports</td>
2011-03-28 14:21:28 +00:00
</tr>
2013-10-29 08:01:29 +00:00
<?
foreach ($Results as $Result) {
2013-01-06 08:00:28 +00:00
list($UserID, $Username, $Reports) = $Result;
2013-10-29 08:01:29 +00:00
if ($Username == $LoggedUser['Username']) {
$RowClass = ' class="rowa"';
} else {
$RowClass = '';
}
2011-03-28 14:21:28 +00:00
?>
2013-10-29 08:01:29 +00:00
<tr<?=$RowClass?>>
2012-12-27 08:00:27 +00:00
<td><a href="reportsv2.php?view=resolver&amp;id=<?=$UserID?>"><?=$Username?></a></td>
2013-08-28 23:08:41 +00:00
<td class="number_column"><?=number_format($Reports)?></td>
2011-03-28 14:21:28 +00:00
</tr>
2013-10-29 08:01:29 +00:00
<?
}
?>
2011-03-28 14:21:28 +00:00
</table>
<?
2013-05-04 08:00:48 +00:00
$DB->query("
SELECT
2013-05-21 08:01:09 +00:00
um.ID,
2013-05-04 08:00:48 +00:00
um.Username,
COUNT(r.ID) AS Reports
FROM reportsv2 AS r
2013-10-29 08:01:29 +00:00
JOIN users_main AS um ON um.ID = r.ResolverID
2013-05-04 08:00:48 +00:00
GROUP BY r.ResolverID
ORDER BY Reports DESC");
2011-03-28 14:21:28 +00:00
$Results = $DB->to_array();
?>
2013-10-09 08:01:03 +00:00
<h3>Reports resolved since Reports v2 (2009-07-27)</h3>
2013-10-10 08:01:46 +00:00
<table class="box border">
<tr class="colhead">
<td class="colhead_dark">Username</td>
<td class="colhead_dark number_column">Reports</td>
2011-03-28 14:21:28 +00:00
</tr>
2013-10-29 08:01:29 +00:00
<?
foreach ($Results as $Result) {
2013-05-21 08:01:09 +00:00
list($UserID, $Username, $Reports) = $Result;
2013-10-29 08:01:29 +00:00
if ($Username == $LoggedUser['Username']) {
$RowClass = ' class="rowa"';
} else {
$RowClass = '';
}
2011-03-28 14:21:28 +00:00
?>
2013-10-29 08:01:29 +00:00
<tr<?=$RowClass?>>
2013-05-21 08:01:09 +00:00
<td><a href="reportsv2.php?view=resolver&amp;id=<?=$UserID?>"><?=$Username?></a></td>
2013-08-28 23:08:41 +00:00
<td class="number_column"><?=number_format($Reports)?></td>
2011-03-28 14:21:28 +00:00
</tr>
2013-10-29 08:01:29 +00:00
<?
}
?>
2011-03-28 14:21:28 +00:00
</table>
<h3>Different view modes by person</h3>
2013-10-10 08:01:46 +00:00
<div class="box pad">
<strong>By ID of torrent reported:</strong>
<ul>
<li>
Reports of torrents with ID = 1
</li>
<li>
2014-02-27 08:00:30 +00:00
<a href="reportsv2.php?view=torrent&amp;id=1"><?=site_url()?>reportsv2.php?view=torrent&amp;id=1</a>
2013-10-10 08:01:46 +00:00
</li>
</ul>
<strong>By group ID of torrent reported:</strong>
<ul>
<li>
Reports of torrents within the group with ID = 1
</li>
<li>
2014-02-27 08:00:30 +00:00
<a href="reportsv2.php?view=group&amp;id=1"><?=site_url()?>reportsv2.php?view=group&amp;id=1</a>
2013-10-10 08:01:46 +00:00
</li>
</ul>
<strong>By report ID:</strong>
<ul>
<li>
The report with ID = 1
</li>
<li>
2014-02-27 08:00:30 +00:00
<a href="reportsv2.php?view=report&amp;id=1"><?=site_url()?>reportsv2.php?view=report&amp;id=1</a>
2013-10-10 08:01:46 +00:00
</li>
</ul>
<strong>By reporter ID:</strong>
<ul>
<li>
Reports created by <?=$Owner?>
</li>
<li>
2014-02-27 08:00:30 +00:00
<a href="reportsv2.php?view=reporter&amp;id=<?=$OwnerID?>"><?=site_url()?>reportsv2.php?view=reporter&amp;id=<?=$OwnerID?></a>
2013-10-10 08:01:46 +00:00
</li>
</ul>
<strong>By uploader ID:</strong>
<ul>
<li>
Reports for torrents uploaded by <?=$Owner?>
</li>
<li>
2014-02-27 08:00:30 +00:00
<a href="reportsv2.php?view=uploader&amp;id=<?=$OwnerID?>"><?=site_url()?>reportsv2.php?view=uploader&amp;id=<?=$OwnerID?></a>
2013-10-10 08:01:46 +00:00
</li>
</ul>
<strong>By resolver ID:</strong>
<ul>
<li>
Reports for torrents resolved by <?=$Owner?>
</li>
<li>
2014-02-27 08:00:30 +00:00
<a href="reportsv2.php?view=resolver&amp;id=<?=$OwnerID?>"><?=site_url()?>reportsv2.php?view=resolver&amp;id=<?=$OwnerID?></a>
2013-10-10 08:01:46 +00:00
</li>
</ul>
<strong>For browsing anything more complicated than these, use the search feature.</strong>
</div>
</div>
<div class="two_columns pad">
2011-03-28 14:21:28 +00:00
<?
2013-05-04 08:00:48 +00:00
$DB->query("
SELECT
r.ResolverID,
um.Username,
2013-06-11 08:01:24 +00:00
COUNT(r.ID) AS Count
2013-05-04 08:00:48 +00:00
FROM reportsv2 AS r
2013-10-29 08:01:29 +00:00
LEFT JOIN users_main AS um ON r.ResolverID = um.ID
2013-05-04 08:00:48 +00:00
WHERE r.Status = 'InProgress'
GROUP BY r.ResolverID");
2013-05-25 08:01:03 +00:00
2011-03-28 14:21:28 +00:00
$Staff = $DB->to_array();
?>
2013-10-09 08:01:03 +00:00
<h3>Currently assigned reports by staff member</h3>
2013-10-10 08:01:46 +00:00
<table class="box border">
2012-09-01 08:00:24 +00:00
<tr class="colhead">
2013-10-10 08:01:46 +00:00
<td class="colhead_dark">Staff Member</td>
<td class="colhead_dark number_column">Current Count</td>
2013-05-26 08:00:59 +00:00
</tr>
2013-05-25 08:01:03 +00:00
<?
2013-10-29 08:01:29 +00:00
foreach ($Staff as $Array) {
if ($Array['Username'] == $LoggedUser['Username']) {
$RowClass = ' class="rowa"';
} else {
$RowClass = '';
}
?>
<tr<?=$RowClass?>>
2011-03-28 14:21:28 +00:00
<td>
<a href="reportsv2.php?view=staff&amp;id=<?=$Array['ResolverID']?>"><?=display_str($Array['Username'])?>'s reports</a>
</td>
2013-08-28 23:08:41 +00:00
<td class="number_column"><?=number_format($Array['Count'])?></td>
2013-05-26 08:00:59 +00:00
</tr>
2013-10-29 08:01:29 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
</table>
<h3>Different view modes by report type</h3>
<?
2013-05-04 08:00:48 +00:00
$DB->query("
SELECT
2013-11-17 08:00:47 +00:00
Type,
COUNT(ID) AS Count
FROM reportsv2
WHERE Status = 'New'
GROUP BY Type");
2011-03-28 14:21:28 +00:00
$Current = $DB->to_array();
2013-05-04 08:00:48 +00:00
if (!empty($Current)) {
2011-03-28 14:21:28 +00:00
?>
2013-10-10 08:01:46 +00:00
<table class="box border">
2012-09-01 08:00:24 +00:00
<tr class="colhead">
2013-10-10 08:01:46 +00:00
<td class="colhead_dark">Type</td>
<td class="colhead_dark number_column">Current Count</td>
2011-03-28 14:21:28 +00:00
</tr>
<?
2013-05-04 08:00:48 +00:00
foreach ($Current as $Array) {
2011-03-28 14:21:28 +00:00
//Ugliness
2013-05-04 08:00:48 +00:00
foreach ($Types as $Category) {
if (!empty($Category[$Array['Type']])) {
2011-03-28 14:21:28 +00:00
$Title = $Category[$Array['Type']]['title'];
break;
}
}
?>
2013-11-02 08:01:09 +00:00
<tr<?=$Title === 'Urgent' ? ' class="rowa" style="font-weight: bold;"' : ''?>>
2011-03-28 14:21:28 +00:00
<td>
<a href="reportsv2.php?view=type&amp;id=<?=display_str($Array['Type'])?>"><?=display_str($Title)?></a>
</td>
2013-08-28 23:08:41 +00:00
<td class="number_column">
2012-12-21 08:00:21 +00:00
<?=number_format($Array['Count'])?>
2011-03-28 14:21:28 +00:00
</td>
</tr>
<?
}
}
?>
</table>
2013-10-10 08:01:46 +00:00
</div>
2011-03-28 14:21:28 +00:00
</div>
<?
2012-10-11 08:00:15 +00:00
View::show_footer();
2011-03-28 14:21:28 +00:00
?>