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" ) ){
|
||||
echo( "<h2>Eigene Achievements</h2>" );
|
||||
// echo( htmlUsersUploadBox($dbConnection, $_SESSION['user']['userId']) );
|
||||
echo(htmlAchievementListForUser(
|
||||
$dbConnection,
|
||||
$achievementGroups,
|
||||
$_SESSION['user']['userId'],
|
||||
getUsersAchievements($dbConnection, $_SESSION['user']['userId'])
|
||||
));
|
||||
echo( "<div style=\"display:flex; flex-wrap:wrap; align-items:stretch;\" class=\"row\">");
|
||||
foreach($achievementGroups as $g){
|
||||
echo($g->asHtmlCard($_SESSION['user']['userId']));
|
||||
}
|
||||
echo("</div>" );
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
<?php
|
||||
$usersKids = getUsersKids($dbConnection, $_SESSION['user']['userId']);
|
||||
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['id'],
|
||||
getUsersAchievements($dbConnection, $k['id'])
|
||||
));
|
||||
<?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 style=\"display:flex; flex-wrap:wrap; align-items:stretch;\" class=\"row\">");
|
||||
foreach($achievementGroups as $g){
|
||||
echo($g->asHtmlCard($k['kidId'], ['noForm'=>false]));
|
||||
}
|
||||
}
|
||||
?>
|
||||
echo("</div>" );
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if(isUserAdmin($dbConnection, $_SESSION['user']['userId'])){
|
||||
|
||||
@@ -131,13 +131,13 @@ return $groups;
|
||||
}
|
||||
|
||||
function htmlUsersUploadBox($db, $userId){
|
||||
$html = "";
|
||||
$userData = getUserData($db, $userId);
|
||||
$html .= "<div><dl>";
|
||||
$html .= "<dt>Upload Link</dt><dd><a href=\"".$userData['machsUploadUrl']."\">".$userData['machsUploadUrl']."</a></dd>";
|
||||
$html .= "<dt>Upload Passwort</dt><dd>".$userData['machsUploadPw']."</dd>";
|
||||
$html .= "</dl></div>";
|
||||
return $html;
|
||||
$html = "";
|
||||
$userData = getUserData($db, $userId);
|
||||
$html .= "<div><dl>";
|
||||
$html .= "<dt>Upload Link</dt><dd><a href=\"".$userData['machsUploadUrl']."\">".$userData['machsUploadUrl']."</a></dd>";
|
||||
$html .= "<dt>Upload Passwort</dt><dd>".$userData['machsUploadPw']."</dd>";
|
||||
$html .= "</dl></div>";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function htmlAchievementListForUser($db, $achievementGroups, $userId, $usersAchievmentIds, $noForm=false){
|
||||
|
||||
@@ -197,7 +197,18 @@ SQL;
|
||||
|
||||
// image + title
|
||||
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 .= "</div>";
|
||||
}
|
||||
|
||||
@@ -41,12 +41,12 @@ class record{
|
||||
"ON `wkParticipo_Users`.`id` = `achievements<=>user`.`userId` ".
|
||||
(
|
||||
($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` ".
|
||||
"ORDER BY `COUNT(*)` DESC;";
|
||||
return dbQuery(self::$db, $query);
|
||||
return dbQuery(self::$db, $query);
|
||||
}
|
||||
|
||||
public static function getAllRecords(){
|
||||
|
||||
Reference in New Issue
Block a user