Commit 62f685f0 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Added user selection to vw_idx_inc.php. This makes it possible to view the...

Added user selection to vw_idx_inc.php. This makes it possible to view the timesheets of other people besides those of yourself. This feature is not restricted to the admin.
parent a93fa7d4
......@@ -6,16 +6,12 @@
// we check for permissions on this module
$canRead = !getDenyRead( $m ); // retrieve module-based readPermission bool flag
$canEdit = !getDenyEdit( $m ); // retrieve module-based writePermission bool flag
// lock out users that do not have at least readPermission on this module
if (!$canRead) {
$AppUI->redirect( "m=public&a=access_denied" );
}
//save the workplace state (have a footprint on this site)
$AppUI->savePlace();
// retrieve any state parameters (temporary session variables that are not stored in db)
// saves the current tab box state
if (isset( $_GET['tab'] )) {
$AppUI->setState( 'TimesheetIdxTab', $_GET['tab'] );
......
......@@ -27,11 +27,11 @@ if (@$a == 'setup') {
class CSetupTimesheet {
function configure() { // configure this module
global $AppUI;
$AppUI->redirect( 'm=timesheet&a=configure' ); // load module specific configuration page
return true;
}
// function configure() { // configure this module
// global $AppUI;
// $AppUI->redirect( 'm=timesheet&a=configure' ); // load module specific configuration page
// return true;
// }
function remove() {
$q = new DBQuery;
......
......@@ -19,7 +19,27 @@ if (!$canRead) { // lock out users that do not have at least readPermission on
<th nowrap="nowrap">&nbsp;</th>
</tr>
<?php
//Pull all users
// Retrieve the list of users that may access this module.
if(isset($_REQUEST["user_filter_id"])){
$AppUI->setState("user_filter_id", $_REQUEST["user_filter_id"]);
$user_filter_id = $_REQUEST["user_filter_id"];
} else {
$user_filter_id = $AppUI->getState( 'user_filter_id');
if (! isset($user_filter_id)) {
$user_filter_id = $AppUI->user_id;
$AppUI->setState('user_filter_id', $user_filter_id);
}
}
$perms =& $AppUI->acl();
$user_list = array( 0 => $AppUI->_("All", UI_OUTPUT_RAW)) + $perms->getPermittedUsers("timesheet"); // db_loadHashList($sql);
$user_combo = arraySelect($user_list, "user_filter_id", "class='text' onchange='javascript:document.searchform.submit()'", $user_filter_id, false);
echo "<tr><form name='searchform' action='?m=timesheet' method='post'>
".$AppUI->_("Show timesheets for ").": $user_combo
</form></tr>";
// Pull all users
$q = new DBQuery;
$q->addQuery('user_id, contact_first_name, contact_last_name');
$q->addTable('users');
......@@ -31,11 +51,18 @@ $users = array();
while ( $row = $q->fetchRow()) {
$users[$row['user_id']] = $row['contact_last_name'] . ', ' . $row['contact_first_name'];
}
$q->Clear();
$q->Clear();
$q->addQuery('timesheet_id, timesheet_date, timesheet_status, timesheet_period, timesheet_creator, timesheet_worked');
$q->addTable('timesheet');
$q->addWhere('timesheet_creator = ' . $AppUI->user_id );
if ($user_filter_id > 0) {
$q->addWhere('timesheet_creator = ' . $user_filter_id );
}
else {
$q->addOrder('timesheet_creator');
}
$q->addOrder('timesheet_period');
if ($type >= 0)
$q->addWhere('timesheet_status = '. $type );
$month = $q->loadList();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment