Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
    exit(0);
}
$ts = new nexTime();
$T = new Template($CONF_NEXTIME['template_path']);
$T->set_file(array('javascript' => 'nextime.js.thtml', 'approvalpage' => 'approve.thtml'));
$T->set_var('site_url', $_CONF['site_url']);
$T->set_var($LANG_NEXTIME);
$T->set_var('allfields', $ts->getTableColumns('nextime_timesheet_entry'));
$T->set_var('start_date', $start_date);
$T->set_var('end_date', $end_date);
$T->set_var('emp', $emp);
$T->set_var('disable', "display:none");
$T->set_var('disable_on_lock', " readonly ");
$T->set_var('comment_disable', '');
$T->set_var('comment_edit_disable', '');
$adjustment_save = $ts->determineIfItemIsInLockRangeByDateStamp($startStamp, $emp) ? '_adj' : '';
$T->set_var('adj_postfix', $adjustment_save);
$T->parse('output', 'javascript');
if ($hideapproved) {
    $T->set_var('hidefullyapproved_check', 'checked');
}
if ($emp > 0) {
    //specific user
    //first, detect if they should be seeing this user's timesheets
    $shouldBeApproving = $ts->testIfUserCanApprove($uid, $emp);
    if (!$shouldBeApproving) {
        echo $LANG_NEXTIME['should_not_be_approving'];
        echo COM_siteFooter();
        exit(0);
    }
    if ($showAsTimesheet == 1) {
Exemplo n.º 3
0
$endStamp = strtotime($end_date);
$numberOfDays = intval(($endStamp - $startStamp) / 60 / 60 / 24) + 1;
if ($endStamp < $startStamp) {
    //Hey! You can't have an end date thats less than the start date...
    echo '<br><br><a href="index.php">' . $LANG_NEXTIME['end_date_before_start'];
    echo $LANG_NEXTIME['back_link_label'] . '</a>';
    echo COM_siteFooter();
    exit(0);
}
$ts = new nexTime();
$T = new Template($CONF_NEXTIME['template_path']);
$T->set_file(array('page' => 'entry.thtml', 'javascript' => 'nextime.js.thtml'));
$T->set_var('site_url', $_CONF['site_url']);
$T->set_var($LANG_NEXTIME);
$T->set_var('allfields', $ts->getTableColumns('nextime_timesheet_entry'));
$T->set_var('start_date', $start_date);
$T->set_var('end_date', $end_date);
$T->set_var('emp', $_USER['uid']);
$T->set_var('approved_by', $_USER['uid']);
$T->parse('output', 'javascript');
$output = '';
$output .= $ts->generateTableHeader(false, false, $ts->determineIfItemIsInLockRangeByDateStamp($startStamp, $uid));
$retval = $ts->generateTimesheetRows($uid, $startStamp, $numberOfDays);
$output .= $retval[1];
$output .= $ts->generateTableFooter(false, $retval[2], $retval[3], $retval[4], $retval[5], $ts->determineIfItemIsInLockRangeByDateStamp($startStamp, $uid));
$output .= $ts->generateTotalRowCount($retval[0]);
$T->set_var('timesheet', $output);
$T->parse('output', 'page', true);
echo $T->finish($T->get_var('output'));
echo "<br>";
echo COM_siteFooter();