- added ranking of top achievers
- some minor layout adjustments
This commit is contained in:
@@ -154,9 +154,6 @@ $retHtml = "";
|
||||
}
|
||||
$retHtml .= "<div class=\"row\">";
|
||||
foreach($achievementGroups as $g){
|
||||
// var_dump($userData);
|
||||
// $records = record::getGroupsRecords($g->getId(), $userData[0]['gebDatum ']);
|
||||
// var_dump($userData);
|
||||
$records = record::getGroupsRecords($g->getId(), record::birthday2ageClass($userData[0]['gebDatum']));
|
||||
$retHtml .= "<div class=\"col s12 m6 l4 xl3\">";
|
||||
$retHtml .= "<ul class=\"card\">";
|
||||
|
||||
@@ -249,7 +249,8 @@ SQL;
|
||||
$retHtml .= "<input name=\"userId\" value=\"".$uId."\" type=\"hidden\" />";
|
||||
$retHtml .= "<input name=\"achievementId\" value=\"".$usersNextAchievement['id']."\" type=\"hidden\" />";
|
||||
if( canUserGetAchievementToday( $this->getDbConnection(), $uId) or isUserAdmin($this->getDbConnection(), $_SESSION['user']['userId']) ){
|
||||
$retHtml .= "<button style=\"width:100%\" class=\"btn\" name=\"submit\" type=\"submit\" >Achievement ".$usersNextAchievement['name']." geben</button>";
|
||||
// $retHtml .= "<button style=\"width:100%\" class=\"btn\" name=\"submit\" type=\"submit\" >Achievement ".$usersNextAchievement['name']." geben</button>";
|
||||
$retHtml .= "<button style=\"width:100%\" class=\"btn\" name=\"submit\" type=\"submit\" >Achievement geben</button>";
|
||||
}
|
||||
else{
|
||||
$retHtml .= "<button disabled style=\"width:100%\" class=\"btn\" name=\"submit\" type=\"submit\" >Heute wurde schon ein Achievement erreicht!</button>";
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<ul id="slide-out" class="sidenav">
|
||||
<li><?php echo $login_status;?></li>
|
||||
<li><a href=".">Achievements</a></li>
|
||||
<li><a href="topAchievers.php">Top-Achievers</a></li>
|
||||
<li><a href="records.php">Rekorde</a></li>
|
||||
<li><a href="./setUserData.php">Benutzerdaten</a></li>
|
||||
<?php
|
||||
|
||||
@@ -32,6 +32,17 @@ class record{
|
||||
return self::$db;
|
||||
}
|
||||
|
||||
public static function getTopAchievers($options=array()){
|
||||
$query = <<<SQL
|
||||
SELECT `wkParticipo_Users`.`vorname`, `wkParticipo_Users`.`name`, COUNT(*)
|
||||
FROM `achievements<=>user`
|
||||
JOIN `wkParticipo_Users`
|
||||
ON `wkParticipo_Users`.`id` = `achievements<=>user`.`userId`
|
||||
GROUP BY `wkParticipo_Users`.`id`
|
||||
ORDER BY `COUNT(*)` DESC;
|
||||
SQL;
|
||||
return dbQuery(self::$db, $query);
|
||||
}
|
||||
|
||||
public static function getAllRecords(){
|
||||
$query = <<<SQL
|
||||
|
||||
55
homepage/machs/topAchievers.php
Normal file
55
homepage/machs/topAchievers.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
require_once('machs.php');
|
||||
|
||||
PHPCount::AddHit("Achievementsystem (".htmlspecialchars($_SESSION['user']['username']).")");
|
||||
|
||||
$dbConnection = getPdoDbConnection(
|
||||
$cwsvJudoConfig["db"]["host"],
|
||||
$cwsvJudoConfig["db"]["name"],
|
||||
$cwsvJudoConfig["db"]["user"],
|
||||
$cwsvJudoConfig["db"]["password"]
|
||||
);
|
||||
|
||||
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>Top-Achievers</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
|
||||
echo("<table>");
|
||||
foreach( record::getTopAchievers() as $t ){
|
||||
// var_dump($t);
|
||||
echo("<tr><td>".$t['vorname']."</td><td>".$t['name']."</td><td>".$t['COUNT(*)']."</td></tr>");
|
||||
}
|
||||
echo("</table>");
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user