finishing up reports
This commit is contained in:
parent
294de80a66
commit
3ae104124c
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
Alphaland 2021
|
||||||
|
*/
|
||||||
|
|
||||||
|
header("Access-Control-Allow-Origin: https://www.alphaland.cc");
|
||||||
|
header("access-control-allow-credentials: true");
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
if(!$user->isStaff()) {
|
||||||
|
redirect("/MCP");
|
||||||
|
}
|
||||||
|
|
||||||
|
$report = $GLOBALS['pdo']->prepare("SELECT * FROM user_reports WHERE closed = 0 ORDER BY whenReported ASC");
|
||||||
|
$report->execute();
|
||||||
|
if ($report->rowCount() == 0) {
|
||||||
|
die(json_encode(["alert"=>"No reports found"]));
|
||||||
|
}
|
||||||
|
|
||||||
|
$jsonData = array();
|
||||||
|
|
||||||
|
foreach($report as $report) {
|
||||||
|
$chatData = array(
|
||||||
|
"id" => $report['id'],
|
||||||
|
"reported" => date("m/d/Y", $report['whenReported'])
|
||||||
|
);
|
||||||
|
|
||||||
|
array_push($jsonData, $chatData);
|
||||||
|
}
|
||||||
|
|
||||||
|
die(json_encode($jsonData));
|
||||||
|
|
@ -9,4 +9,45 @@ if(!$user->isStaff()) {
|
||||||
redirect("/");
|
redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "soon";
|
$body = <<<EOT
|
||||||
|
<h5 class="text-center">Open Reports</h5>
|
||||||
|
<div class="container">
|
||||||
|
<div id = "error_alert" class="alert alert-danger" role="alert" style="display:none;"></div>
|
||||||
|
<div class = "card">
|
||||||
|
<div class="row">
|
||||||
|
<div class="container pb-3">
|
||||||
|
<div id = "reports-container" class="card-body text-center">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
function populateReports()
|
||||||
|
{
|
||||||
|
var html = `<div class="mod-ul-container">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<div class="card">
|
||||||
|
<a>
|
||||||
|
<div class="card-body">
|
||||||
|
<a href="/MCP/reports/view?id={id}" style="color:grey;text-decoration:none;" class="no-overflow mb-1"><b><h5>{reported}</h5></b></a>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
staticPageHelper("https://www.alphaland.cc/MCP/reports/data/reports", "https://api.alphaland.cc/logo", "#reports-container", html, "", 1000, "", "No active reports");
|
||||||
|
}
|
||||||
|
populateReports();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
EOT;
|
||||||
|
|
||||||
|
pageHandler();
|
||||||
|
$ph->pageTitle("Reports");
|
||||||
|
$ph->body = $body;
|
||||||
|
$ph->output();
|
||||||
Loading…
Reference in New Issue