Releaseversion

This commit is contained in:
marko
2020-10-31 14:41:22 +01:00
parent 43632b243e
commit b610a3b8d6
8 changed files with 1152 additions and 23 deletions

View File

@@ -5,27 +5,29 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
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("./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");
require_once($basePath."/ressourcen/phpLib/cwsvJudo/miscAssis.php");
// require_once($basePath."/ressourcen/phpLib/phpcount/phpcount.php");
// require_once($basePath."/ressourcen/phpLib/cwsvJudo/miscAssis.php");
$dbConnection = getCwsvJudoDbConn();
// $dbConnection = getCwsvJudoDbConn();
$dbConnection = getPdoDbConnection(
$cwsvJudoConfig["db"]["host"],
$cwsvJudoConfig["db"]["name"],
$cwsvJudoConfig["db"]["user"],
$cwsvJudoConfig["db"]["password"]
);
try{
$results = dbQuery(
$dbConnection,
"SELECT * FROM cwsvjudo.achievements;"
);
}
catch(PDOException $db_error){
print "Error!: " . $db_error->getMessage() . "<br/>queryString: ".$queryString."<br />"; var_dump($bindArray);
}
$achievementGroups = getAchievementGroups($dbConnection);
processPostData($dbConnection, $_POST);
?>
<!DOCTYPE html>
@@ -34,24 +36,71 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
<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>
<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">
<style>
<?php
# $css = file_get_contents( $basePath."/pages/desktop/wkParticipo/wkParticipo.css");
# echo(colorThemeCss($_SESSION['user']['userConfig']['colors']));
# echo($css);
?>
</style>
</head>
<body>
<?php echo $login_status; ?>
<h1>Achievements</h1>
<?php echo( arrayKeyed2htmlTableString($results, ["id", "name", "rootId", "level", "description"], $withCaption = true) );?>
<?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']);
//var_dump($usersKids);
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['kidId'],
getUsersAchievements($dbConnection, $k['kidId'])
));
}
}
?>
<?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>