bring back modern look for achievement cards
This commit is contained in:
@@ -72,34 +72,30 @@ processPostData($dbConnection, $_POST);
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if( hasUserAttribute($dbConnection, $_SESSION['user']['userId'], "inTraining" ) ){
|
if( hasUserAttribute($dbConnection, $_SESSION['user']['userId'], "inTraining" ) ){
|
||||||
echo( "<h2>Eigene Achievements</h2>" );
|
echo( "<h2>Eigene Achievements</h2>" );
|
||||||
// echo( htmlUsersUploadBox($dbConnection, $_SESSION['user']['userId']) );
|
echo( "<div style=\"display:flex; flex-wrap:wrap; align-items:stretch;\" class=\"row\">");
|
||||||
echo(htmlAchievementListForUser(
|
foreach($achievementGroups as $g){
|
||||||
$dbConnection,
|
echo($g->asHtmlCard($_SESSION['user']['userId']));
|
||||||
$achievementGroups,
|
}
|
||||||
$_SESSION['user']['userId'],
|
echo("</div>" );
|
||||||
getUsersAchievements($dbConnection, $_SESSION['user']['userId'])
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php
|
<?php // show the achievements of each kid
|
||||||
$usersKids = getUsersKids($dbConnection, $_SESSION['user']['userId']);
|
$usersKids = getUsersKids($dbConnection, $_SESSION['user']['userId']);
|
||||||
foreach($usersKids as $k){
|
foreach($usersKids as $k){
|
||||||
if( hasUserAttribute($dbConnection, $k['kidId'], "inTraining" ) and ($k['kidId']!=$_SESSION['user']['userId']) ){
|
if( hasUserAttribute($dbConnection, $k['kidId'], "inTraining" ) ){
|
||||||
echo( "<h2>".$k['vorname']." ".$k['name']."</h2>" );
|
echo( "<h2>".$k['vorname']." ".$k['name']."</h2>" );
|
||||||
// echo( htmlUsersUploadBox($dbConnection, $k['kidId']) );
|
echo( "<div style=\"display:flex; flex-wrap:wrap; align-items:stretch;\" class=\"row\">");
|
||||||
echo(htmlAchievementListForUser(
|
foreach($achievementGroups as $g){
|
||||||
$dbConnection,
|
echo($g->asHtmlCard($k['kidId'], ['noForm'=>false]));
|
||||||
$achievementGroups,
|
|
||||||
$k['id'],
|
|
||||||
getUsersAchievements($dbConnection, $k['id'])
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
echo("</div>" );
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if(isUserAdmin($dbConnection, $_SESSION['user']['userId'])){
|
if(isUserAdmin($dbConnection, $_SESSION['user']['userId'])){
|
||||||
|
|||||||
@@ -131,13 +131,13 @@ return $groups;
|
|||||||
}
|
}
|
||||||
|
|
||||||
function htmlUsersUploadBox($db, $userId){
|
function htmlUsersUploadBox($db, $userId){
|
||||||
$html = "";
|
$html = "";
|
||||||
$userData = getUserData($db, $userId);
|
$userData = getUserData($db, $userId);
|
||||||
$html .= "<div><dl>";
|
$html .= "<div><dl>";
|
||||||
$html .= "<dt>Upload Link</dt><dd><a href=\"".$userData['machsUploadUrl']."\">".$userData['machsUploadUrl']."</a></dd>";
|
$html .= "<dt>Upload Link</dt><dd><a href=\"".$userData['machsUploadUrl']."\">".$userData['machsUploadUrl']."</a></dd>";
|
||||||
$html .= "<dt>Upload Passwort</dt><dd>".$userData['machsUploadPw']."</dd>";
|
$html .= "<dt>Upload Passwort</dt><dd>".$userData['machsUploadPw']."</dd>";
|
||||||
$html .= "</dl></div>";
|
$html .= "</dl></div>";
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function htmlAchievementListForUser($db, $achievementGroups, $userId, $usersAchievmentIds, $noForm=false){
|
function htmlAchievementListForUser($db, $achievementGroups, $userId, $usersAchievmentIds, $noForm=false){
|
||||||
|
|||||||
@@ -197,7 +197,18 @@ SQL;
|
|||||||
|
|
||||||
// image + title
|
// image + title
|
||||||
if($this->imageUrl != null){
|
if($this->imageUrl != null){
|
||||||
$retHtml .= "<div class=\"card-image\"><img src=\"".$this->imageUrl."\">";
|
$retHtml .= "<div class=\"card-image\">";
|
||||||
|
$ext = pathinfo($this->imageUrl, PATHINFO_EXTENSION);
|
||||||
|
$ret."<div>".$this->imageUrl."</div>";
|
||||||
|
$ret."<div>".$ext."</div>";
|
||||||
|
switch($ext){
|
||||||
|
case "webm":
|
||||||
|
$retHtml .= "<video controls><source src=\"".$this->imageUrl."\" type=\"video/webm\">Video tag is not supported in this browser.</video>";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$retHtml .= "<img src=\"".$this->imageUrl."\">";
|
||||||
|
break;
|
||||||
|
};
|
||||||
$retHtml .= "<span class=\"card-title\">".$this->name."</span>";
|
$retHtml .= "<span class=\"card-title\">".$this->name."</span>";
|
||||||
$retHtml .= "</div>";
|
$retHtml .= "</div>";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,12 +41,12 @@ class record{
|
|||||||
"ON `wkParticipo_Users`.`id` = `achievements<=>user`.`userId` ".
|
"ON `wkParticipo_Users`.`id` = `achievements<=>user`.`userId` ".
|
||||||
(
|
(
|
||||||
($from!=null&&$to!=null)?
|
($from!=null&&$to!=null)?
|
||||||
("BETWEEN CONVERT(\"".$from."\", datetime) AND CONVERT(\"".$to."\", datetime) "):
|
(" WHERE `achievements<=>user`.`timestamp` BETWEEN CONVERT(\"".$from."\", datetime) AND CONVERT(\"".$to."\", datetime) "):
|
||||||
("")
|
("")
|
||||||
).
|
).
|
||||||
"GROUP BY `wkParticipo_Users`.`id` ".
|
"GROUP BY `wkParticipo_Users`.`id` ".
|
||||||
"ORDER BY `COUNT(*)` DESC;";
|
"ORDER BY `COUNT(*)` DESC;";
|
||||||
return dbQuery(self::$db, $query);
|
return dbQuery(self::$db, $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getAllRecords(){
|
public static function getAllRecords(){
|
||||||
|
|||||||
@@ -13,4 +13,3 @@
|
|||||||
.parsedownCard img{
|
.parsedownCard img{
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user