modernize look

This commit is contained in:
marko
2021-10-19 18:20:03 +02:00
parent ff7363b370
commit 6f5e2ee405
3 changed files with 176 additions and 51 deletions

View File

@@ -1,7 +1,13 @@
<?php
require_once('machs.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");
PHPCount::AddHit("Achievementsystem (".htmlspecialchars($_SESSION['user']['username']).")");
require_once("./lib/db.php");
require_once("./lib/achievementsLib.php");
require_once("./lib/api.php");
$dbConnection = getPdoDbConnection(
$cwsvJudoConfig["db"]["host"],
@@ -9,12 +15,26 @@ $dbConnection = getPdoDbConnection(
$cwsvJudoConfig["db"]["user"],
$cwsvJudoConfig["db"]["password"]
);
require_once("./auth.php");
record::setDbConnection($dbConnection);
achievementGroup::setDbConnection($dbConnection);
$achievementGroups = achievementGroup::getAllAchievementGroups();
$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");
// require_once($basePath."/ressourcen/phpLib/cwsvJudo/miscAssis.php");
// $dbConnection = getCwsvJudoDbConn();
$dbConnection = getPdoDbConnection(
$cwsvJudoConfig["db"]["host"],
$cwsvJudoConfig["db"]["name"],
$cwsvJudoConfig["db"]["user"],
$cwsvJudoConfig["db"]["password"]
);
$achievementGroups = getAchievementGroups($dbConnection);
processPostData($dbConnection, $_POST);
?>
<!DOCTYPE html>
<html>
@@ -38,34 +58,56 @@ processPostData($dbConnection, $_POST);
</head>
<body>
<!-- sidenav -->
<?php include("lib/machs/sidenav.php");?>
<!-- end sidenav -->
<?php // show own achievements, if oneself is inTraining
<?php echo $login_status; ?>
<?php
if( hasUserAttribute($dbConnection, $_SESSION['user']['userId'], "inTraining" ) ){
echo( "<h2>Eigene Achievements</h2>" );
echo( "<div style=\"display:flex; flex-wrap:wrap; align-items:stretch;\" class=\"row\">");
foreach($achievementGroups as $g){
echo($g->asHtmlCard($_SESSION['user']['userId']));
}
echo("</div>" );
echo( htmlUsersUploadBox($dbConnection, $_SESSION['user']['userId']) );
echo(htmlAchievementListForUser(
$dbConnection,
$achievementGroups,
$_SESSION['user']['userId'],
getUsersAchievements($dbConnection, $_SESSION['user']['userId'])
));
}
?>
<?php // show the achievements of each kid
$usersKids = getUsersKids($dbConnection, $_SESSION['user']['userId']);
foreach($usersKids as $k){
if( hasUserAttribute($dbConnection, $k['kidId'], "inTraining" ) ){
echo( "<h2>".$k['vorname']." ".$k['name']."</h2>" );
echo( "<div style=\"display:flex; flex-wrap:wrap; align-items:stretch;\" class=\"row\">");
foreach($achievementGroups as $g){
echo($g->asHtmlCard($k['kidId'], ['noForm'=>false]));
<?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'])
));
}
echo("</div>" );
}
}
?>
</body>
<?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['description'],
$a['rootId'],
$a['level']
));
echo("<hr />");
}
}
?>
<span id="endOfUpdateAchievementBoxes" style="display:none;" ></span>
</body>
</html>