-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
75 lines (74 loc) · 2.56 KB
/
index.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
<?php
require_once 'connect.php';
require_once 'functions.php';
if (!isLoggedIn()) {
$pageTitle = "Login";
include 'login.php';
die();
}
$pageTitle = "Home";
include 'header.php';
?>
<div class="time">
<h2>Timesheets</h2>
<hr>
<div class="clockButtons">
<form action='clockIn.php' method='POST'><input type='hidden' class='clockIn' name='clockIn' /><input type='submit' value='Clock In' /></form>
<form action='clockOut.php' method='POST'><input type='hidden' class='clockOut' name='clockOut' /><input type='submit' value='Clock Out' /></form><br>
</div>
<br>
<div class="float-right">
<label>Pay Period: </label>
<select id="payPeriod" onChange="getPayPeriodEntries(this.value)">
<?php
$period = getCurrentPayPeriod();
foreach ($period as $dt) {
echo "<option value='".$dt->format("Y-m-d")."'";
if ($dt->format("Y-m-d") == getCurrentPayPeriodStartDate()) {
echo " selected>".$dt->format("Y-m-d")." (Current)";
} else {
echo ">".$dt->format("Y-m-d")." (Past)";
}
echo "</option>";
}
?>
</select>
</div>
<div class="clear"></div>
<div class="message">
<?php if(isset($_GET['msg'])) {
$msg = $_GET['msg'];
if ($msg == 1) {
echo "<div class='message error'><span>Error: </span>You cannot clock out until you have first clocked in.<span class='closeAlert'>X</span></div>";
}
else if ($msg == 2) {
echo "<div class='message error'><span>Error: </span>You cannot clock in again until you have first clocked out.<span class='closeAlert'>X</span></div>";
}
else if ($msg == 3) {
echo "<div class='message success'><span>Success: </span>Time entry successfully modified.<span class='closeAlert'>X</span></div>";
}
else if ($msg == 4) {
echo "<div class='message error'><span>Error: </span>There was an error modifying your time entry.<span class='closeAlert'>X</span></div>";
}
else if ($msg == 5) {
echo "<div class='message error'><span>Error: </span>You cannot select a negative time. Your entry has not been modified.<span class='closeAlert'>X</span></div>";
}
else if ($msg == 6) {
echo "<div class='message error'><span>Error: </span>You cannot select a future time. Your entry has not been modified.<span class='closeAlert'>X</span></div>";
}
}
?>
</div>
<div id="timeEntries">
<?php include 'getPayPeriods.php'; ?>
</div>
</div>
<div class="notification">
<h2>Messages</h2>
<hr>
<?php $p = json_decode(file_get_contents('siteMessage.json')); echo "<p>".$p."</p>"; ?>
</div>
<div class="clear"></div>
<?php
include 'footer.php';
?>