190 lines
9.2 KiB
PHP
190 lines
9.2 KiB
PHP
|
<?php
|
||
|
/**
|
||
|
* /subs/users.php
|
||
|
* @version 2.0
|
||
|
* @desc users editor
|
||
|
* @author Fándly Gergő Zoltán (fandlygergo@gmail.hu, systemtest.tk)
|
||
|
* @copy 2017 Fándly Gergő Zoltán
|
||
|
* License:
|
||
|
Result Manager for managing results of students in bilingual school systems.
|
||
|
Copyright (C) 2017 Fándly Gergő Zoltán
|
||
|
|
||
|
This program is free software: you can redistribute it and/or modify
|
||
|
it under the terms of the GNU General Public License as published by
|
||
|
the Free Software Foundation, either version 3 of the License, or
|
||
|
(at your option) any later version.
|
||
|
|
||
|
This program is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
GNU General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU General Public License
|
||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||
|
**/
|
||
|
|
||
|
$oid=0;
|
||
|
?>
|
||
|
|
||
|
<div class="selfcenter">
|
||
|
<!-- language for jquery -->
|
||
|
<span id="usersDeleteConfirm" style="display: none"><?php echo $lang['delete_confirm'] ?></span>
|
||
|
<!-- filter -->
|
||
|
<div class="dropdown selfcenter" style="width: 95%" id="dd_filter">
|
||
|
<div class="dropdown header">
|
||
|
<a onclick="toggleDropdown('#dd_filter_content', '#dd_filter_img')">
|
||
|
<img class="icon" src="./res/plus.png" alt="plusminus" id="dd_filter_img">
|
||
|
<span><?php echo $lang['filter'] ?></span>
|
||
|
</a>
|
||
|
</div>
|
||
|
<div class="dropdown content" id="dd_filter_content">
|
||
|
<form method="POST" class="ajaxform" id="dd_filter_form" onsubmit="usersFilterApply()">
|
||
|
<input type="hidden" name="filter">
|
||
|
<p><?php echo $lang['search'].":" ?></p>
|
||
|
<input type="text" name="f_search" placeholder="<?php echo $lang['search']."..." ?>">
|
||
|
<hr>
|
||
|
<p><?php echo $lang['class'].":" ?></p>
|
||
|
<?php
|
||
|
$sql=$db->prepare("SELECT DISTINCT class FROM users ORDER BY class ASC");
|
||
|
$sql->execute();
|
||
|
while($res=$sql->fetch(PDO::FETCH_ASSOC)){
|
||
|
echo "<input type=\"checkbox\" name=\"f_class[]\" id=\"o_".$oid."\" value=\"".$res['class']."\">";
|
||
|
echo "<label for=\"o_".$oid."\">".($res['class']!=""?$res['class']:"<<".$lang['empty'].">>")."</label>";
|
||
|
echo "<br>";
|
||
|
$oid++;
|
||
|
}
|
||
|
?>
|
||
|
<hr>
|
||
|
<p><?php echo $lang['accesslevel'].":" ?></p>
|
||
|
<?php
|
||
|
$sql=$db->prepare("SELECT DISTINCT accesslevel FROM users ORDER BY accesslevel ASC");
|
||
|
$sql->execute();
|
||
|
while($res=$sql->fetch(PDO::FETCH_ASSOC)){
|
||
|
echo "<input type=\"checkbox\" name=\"f_accesslevel[]\" id=\"o_".$oid."\" value=\"".$res['accesslevel']."\">";
|
||
|
echo "<label for=\"o_".$oid."\">".$res['accesslevel']."</label>";
|
||
|
echo "<br>";
|
||
|
$oid++;
|
||
|
}
|
||
|
?>
|
||
|
<hr>
|
||
|
<button type="submit" form="dd_filter_form"><?php echo $lang['apply'] ?></button>
|
||
|
<button type="button" onclick="usersFilterReset()"><?php echo $lang['reset'] ?></button>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
<hr class="placeholder">
|
||
|
<!-- new -->
|
||
|
<div class="dropdown selfcenter" style="width: 95%" id="dd_new">
|
||
|
<div class="dropdown header">
|
||
|
<a onclick="toggleDropdown('#dd_new_content', '#dd_new_img')">
|
||
|
<img class="icon" src="./res/plus.png" alt="plusminus" id="dd_new_img">
|
||
|
<span><?php echo $lang['new'] ?></span>
|
||
|
</a>
|
||
|
</div>
|
||
|
<div class="dropdown content" id="dd_new_content">
|
||
|
<form method="POST" class="ajaxform" id="dd_new_form" onsubmit="usersNew()" autocomplete="off">
|
||
|
<input type="hidden" name="new">
|
||
|
<table>
|
||
|
<tr>
|
||
|
<td><?php echo $lang['username'].": " ?></td>
|
||
|
<td><input type="text" name="username" placeholder="<?php echo $lang['username']."..." ?>"></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td><?php echo $lang['fullname'].": " ?></td>
|
||
|
<td><input type="text" name="fullname" placeholder="<?php echo $lang['fullname']."..." ?>" required></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td><?php echo $lang['accesslevel'].": " ?></td>
|
||
|
<td><input type="number" name="accesslevel" placeholder="<?php echo $lang['accesslevel']."..." ?>" value=0 min=0 max=4 required></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<span><?php echo $lang['class'].": " ?></span>
|
||
|
<br>
|
||
|
<span style="font-size: 0.8em"><?php echo $lang['classformat'] ?></span>
|
||
|
</td>
|
||
|
<td><input type="text" name="class" placeholder="<?php echo $lang['class']."..." ?>"></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<span><?php echo $lang['password'].": " ?></span>
|
||
|
<br>
|
||
|
<span style="font-size: 0.8em"><?php echo $lang['passwordhint'] ?></span>
|
||
|
</td>
|
||
|
<td><input type="text" name="password" placeholder="<?php echo $lang['password']."..." ?>"></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td><?php echo $lang['perm_message'].": " ?></td>
|
||
|
<td>
|
||
|
<div class="checkbox">
|
||
|
<input type="checkbox" name="perm_message" id="o_<?php echo $oid ?>" checked>
|
||
|
<label for="o_<?php echo $oid; $oid++ ?>"></label>
|
||
|
</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<br>
|
||
|
<br>
|
||
|
<button type="submit" form="dd_new_form"><?php echo $lang['ok'] ?></button>
|
||
|
<button type="reset" form="dd_new_form" onclick="toggleDropdown('#dd_new_content', '#dd_new_img')"><?php echo $lang['cancel'] ?></button>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
<hr class="placeholder">
|
||
|
<!-- edit -->
|
||
|
<div class="dropdown selfcenter" id="dd_edit" style="width: 95%; display: none" id="dd_edit">
|
||
|
<div class="dropdown header">
|
||
|
<span><?php echo $lang['edit'] ?></span>
|
||
|
</div>
|
||
|
<div class="dropdown content" style="display: block">
|
||
|
<form method="POST" class="ajaxform" id="dd_edit_form" onsubmit="usersSubmitEdit()" autocomplete="off">
|
||
|
<input type="hidden" name="edit">
|
||
|
<table>
|
||
|
<tr>
|
||
|
<td><?php echo $lang['username'].": " ?></td>
|
||
|
<td><input type="text" name="username" placeholder="<?php echo $lang['username']."..." ?>"></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td><?php echo $lang['fullname'].": " ?></td>
|
||
|
<td><input type="text" name="fullname" placeholder="<?php echo $lang['fullname']."..." ?>" required></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td><?php echo $lang['accesslevel'].": " ?></td>
|
||
|
<td><input type="number" name="accesslevel" placeholder="<?php echo $lang['accesslevel']."..." ?>" value=0 min=0 max=4 required></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td><?php echo $lang['class'].": " ?></td>
|
||
|
<td><input type="text" name="class" placeholder="<?php echo $lang['class']."..." ?>"></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<span><?php echo $lang['password'].": " ?></span>
|
||
|
<br>
|
||
|
<span style="font-size: 0.8em"><?php echo $lang['passwordhintedit'] ?></span>
|
||
|
</td>
|
||
|
<td><input type="text" name="password" placeholder="<?php echo $lang['password']."..." ?>"></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td><?php echo $lang['perm_message'].": " ?></td>
|
||
|
<td>
|
||
|
<div class="checkbox">
|
||
|
<input type="checkbox" name="perm_message" id="o_<?php echo $oid ?>" checked>
|
||
|
<label for="o_<?php echo $oid; $oid++ ?>"></label>
|
||
|
</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<br>
|
||
|
<br>
|
||
|
<button type="submit" form="dd_edit_form"><?php echo $lang['ok'] ?></button>
|
||
|
<button type="button" onclick="usersCancelEdit()"><?php echo $lang['cancel'] ?></button>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
<hr class="placeholder">
|
||
|
<!-- list -->
|
||
|
<div class="selfcenter" id="list">
|
||
|
<!-- list goes here -->
|
||
|
</div>
|
||
|
</div>
|