Files
cwsvJudo/homepage/machs/achievementBuilder.php
marko a0ef0bf40c - added simple achievement editor
- added records
2020-11-16 09:32:27 +01:00

97 lines
2.9 KiB
PHP

<?php
setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
require_once("config.php");
require_once("./local/dbConf.php");
require_once("./local/achievementsConf.php");
require_once("./lib/db.php");
require_once("./lib/achievementsLib.php");
require_once("./lib/api.php");
require_once("./lib/record.php");
require_once("./lib/machs/achievementGroup.php");
require_once("./auth.php");
$basePath = "/users/cwsvjudo/www";
require_once($basePath."/config/cwsvJudo.config.php");
require_once($basePath."/config/phpcount.config.php");
require_once($basePath."/ressourcen/phpLib/phpcount/phpcount.php");
PHPCount::AddHit("Achievementsystem (".htmlspecialchars($_SESSION['user']['username']).")");
// require_once($basePath."/ressourcen/phpLib/cwsvJudo/miscAssis.php");
// $dbConnection = getCwsvJudoDbConn();
$dbConnection = getPdoDbConnection(
$cwsvJudoConfig["db"]["host"],
$cwsvJudoConfig["db"]["name"],
$cwsvJudoConfig["db"]["user"],
$cwsvJudoConfig["db"]["password"]
);
if(!isUserAdmin($dbConnection, $_SESSION['user']['userId']))
header("Location: .");
record::setDbConnection($dbConnection);
achievementGroup::setDbConnection($dbConnection);
$achievementGroups = achievementGroup::getAllAchievementGroups();
processPostData($dbConnection, $_POST);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<!-- inits for the materializeCss -->
<?php include("lib/machs/materializeInit.php");?>
<title>machs</title>
<meta name="description" content="Achievementsystem der Judoka des Chemnitzer WSV">
<link rel="icon" href="<?echo($config['ressourceUrl']);?>/graphiken/icons/cwsv.ico" />
<link rel="apple-touch-icon" href="<?echo($config['baseUrl']);?>/apple-touch-icon.png">
</head>
<body>
<!-- sidenav -->
<?php include("lib/machs/sidenav.php");?>
<!-- end sidenav -->
<h1>AchievementBuilder</h1>
<?php
echo("<h2 id=\"addAchievementGroup\">Add AchievementGroup</h2>");
echo(achievementGroup::htmlAddAchievementGroupForm());
echo("<h2>Update Achievements</h2>");
foreach($achievementGroups as $g){
echo("<h3>".$g->getName()."</h3>");
echo($g->htmlEditAchievementGroupForm());
$achievements = $g->getAchievements();
foreach($achievements as $a){
echo("<h4>".$a['name']."</h4>");
echo(htmlUpdateAchievementBox(
$a['id'],
$a['name'],
$a['rootId'],
$a['achievementGroupId'],
$a['level'],
$a['description'],
$a['imgUrl']
));
}
echo("<h4>Add achievement</h4>");
echo(htmlAddAchievementBox());
}
?>
</body>
</html>