Files
cwsvJudo/homepage/machs/index.php
2021-12-20 19:10:55 +01:00

108 lines
3.2 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/machs/achievementGroup.php");
$basePath = "/users/cwsvjudo/www";
require_once($basePath."/config/cwsvJudo.config.php");
require_once($basePath."/config/phpcount.config.php");
$dbConnection = getPdoDbConnection(
$cwsvJudoConfig["db"]["host"],
$cwsvJudoConfig["db"]["name"],
$cwsvJudoConfig["db"]["user"],
$cwsvJudoConfig["db"]["password"]
);
require_once("./auth.php");
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://cdn.jsdelivr.net/npm/@materializecss/materialize@1.1.0-alpha/dist/css/materialize.min.css">
<!-- Compiled and minified JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/@materializecss/materialize@1.1.0-alpha/dist/js/materialize.min.js"></script>
<!-- inits for the materializeCss -->
<?php include("lib/machs/materializeInit.php");?>
<title>Achievements</title>
<meta name="description" content="Achievements">
<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>
<?php include("lib/machs/sidenav.php");?>
<?php
if( hasUserAttribute($dbConnection, $_SESSION['user']['userId'], "inTraining" ) ){
echo( "<h2>Eigene Achievements</h2>" );
// echo( htmlUsersUploadBox($dbConnection, $_SESSION['user']['userId']) );
echo(htmlAchievementListForUser(
$dbConnection,
$achievementGroups,
$_SESSION['user']['userId'],
getUsersAchievements($dbConnection, $_SESSION['user']['userId'])
));
}
?>
<?php
$usersKids = getUsersKids($dbConnection, $_SESSION['user']['userId']);
foreach($usersKids as $k){
if( hasUserAttribute($dbConnection, $k['kidId'], "inTraining" ) and ($k['kidId']!=$_SESSION['user']['userId']) ){
echo( "<h2>".$k['vorname']." ".$k['name']."</h2>" );
// echo( htmlUsersUploadBox($dbConnection, $k['kidId']) );
echo(htmlAchievementListForUser(
$dbConnection,
$achievementGroups,
$k['id'],
getUsersAchievements($dbConnection, $k['id'])
));
}
}
?>
<?php
if(isUserAdmin($dbConnection, $_SESSION['user']['userId'])){
echo("<h2 id=\"addAchievementBox\">Add Achievements</h2>");
echo(htmlAddAchievementBox());
echo("<h2>Update Achievements</h2>");
$achievements = getAchievements($dbConnection);
foreach($achievements as $a){
echo( htmlUpdateAchievementBox(
$a['id'],
$a['name'],
$a['rootId'],
$a['achievementGroupId'],
$a['level'],
$a['description'],
$a['imgUrl']
));
echo("<hr />");
}
}
?>
<span id="endOfUpdateAchievementBoxes" style="display:none;" ></span>
</body>
</html>