SpreadQuiz/result_analyzer.php

105 lines
3.0 KiB
PHP

<?php
require_once "check_maintenance.php";
require_once "globals.php";
require_once "autologin.php";
$user_data = get_autologin_user_data();
if (!get_autologin_state()) {
exit();
}
// fetch game ID; cannot continue without specifying it
$game_id = trim($_REQUEST["game_id"] ?: "");
if ($game_id === "") {
exit();
}
require_once "class/GameMgr.php";
// no user without access may tamper with the results
$gameMgr = new GameMgr();
if (!$gameMgr->getGame($game_id)->isUserContributorOrOwner($user_data["nickname"]) && ($user_data["privilege"] !== PRIVILEGE_QUIZMASTER)) {
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0'>
<title>SpreadQuiz - Eredménykezelő</title>
<script src="js/req.js"></script>
<script src="js/o.js"></script>
<script src="js/common.js"></script>
<script src="js/spreadquiz.js"></script>
<script src="js/result_analyzer.js"></script>
<link rel="stylesheet" href="style/spreadquiz.css">
<link rel="stylesheet" href="style/quizmaster_area.css"/>
<style>
tbody#results_display > tr {
cursor: auto;
}
</style>
</head>
<body>
<section style="margin-bottom: 0.3em">
<input type="text" placeholder="Szűrőfeltétel" id="filter" style="font-family: 'Monaco', monospace; width: 50em;">
<input type="text" placeholder="Rendezés" id="orderby" style="font-family: 'Monaco', monospace; width: 50em;">
<input type="button" value="Szűrés" onclick="fetch_results()">
<input type="button" value="Jelentés előállítása" onclick="generate_report()">
<input type="button" value="Kijelöltek törlése" onclick="delete_tests()">
</section>
<section>
<section id="table_section">
<table class="management">
<thead>
<tr>
<th>
<input type="checkbox" onclick="toggle_test_selection()">
</th>
<th>#<br>
<code>
[_id]
</code>
</th>
<th></th>
<th>
Felhasználónév<br>
<code>
[nickname]
</code>
</th>
<th>Eredmény<br>
<code>
[summary.percentage]
</code>
</th>
<th>Kezdés ideje<br>
<code>
[start_time]
</code>
</th>
<th>Befejezés ideje<br>
<code>
[end_time]
</code>
</th>
</tr>
</thead>
<tbody id="results_display">
</tbody>
</table>
</section>
</section>
<script>
let GAMEID = <?="$game_id"?>;
fetch_results();
</script>
</body>
</html>