function generateTimesheet($uid = 0, $disabled = false, $isapproval = false, $forWhichUser = 0) { global $startStamp, $numberOfDays, $_USER; if ($uid == 0) { $uid = $_USER['uid']; } if ($forWhichUser != 0) { $uid = $forWhichUser; } $ts = new nexTime(); $output = ''; $output .= $ts->generateTableHeader($disabled, $isapproval, $ts->determineIfItemIsInLockRangeByDateStamp($startStamp, $uid)); $retval = $ts->generateTimesheetRows($uid, $startStamp, $numberOfDays, NULL, 0, $disabled, $isapproval); $output .= $retval[1]; $output .= $ts->generateTableFooter($isapproval, $retval[2], $retval[3], $retval[4], $retval[5], $ts->determineIfItemIsInLockRangeByDateStamp($startStamp, $uid)); $output .= $ts->generateTotalRowCount($retval[0]); return $output; }
$shouldBeApproving = $ts->testIfUserCanApprove($uid, $emp); if (!$shouldBeApproving) { echo $LANG_NEXTIME['should_not_be_approving']; echo COM_siteFooter(); exit(0); } if ($showAsTimesheet == 1) { $output = ''; if (SEC_inGroup('nexTime Finance') && !SEC_inGroup('Root')) { //disable it all $T->set_var('comment_disable', ' disabled '); $T->set_var('comment_edit_disable', 'display:none'); $output .= $ts->generateTableHeader(true, true, $ts->determineIfItemIsInLockRangeByDateStamp($startStamp, $emp)); $retval = $ts->generateTimesheetRows($emp, $startStamp, $numberOfDays, null, 0, true, true); $output .= $retval[1]; $output .= $ts->generateTableFooter(true, $retval[2], $retval[3], $retval[4], $retval[5], $ts->determineIfItemIsInLockRangeByDateStamp($startStamp, $emp)); $output .= $ts->generateTotalRowCount($retval[0]); } else { //enable the timesheet for editing $output .= $ts->generateTableHeader(false, true, $ts->determineIfItemIsInLockRangeByDateStamp($startStamp, $emp)); $retval = $ts->generateTimesheetRows($emp, $startStamp, $numberOfDays, null, 0, false, true); $output .= $retval[1]; if ($ts->determineIfItemIsInLockRangeByDateStamp($startStamp, $emp)) { $output .= $ts->generateTableFooter(true, $retval[2], $retval[3], $retval[4], $retval[5], $ts->determineIfItemIsInLockRangeByDateStamp($startStamp, $emp)); } else { $output .= $ts->generateTableFooter(false, $retval[2], $retval[3], $retval[4], $retval[5], $ts->determineIfItemIsInLockRangeByDateStamp($startStamp, $emp)); } $output .= $ts->generateTotalRowCount($retval[0]); } $T->set_var('approval_rows', $output); $T->set_var('approval_all_table_style', 'display:none');