Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. $user_id = $_GET["userid"];
  2. $groupid = $_GET["group"];
  3.  
  4.  
  5. echo('<table border="1">'."n");
  6. echo('<tr><th></th>');
  7. $weekModifier = 0;
  8. $date = new DateTime();
  9.  
  10. if($date->format('N') !== 1) {
  11. $date->sub(new DateInterval('P'. $date->format('N') . 'D'));
  12. }
  13.  
  14. $interval = new DateInterval('P'.abs($weekModifier).'W');
  15.  
  16. if($weekModifier > 0) {
  17. $date->add($interval);
  18. } else {
  19. $date->sub($interval);
  20. }
  21.  
  22. for($i = 1; $i <= 7; $i++) {
  23. echo "<th>" . $date->add(new DateInterval('P1D'))->format('d-m') . "</th>";
  24. }
  25.  
  26. echo "</tr>";
  27.  
  28. $stmt = $dbh->query("SELECT fullname, name FROM people, shifts WHERE group_id=$groupid AND shift_id IN (SELECT shift_id FROM shift_assigned WHERE (user_id=$user_id AND day_id=8))");
  29.  
  30. while ( $row = $stmt->fetch(PDO::FETCH_ASSOC) ) {
  31. echo "<tr><td>";
  32. echo(htmlentities($row['fullname']));
  33. echo "</td><td>";
  34. echo(htmlentities($row['name']));
  35. echo "</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>";
  36.  
  37. }
  38. echo "</table>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement