First release of 2.0! :D

This commit is contained in:
Wruczek
2018-12-27 18:59:49 +01:00
parent 7396a76816
commit 628af52b54
293 changed files with 12641 additions and 3 deletions

35
src/assigner.php Normal file
View File

@ -0,0 +1,35 @@
<?php
use Wruczek\TSWebsite\Assigner;
use Wruczek\TSWebsite\Auth;
use Wruczek\TSWebsite\Utils\TemplateUtils;
require_once __DIR__ . "/private/php/load.php";
$data = ["isLoggedIn" => Auth::isLoggedIn()];
if (Auth::isLoggedIn()) {
if (isset($_POST["assigner"])) {
$groups = array_keys($_POST["assigner"]); // get all group ids
$groups = array_filter($groups, "is_int"); // only keep integers
$changeGroups = Assigner::changeGroups($groups);
$data["groupChangeStatus"] = $changeGroups;
if ($changeGroups === 0) {
// if groups have been successfully updated,
// invalidate the cache
Auth::invalidateUserGroupCache();
}
}
try {
$assignerConfig = Assigner::getAssignerArray();
$assignerConfig = array_chunk($assignerConfig, 2);
} catch (\Exception $e) {}
// suppress warnings - might be null on exception
$data["assignerConfig"] = @$assignerConfig;
}
TemplateUtils::i()->renderTemplate("assigner", $data);