-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabsences.php
More file actions
208 lines (183 loc) · 6.26 KB
/
Copy pathabsences.php
File metadata and controls
208 lines (183 loc) · 6.26 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<?php
// Authenticate
require("class.AuthenticationManager.php");
require("class.CommandMenu.php");
if (!$authenticationManager->isLoggedIn() || !$authenticationManager->hasAccess('aclAbsences')) {
Header('Location: login.php?clearanceRequired=' . get_acl_level('aclAbsences'));
exit;
}
//define the command menu & we get these variables from $_REQUEST:
// $month $day $year $client_id $proj_id $task_id
include("timesheet_menu.inc");
$contextUser = strtolower($_SESSION['contextUser']);
$loggedInUser = strtolower($_SESSION['loggedInUser']);
if (empty($loggedInUser))
errorPage("Could not determine the logged in user");
if (empty($contextUser))
errorPage("Could not determine the context user");
if ($authenticationManager->hasClearance(CLEARANCE_MANAGER))
$canChangeUser = true;
else
$canChangeUser = false;
if (isset($_REQUEST['uid']))
$uid = $_REQUEST['uid'];
else
$uid = $contextUser;
$action = 0;
//run the query
list($qh,$num) = get_absences($month, $year, $uid);
$ihol = 0;
//define working variables
$last_day = get_last_day($month, $year);
?>
<html>
<head>
<title>Timesheet Absence Entry</title>
<?php include ("header.inc"); ?>
<script type="text/javascript">
function onSubmit() {
//set the action
document.getElementById('action').value = 1;
document.theForm.submit();
}
</script>
</head>
<?php
echo "<body width=\"100%\" height=\"100%\"";
include ("body.inc");
echo ">\n";
include ("banner.inc");
$motd = 0; //don't want the motd printed
include ("navcal/navcal_monthly.inc");
?>
<form name="theForm" id="theForm" action="absences_action.php" method="post">
<input type="hidden" name="month" value=<?php echo $month; ?> />
<input type="hidden" name="day" value=<?php echo $day; ?> />
<input type="hidden" name="year" value=<?php echo $year; ?> />
<input type="hidden" name="last_day" value=<?php echo $last_day; ?> />
<input type="hidden" name="action" id="action" value=<?php echo $action; ?> />
<input type="hidden" name="origin" value="<?php echo $_SERVER["PHP_SELF"]; ?>" />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" class="face_padding_cell">
<!-- include the timesheet face up until the heading start section -->
<?php include("timesheet_face_part_1.inc"); ?>
<table width="100%" border="0">
<tr>
<?php if($canChangeUser) : ?>
<td align="left" width="38%" nowrap>User: <?php user_select_droplist($uid); ?></td>
<?php else : ?>
<td width="38%" nowrap>User: <?php echo "<b>$uid</b>"; ?></td>
<?php endif; ?>
<td align="center" nowrap class="outer_table_heading">
<?php echo date('F Y',mktime(0,0,0,$month, 1, $year)); ?>
</td>
<td align="right"> </td>
<td align="right">
<input type="button" value="Save Changes" name="save" id="save" onclick="onSubmit();" />
</td>
</tr>
</table>
<!-- include the timesheet face up until the heading start section -->
<?php include("timesheet_face_part_2.inc"); ?>
<table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" class="outer_table">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_body">
<tr>
<td class="calendar_cell_disabled_right"> </td>
<td align="center" class="calendar_cell_disabled_right"><b>Day</b></td>
<td align="center" class="calendar_cell_disabled_right" colspan=2 ><b>Morning</b></td>
<td align="center" class="calendar_cell_disabled_right" colspan=2 ><b>Afternoon</b></td>
</tr>
<tr>
<?php
for ($i=1;$i<=$last_day;$i++) {
$day = mktime(0,0,0,$month,$i,$year);
$dow = strftime("%A", $day);
$daystyle = "calendar_cell_middle";
if ((date('w', $day) == 6)||(date('w', $day) == 0)) {
$daystyle = "calendar_cell_holiday_middle";
}
$AM_text = "";
$PM_text = "";
$AM_type = '';
$PM_type = '';
$AMstyle = $daystyle;
$PMstyle = $daystyle;
// first try for AM absences
if ($ihol<$num) {
$absdata = dbResult($qh,$ihol);
if ($i==$absdata['day_of_month']) {
if ($absdata['AM_PM']=='AM')
{
$AM_text = urldecode($absdata['subject']);
$AM_type = $absdata['type'];
$AMstyle = "calendar_cell_holiday_middle";
$ihol++;
}
else if ($absdata['AM_PM']=='day')
{
$AM_text = urldecode($absdata['subject']);
$AM_type = $absdata['type'];
$AMstyle = "calendar_cell_holiday_middle";
// don't increment
}
}
}
// second try for PM absences
if ($ihol<$num) {
$absdata = dbResult($qh,$ihol);
if ($i==$absdata['day_of_month']) {
if ($absdata['AM_PM']=='PM')
{
$PM_text = urldecode($absdata['subject']);
$PM_type = $absdata['type'];
$PMstyle = "calendar_cell_holiday_middle";
$ihol++;
}
else if ($absdata['AM_PM']=='day')
{
$PM_text = urldecode($absdata['subject']);
$PM_type = $absdata['type'];
$PMstyle = "calendar_cell_holiday_middle";
// now increment
$ihol++;
}
}
}
if (($AM_type=='Public')&&($PM_type=='Public')) {
$daystyle = "calendar_cell_holiday_middle";
}
if ($daystyle == "calendar_cell_holiday_middle")
$disabled = 'true';
else
$disabled = 'false';
?>
<td align="center" class="<?php echo $daystyle; ?>"><?php echo $dow; ?></td>
<td align="center" class="<?php echo $daystyle; ?>"><?php echo $i; ?></td>
<td align="right" class="<?php echo $AMstyle; ?>"><?php absence_select_droplist($AM_type, $disabled, "AMtype".$i); ?></td>
<td align="left" class="<?php echo $AMstyle; ?>"><input type="text" id="<?php echo "AMtext",$i; ?>" name="<?php echo "AMtext",$i; ?>" class="<?php echo $AMstyle; ?>" value="<?php echo $AM_text; ?>" <?php if ($disabled=='true') echo "readonly"; ?> /></td>
<td align="right" class="<?php echo $PMstyle; ?>"><?php absence_select_droplist($PM_type, $disabled, "PMtype".$i); ?></td>
<td align="left" class="<?php echo $PMstyle; ?>"><input type="text" id="<?php echo $i,"_PMtext"; ?>" name="<?php echo "PMtext",$i; ?>" class="<?php echo $PMstyle; ?>" value="<?php echo $PM_text; ?>" <?php if ($disabled=='true') echo "readonly"; ?> /></td>
</tr>
<?php
}
?>
</tr>
</td>
</table>
</td>
</tr>
</table>
<!-- include the timesheet face up until the end -->
<?php include("timesheet_face_part_3.inc"); ?>
</td>
</tr>
</table>
</form>
<?php
include ("footer.inc");
?>
</body>
</html>