-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweek.php
77 lines (63 loc) · 2.17 KB
/
week.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
require_once "lib/autoload.php";
$css = array( "style.css" );
$VS->BasicHead( $css );
$MS->ShowMessages();
?>
<body>
<div class="jumbotron text-center">
<h1>Weekoverzicht</h1>
</div>
<?php $VS->PrintNavBar( $Container->getDBM() ); ?>
<div class="container">
<div class="row">
<?php
$year = (isset($_GET['year'])) ? $_GET['year'] : date("Y");
$week = (isset($_GET['week'])) ? $_GET['week'] : date("W");
if ($week > 52)
{
$year++;
$week = 1;
}
elseif ($week < 1)
{
$year--;
$week = 52;
}
?>
<table class="table">
<tr>
<th>Weekdag</th>
<th>Datum</th>
<th>Taken</th>
</tr>
<?php
if( isset($_GET['week']) AND $week < 10 ) { $week = '0' . $week; }
for( $day=1; $day <= 7; $day++ )
{
$d = strtotime($year . "W" . $week . $day);
$sqldate = date("Y-m-d", $d);
$sql = "SELECT taa_omschr FROM taak WHERE taa_datum = '".$sqldate."'" ;
$data = $Container->getDBM()->GetData($sql);
$taken = array();
foreach( $data as $row )
{
$taken[] = $row['taa_omschr'];
}
$takenlijst = "<ul><li>" . implode( "</li><li>" , $taken ) . "</li></ul>";
echo "<tr>";
echo "<td>" . date("l", $d). "</td>";
echo "<td>" . date("d/m/Y", $d). "</td>";
echo "<td>" . $takenlijst . "</td>";
echo "</tr>" ;
}
echo "</table>";
$link_vorige = "week.php?week=" . ($week == 1 ? 52 : $week - 1 ) . "&year=" . ($week == 1 ? $year - 1 : $year);
$link_volgende = "week.php?week=" . ($week == 52 ? 1 : $week + 1 ) . "&year=" . ($week == 52 ? $year + 1 : $year);
echo "<a href=$link_vorige>Vorige Week</a> ";
echo "<a href=$link_volgende>Volgende Week</a> ";
?>
</div>
</div>
</body>
</html>