Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach($q as $v) {
- $minutes = 0;
- echo "<b>".$v['game_title']."</b> | Date purchased: ".$v['purchase_date']->format("m/d/Y")." | Cost: $".round($v['purchase_price'],2)." (<a href=''>+DLC</a>) | - ".generateButton($v['game_id'])." | <a href='removefavorite.php?id=".$v['game_id']."'>Remove from Favorites</a><br>";
- echo "Previous Sessions: <a href='javascript:void(0);' class='toggle'>Show</a>";
- echo "<div class='togglediv'><table border=1><tr><th>Start Time</th><th>End Time</th><th>Session Length</th></tr>";
- foreach(getSessions($v['game_id']) as $z) {
- $timeDiff = strtotime(formatTime($z['time_end'])) - strtotime(formatTime($z['time_start']));
- echo "<tr><td>".formatTime($z["time_start"])."</td><td>".formatTime($z['time_end'])."</td><td>".($timeDiff/60)." minutes</td>
- <td><a href='editSession.php?id=".$z['session_id']."'><i class='material-icons'>create</i></a></td>
- <td><a href='deleteSession.php?id=".$z['session_id']."' onclick='return confirm(\"Are you sure you want to delete this session?\")'><i class='material-icons'>clear</i></a></td></tr>";
- $minutes += $timeDiff / 60;
- }
- echo "<tr><td><a href='deleteGame.php?id=".$v['game_id']."' onclick='return confirm(\"Are you sure you want to delete this game? (This currently cannot be reversed)\")'>Delete Game</a></td></tr>";
- echo "</table></div>";
- if(!empty(getSessions($v['game_id'])) && $v['purchase_price'] && $minutes != 0) {
- echo "<br>Cost per hour: $".round($v['purchase_price']/($minutes/60),2)." | Total time played: ".round(($minutes/60),2)." hours";
- } else {
- echo "<br>Total time played: ".round(($minutes/60),2)." hours";
- }
- echo "<br><br>";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement