forked from ewic/php_timeclock
/
manage_timecards.php
86 lines (73 loc) · 2.14 KB
/
manage_timecards.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
78
79
80
81
82
83
84
85
86
<?php
ob_start(); // Output buffering - allows header rewrites to happen at anytime before flushing the buffer
session_start();
require_once("incdir.php.inc");
require_once("config.php");
include_php_dir("includes");
mysql_init();
document_header();
echo include_javascript_dir("js",$debug);
echo include_stylesheet_dir("stylesheets",$debug);
check_validated();
//Any pre-page logic should go here!
open_page("Timecards");
draw_page();
close_page();
ob_end_flush(); // Flush the buffer out to client
document_footer(); mysql_end();
function draw_page()
{
?>
<div class="container">
<?php open_panel('userlist','Users'); ?>
<?php draw_userlist(); ?>
<?php close_panel(); ?>
</div>
<?
}
function draw_userlist() {
$supers = get_users('super');
$users = get_users('user');
?>
<table class="userlist table table-condensed">
<tr>
<th>Last Name</th>
<th>First Name</th>
<th>Username</th>
</tr>
<?php
while ($row = $supers->fetch_array()) {
$row['role'] = 'super';
echo '<tr class="userlist ';
echo 'userlist-'.$row['role'];
if ($row['inactive'])
echo ' userlist-inactive';
echo '" onclick="openTimecard('.$row['user_id'].')">';
echo '<td>'.$row['lname']."</td>";
echo '<td>'.$row['fname']."</td>";
echo '<td>'.$row['username']."</td>";
echo '</tr>';
}
while ($row = $users->fetch_array()) {
$row['role'] = 'user';
echo '<tr class="userlist ';
echo 'userlist-'.$row['role'];
if ($row['inactive'])
echo ' userlist-inactive';
echo '" onclick="openTimecard('.$row['user_id'].')">';
echo '<td>'.$row['lname']."</td>";
echo '<td>'.$row['fname']."</td>";
echo '<td>'.$row['username']."</td>";
echo '</tr>';
}
?>
</table>
<?php
}
?>
<!-- popup javascript -->
<script type="text/javascript">
function openTimecard(id) {
window.open('timecard.php?user_id='+id,'_blank','height=540,width=680,menubar=no,status=no,titlebar=no,toolbar=no');
}
</script>