126 lines
4.3 KiB
PHP
126 lines
4.3 KiB
PHP
<?php
|
|
|
|
require_once "globals.php";
|
|
require_once "autologin.php";
|
|
|
|
$user_data = get_autologin_user_data();
|
|
if (!get_autologin_state() || ($user_data["privilege"] !== PRIVILEGE_QUIZMASTER)) {
|
|
exit(); // this page is only available for quizmasters
|
|
}
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="hu">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>SpreadQuiz</title>
|
|
<script src="js/o.js"></script>
|
|
<script src="js/req.js"></script>
|
|
<script src="js/spreadquiz.js"></script>
|
|
<script src="js/common.js"></script>
|
|
<script src="js/quizmaster_common.js"></script>
|
|
<script src="js/groupmgr.js"></script>
|
|
<script src="js/hintbox.js"></script>
|
|
<script src="js/usermgr.js"></script>
|
|
<link rel="stylesheet" href="style/spreadquiz.css"/>
|
|
<link rel="stylesheet" href="style/quizmaster_area.css"/>
|
|
</head>
|
|
<body>
|
|
<section id="table_section">
|
|
<table id="user_manager_table" class="management">
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th>Felhasználónév</th>
|
|
<th>Név</th>
|
|
<th>Csoportok</th>
|
|
<th>Jogosultság</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="user_manager_table_body">
|
|
<!-- --><?php
|
|
// function create_cell(string $content, string $class = "")
|
|
// {
|
|
// if (trim($content) === "") {
|
|
// $content = "<i>(üres)</i>";
|
|
// }
|
|
// return "<td class='$class'>$content</td>";
|
|
// }
|
|
//
|
|
// function create_table_row(array $keys, array $record)
|
|
// {
|
|
// $tr = "<tr>";
|
|
// foreach ($keys as $k) {
|
|
// $tr .= "<td>${record[$k]}</td>";
|
|
// }
|
|
// $tr .= "</tr>";
|
|
// return $tr;
|
|
// }
|
|
//
|
|
// $users = get_all_users();
|
|
// foreach ($users as $u) {
|
|
// $nickname = $u["nickname"];
|
|
// $tr = "<tr id='row_$nickname'>";
|
|
// $tr .= create_cell("<input type='checkbox' id='user_chk_$nickname' onchange='highlight_row(\"$nickname\")'>", "checkbox");
|
|
// $tr .= create_cell($u["nickname"]);
|
|
// $tr .= create_cell($u["realname"]);
|
|
// $tr .= create_cell(implode(",", $u["groups"]));
|
|
// $tr .= create_cell($u["privilege"]);
|
|
// $tr .= "</tr>";
|
|
// echo $tr;
|
|
// }
|
|
// ?>
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
<section>
|
|
<input type="button" value="Új felhasználó" onclick="create_edit_user()">
|
|
<input type="button" value="Felhasználó(k) törlése" onclick="delete_users()">
|
|
<input type="button" value="Felhasználók importálása CSV-ből">
|
|
</section>
|
|
<section class="window" shown="false" id="user_editor_window">
|
|
<section class="window-inner">
|
|
<table>
|
|
<tr>
|
|
<td><label for="nickname">Felhasználónév:</label></td>
|
|
<td><input type="text" id="nickname"></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label for="realname">Teljes név:</label></td>
|
|
<td><input type="text" id="realname"></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label for="password">Jelszó:</label></td>
|
|
<td><input type="text" id="password"></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label for="groups">Csoportok:</label></td>
|
|
<td><input type="text" id="groups" oninput="hint_all_groups('groups')" onblur="close_hintbox()"></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label for="privilege">Jogosultság:</label></td>
|
|
<td>
|
|
<select id="privilege">
|
|
<option value="player">játékos</option>
|
|
<option value="creator">szerkesztő</option>
|
|
<option value="admin">kvízmester</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<section style="display: block; text-align: right">
|
|
<input type="button" value="" id="user_editor_submit_btn">
|
|
<input type="button" value="Mégse" onclick="hide('user_editor_window')">
|
|
</section>
|
|
</section>
|
|
</section>
|
|
|
|
<script>
|
|
list_all_users();
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|
|
|
|
|