-
Notifications
You must be signed in to change notification settings - Fork 0
/
index - Copy.php
70 lines (60 loc) · 3.42 KB
/
index - Copy.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
<?php include 'begin.php'; ?>
<?php $page_name = 'Home'; ?>
<?php include 'inc-page-top.php'; ?>
<div class="content-wide">
<ul id="content-ul" class="flo">
<?php if ($_SESSION['logged'] == false){ ?>
<?php include 'inc-form-login.php'; ?>
<?php } ?>
<li>
<?php
$count = 0;
$daysoff = array();;
$result_hours_list = mysql_query("SELECT requests.id as id, reason, requestedon, datebegin, dateend, timebegin, hours, status, createdby, email, password, admin FROM requests, users WHERE userid = users.id AND status='OK' ORDER BY datebegin ASC");
while($row_hours_list = mysql_fetch_array($result_hours_list)){
$hour_list_datebegin_array = explode("-", $row_hours_list['datebegin']);
$current_li_datebegin = $hour_list_datebegin_array[1]."/".$hour_list_datebegin_array[2]."/".$hour_list_datebegin_array[0];
$hour_list_dateend_array = explode("-", $row_hours_list['dateend']);
$current_li_dateend = $hour_list_dateend_array[1]."/".$hour_list_dateend_array[2]."/".$hour_list_dateend_array[0];
$li_type = ($now > $current_li_datebegin)? 'past-date': 'future-date';
//add date to array
for($x=strtotime($current_li_datebegin); $x<=strtotime($current_li_dateend); $x+=86400){
$daysoff[date("m/d/Y", $x)][] = .' - '.$row_hours_list['hours'].' starting at '.$row_hours_list['timebegin'];
}
}
?>
<ul id="calendar" class="">
<?
$startDay=false;
for ($day=-7; $day<28; $day++){
$sign = ($day>=0)? "+" : "";
$timechange = strtotime($sign." ".$day." days");
$now = date("m/d/Y", $timechange);
$weekday = date("l", $timechange);
if (!$startDay){
(($weekday == "Sunday")? $startDay=true: $startDay=false);
}
if ($startDay){
?>
<li class="<? if ($count%2==0)echo' libg '; $count++; if( ($weekday == "Sunday") || ($weekday == "Saturday") ){ echo 'weekend'; } ?>">
<div class="day"><? echo $weekday; ?></div>
<div class="date"><?php echo $now; ?></div>
<ul class="users">
<?
if (isset($daysoff[$now])){
foreach ($daysoff[$now] as $var){
echo "<li>".$var."</li>";
}
}
?>
</ul>
</li>
<?
}
}
?>
</ul>
</li>
</ul>
</div>
<?php include 'inc-page-bottom.php'; ?>