diff --git a/class.php b/class.php index 72203cd..c113345 100644 --- a/class.php +++ b/class.php @@ -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 '
'; + echo '
Start
End
Time Played
'; while ($row = $result->fetch_assoc()) { - $i++; - echo "
"; - 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 "
"; + echo '
'; + $i++; + echo '
'. $this->secondsToDate($row["game_start"]) .'
'; + echo '
'. $this->secondsToDate($row["game_end"]) .'
'; + echo '
'; + if ($row["game_end"] == "") { + echo "now playing"; + } else { + echo $this->playtime((($row["game_end"]-$row["game_start"])/1000),true); + } + echo '
'; + echo '
'; } + echo '
'; } } diff --git a/index.php b/index.php index aea0cd4..ada0eff 100644 --- a/index.php +++ b/index.php @@ -27,7 +27,7 @@ $details = isset($_GET['details']) ? $_GET['details'] : ""; function update() { $.get('page.php?rootpage=&orderby=&details=', function(data) { $("#page").html(data); - window.setTimeout(update, 10000); // 10 secondes + //window.setTimeout(update, 10000); // 10 secondes }); } diff --git a/page.php b/page.php index ecc097d..4542cd3 100644 --- a/page.php +++ b/page.php @@ -92,10 +92,12 @@ foreach ($games as $key => $value) { } echo ""; + echo ""; // info + if ($details == $games[$key]["game_id"]) { $ps4->gameTimeDetails($games[$key]["game_id"]); } - echo ""; // info + echo ""; // game } diff --git a/readme.md b/readme.md index 2cd5128..10555c8 100644 --- a/readme.md +++ b/readme.md @@ -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). diff --git a/style.css b/style.css index da18103..9b32161 100644 --- a/style.css +++ b/style.css @@ -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; +}