- 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
|
||||
|
||||
Reference in New Issue
Block a user