- added simple achievement editor
- added records
This commit is contained in:
@@ -8,13 +8,16 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
|
||||
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");
|
||||
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();
|
||||
@@ -25,7 +28,9 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
|
||||
$cwsvJudoConfig["db"]["password"]
|
||||
);
|
||||
|
||||
$achievementGroups = getAchievementGroups($dbConnection);
|
||||
record::setDbConnection($dbConnection);
|
||||
achievementGroup::setDbConnection($dbConnection);
|
||||
$achievementGroups = achievementGroup::getAllAchievementGroups();
|
||||
|
||||
processPostData($dbConnection, $_POST);
|
||||
|
||||
@@ -40,6 +45,8 @@ processPostData($dbConnection, $_POST);
|
||||
<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>Achievements</title>
|
||||
<meta name="description" content="Achievements">
|
||||
@@ -49,58 +56,36 @@ processPostData($dbConnection, $_POST);
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<?php echo $login_status; ?>
|
||||
|
||||
<?php
|
||||
|
||||
<!-- sidenav -->
|
||||
<?php include("lib/machs/sidenav.php");?>
|
||||
<!-- end sidenav -->
|
||||
|
||||
<?php // show own achievements, if oneself is inTraining
|
||||
if( hasUserAttribute($dbConnection, $_SESSION['user']['userId'], "inTraining" ) ){
|
||||
echo( "<div class=\"row\">");
|
||||
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'])
|
||||
));
|
||||
}
|
||||
# var_dump($achievementGroups);
|
||||
foreach($achievementGroups as $g){
|
||||
echo($g->asHtmlCard($_SESSION['user']['userId']));
|
||||
}
|
||||
echo("</div>" );
|
||||
}
|
||||
?>
|
||||
|
||||
<?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 />");
|
||||
<?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 class=\"row\">");
|
||||
foreach($achievementGroups as $g){
|
||||
echo($g->asHtmlCard($k['kidId'], ['noForm'=>false]));
|
||||
}
|
||||
echo("</div>" );
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<span id="endOfUpdateAchievementBoxes" style="display:none;" ></span>
|
||||
</body>
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user