2014-09-05 21:26:26 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once('config.php');
|
2014-09-05 23:23:54 +04:00
|
|
|
require_once('auth.php');
|
2014-09-05 21:26:26 +04:00
|
|
|
|
2014-10-02 19:40:15 +04:00
|
|
|
function pretty_die() {
|
2017-02-14 19:06:54 +03:00
|
|
|
global $GLOBAL_AUTH_USERNAME;
|
2014-10-02 19:40:15 +04:00
|
|
|
include './templates/header.php';
|
|
|
|
echo 'There was a problem getting your PTO records. Please try again later.';
|
|
|
|
include './templates/footer.php';
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2017-02-14 19:06:54 +03:00
|
|
|
$me = $GLOBAL_AUTH_USERNAME;
|
2014-09-05 21:26:26 +04:00
|
|
|
|
2014-10-02 19:40:15 +04:00
|
|
|
$conn = @mysql_connect($mysql['host'], $mysql['user'], $mysql['password'])
|
|
|
|
or pretty_die();
|
2014-09-05 21:26:26 +04:00
|
|
|
|
2014-10-02 19:55:16 +04:00
|
|
|
@mysql_select_db($mysql['database'], $conn) or pretty_die();
|
2014-09-05 21:26:26 +04:00
|
|
|
|
2014-10-02 19:40:15 +04:00
|
|
|
$query = "select
|
|
|
|
added,
|
|
|
|
start,
|
|
|
|
end,
|
|
|
|
details
|
|
|
|
from pto
|
2014-10-02 19:55:16 +04:00
|
|
|
where person = '".mysql_real_escape_string($me, $conn)."'
|
2014-10-02 19:40:15 +04:00
|
|
|
order by start desc";
|
2014-09-05 21:26:26 +04:00
|
|
|
|
2014-10-02 19:55:16 +04:00
|
|
|
$result = @mysql_query($query, $conn) or pretty_die();
|
2014-09-05 21:26:26 +04:00
|
|
|
|
2014-10-02 19:40:15 +04:00
|
|
|
$mypto = array();
|
|
|
|
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
|
|
|
$row['added'] = date('D, d M Y', $row['added']);
|
|
|
|
$row['start'] = date('D, d M Y', $row['start']);
|
|
|
|
$row['end'] = date('D, d M Y', $row['end']);
|
|
|
|
$mypto[] = $row;
|
2014-09-05 21:26:26 +04:00
|
|
|
}
|
|
|
|
|
2014-10-02 19:40:15 +04:00
|
|
|
mysql_free_result($result);
|
|
|
|
mysql_close($conn);
|
|
|
|
|
2014-10-03 21:24:17 +04:00
|
|
|
$i = 0;
|
2014-09-05 21:26:26 +04:00
|
|
|
$mypto_table_contents = '';
|
|
|
|
foreach ($mypto as $row) {
|
2014-10-03 02:48:49 +04:00
|
|
|
// adding some row colours
|
|
|
|
$i++;
|
2014-10-03 21:24:17 +04:00
|
|
|
if ($i%2 == 0) {
|
|
|
|
$mypto_table_contents .= '<tr class="highlight">';
|
2014-10-03 02:48:49 +04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$mypto_table_contents .= '<tr>';
|
|
|
|
}
|
|
|
|
|
2014-09-05 21:26:26 +04:00
|
|
|
foreach($row as $value) {
|
|
|
|
$mypto_table_contents .= '<td>'.$value.'</td>';
|
|
|
|
}
|
|
|
|
$mypto_table_contents .= '</tr>';
|
|
|
|
}
|
|
|
|
|
2014-09-05 23:23:54 +04:00
|
|
|
include './templates/header.php';
|
2014-09-05 21:26:26 +04:00
|
|
|
?>
|
|
|
|
<div class='pto_table_container'>
|
|
|
|
<h2>My Reported PTO</h2>
|
|
|
|
<table id='mypto_table' class='display'>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2014-10-03 21:51:51 +04:00
|
|
|
<th class='datetime'>Added</th>
|
|
|
|
<th class='datetime'>Start</th>
|
|
|
|
<th class='datetime'>End</th>
|
2014-10-03 21:55:42 +04:00
|
|
|
<th>Details</th>
|
2014-09-05 21:26:26 +04:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2015-03-09 23:10:17 +03:00
|
|
|
<?php echo $mypto_table_contents; ?>
|
2014-09-05 21:26:26 +04:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php
|
2014-09-05 23:23:54 +04:00
|
|
|
include './templates/footer.php';
|