Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.62 KB | None | 0 0
  1. foreach($q as $v) {
  2.     $minutes = 0;
  3.     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>";
  4.     echo "Previous Sessions: <a href='javascript:void(0);' class='toggle'>Show</a>";
  5.     echo "<div class='togglediv'><table border=1><tr><th>Start Time</th><th>End Time</th><th>Session Length</th></tr>";
  6.     foreach(getSessions($v['game_id']) as $z) {
  7.         $timeDiff = strtotime(formatTime($z['time_end'])) - strtotime(formatTime($z['time_start']));
  8.         echo "<tr><td>".formatTime($z["time_start"])."</td><td>".formatTime($z['time_end'])."</td><td>".($timeDiff/60)." minutes</td>
  9.         <td><a href='editSession.php?id=".$z['session_id']."'><i class='material-icons'>create</i></a></td>
  10.         <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>";
  11.         $minutes += $timeDiff / 60;
  12.     }
  13.     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>";
  14.     echo "</table></div>";
  15.     if(!empty(getSessions($v['game_id'])) && $v['purchase_price'] && $minutes != 0) {
  16.         echo "<br>Cost per hour: $".round($v['purchase_price']/($minutes/60),2)." | Total time played: ".round(($minutes/60),2)." hours";
  17.     } else {
  18.         echo "<br>Total time played: ".round(($minutes/60),2)." hours";
  19.     }
  20.     echo "<br><br>";
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement