Formatted the "sessions details".

This commit is contained in:
2018-12-20 23:21:16 -05:00
parent 33976ab0d7
commit 6098bb9acc
5 changed files with 59 additions and 13 deletions

View File

@@ -33,20 +33,26 @@ class ps4 {
}
function gameTimeDetails($gameid) {
$result = $this->mysql_conn("SELECT * FROM game_time WHERE game_id = '". $gameid ."';");
$result = $this->mysql_conn("SELECT * FROM game_time WHERE game_id = '". $gameid ."' ORDER BY game_start DESC;");
if ($result->num_rows > 0) {
$i=0;
echo '<div class="PlaytimeDetails FontSmaller">';
echo '<div class="row"><div class="head PlaytimeStart">Start</div><div class="head PlaytimeEnd">End</div><div class="head PlaytimeTotal">Time Played</div></div>';
while ($row = $result->fetch_assoc()) {
$i++;
echo "<br/>";
echo $row["id"] ." : ";
echo $this->secondsToDate($row["game_start"]);
echo " / ";
echo $this->secondsToDate($row["game_end"]);
echo " = ";
echo $this->playtime((($row["game_end"]-$row["game_start"])/1000),true);
echo "<br/>";
echo '<div class="row">';
$i++;
echo '<div class="PlaytimeStart">'. $this->secondsToDate($row["game_start"]) .'</div>';
echo '<div class="PlaytimeEnd">'. $this->secondsToDate($row["game_end"]) .'</div>';
echo '<div class="PlaytimeTotal">';
if ($row["game_end"] == "") {
echo "<strong>now playing</strong>";
} else {
echo $this->playtime((($row["game_end"]-$row["game_start"])/1000),true);
}
echo '</div>';
echo '</div>';
}
echo '</div>';
}
}

View File

@@ -27,7 +27,7 @@ $details = isset($_GET['details']) ? $_GET['details'] : "";
function update() {
$.get('page.php?rootpage=<?php echo $rootpage ?>&orderby=<?php echo $orderby ?>&details=<?php echo $details ?>', function(data) {
$("#page").html(data);
window.setTimeout(update, 10000); // 10 secondes
//window.setTimeout(update, 10000); // 10 secondes
});
}
</script>

View File

@@ -92,10 +92,12 @@ foreach ($games as $key => $value) {
}
echo "</div></div>";
echo "</div>"; // info
if ($details == $games[$key]["game_id"]) {
$ps4->gameTimeDetails($games[$key]["game_id"]);
}
echo "</div>"; // info
echo "</div>"; // game
}

View File

@@ -13,7 +13,6 @@
## To do
- Populer le details de chaque seance de jeux.
- Ajouter un systeme Multi-User "manuel" puisque ce n'est pas possible de lire le psn ID a partir de ps4-waker.
- Login (oauth?) pour fonctions (genre changer les images).

View File

@@ -153,3 +153,42 @@ a {
padding-left: 3px;
display: inline;
}
.PlaytimeDetails {
display: table;
padding-top: 10px;
padding-bottom: 5px;
padding-right: 10px;
border-radius: 4px;
}
.PlaytimeStart {
width: 140px;
display: table-cell;
}
.PlaytimeEnd {
width: 140px;
display: table-cell;
}
.PlaytimeTotal {
width: 100px;
display: table-cell;
}
.head {
font-weight: bold;
}
.row {
display: table-row;
}
.row:nth-child(even) {
background:#95b8d7;
}
.FontSmaller {
font-size: 14px;
}