function openBlock($strTitle, $strLinks, $attributes = null)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    echoT(strOpenBlock($strTitle, $strLinks, $attributes));
}
Example #2
0
 public function openDivBlock($strText, $bCollapseHeadings, $bCollapseDefaultHide, $strDivID, $strDivImgID, $lWidth)
 {
     //---------------------------------------------------------------------
     // note: width must be less than the container table, or things
     // dance around when expanded
     //---------------------------------------------------------------------
     $strOut = '';
     if ($bCollapseHeadings) {
         if ($this->divBlock->bTableOpen) {
             $strOut .= $this->closeReport();
         }
         $attributes = new stdClass();
         $attributes->lTableWidth = $lWidth;
         $attributes->lMarginLeft = 15;
         $attributes->divID = $strDivID;
         $attributes->divImageID = $strDivImgID;
         $attributes->bStartOpen = !$bCollapseDefaultHide;
         $strOut .= strOpenBlock($strText, '', $attributes);
         $strOut .= $this->openReport();
         $this->divBlock->bDivStarted = true;
     } else {
         $strOut .= $this->openRow() . $this->writeLabel('<br>' . $strText, 'x', 'text-align: left; border-bottom: 1px solid black;', 2) . $this->closeRow();
     }
     return $strOut;
 }
function strUserGroupsBlock($lUserID, $cdir)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    if ($cdir->bAdmin || $cdir->bVolAccount) {
        return 'n/a';
    }
    $strOut = '';
    $attributes = new stdClass();
    $attributes->lTableWidth = 200;
    $attributes->divID = 'ug_' . $lUserID;
    $attributes->divImageID = 'ug_' . $lUserID . 'DivImg';
    $attributes->lUnderscoreWidth = 200;
    $attributes->lTitleFontSize = 10;
    $attributes->bAddTopBreak = false;
    $strOut .= strOpenBlock('User Groups (' . $cdir->userGroups->lNumUserGroups . ')', '', $attributes);
    if ($cdir->userGroups->lNumUserGroups > 0) {
        foreach ($cdir->userGroups->groups as $ugroup) {
            $strOut .= htmlspecialchars($ugroup->strGroupName) . '<br>' . "\n";
        }
    }
    $attributes->bCloseDiv = true;
    $strOut .= strCloseBlock($attributes) . '<br>';
    return $strOut;
}
function strTSTLogOverviewBlock(&$clsRpt, &$tst, &$logRec, $bAllowSubmit, $bAllProjHrsEdit)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    global $genumDateFormat;
    $lTSLogID = $logRec->lKeyID;
    $lMinutesTot = $logRec->lMinutesTot;
    $lMinutesTotProj = $logRec->lMinutesTotProj;
    $bMinutesMatch = abs($lMinutesTot - $lMinutesTotProj) < 0.1;
    $bSubmitted = !is_null($logRec->dteSubmitted);
    $strLinkProjects = '';
    if ($bSubmitted) {
        $strSubmitted = 'Submitted on ' . date($genumDateFormat . ' H:i:s', $logRec->dteSubmitted);
    } else {
        $strSubmitted = 'Not submitted';
        if ($bAllProjHrsEdit) {
            $strLinkProjects = '&nbsp;' . strLinkEdit_TSLogToProjects($lTSLogID, 'Assign hours to projects', true);
        }
        if ($bAllowSubmit) {
            if ($bMinutesMatch && $lMinutesTot > 0) {
                $strSubmitted .= '<br>' . form_open('staff/timesheets/ts_log_edit/ts_submit/' . $lTSLogID) . "\n" . '<div style="width: 300pt; border: 1px solid black; padding: 3px; margin-top: 3px;">' . form_hidden('forceSubmit', 'makeItSo') . "\n" . '<input type="checkbox" name="chkIAgree" value="true">' . "\n" . nl2br(htmlspecialchars($tst->strAckText)) . "<br><br>\n" . '<input type="submit"
                     class="btn" onmouseover="this.className=\'btn btnhov\'" onmouseout="this.className=\'btn\'"
                     value="Submit Time Sheet"><br>
                     <i>Once submitted, you can only make changes through
                     your system administrator.</i></div>' . "\n" . form_close();
            } elseif (!$bMinutesMatch) {
                $strSubmitted .= '<br>
                  <div style="color: red; width: 300pt; border: 1px solid red; padding: 3px; margin-top: 3px;">
                     Your <b>Total Hours</b> for this time period does not match the <b>Hours Assigned to Projects</b>.
                     These hours must be equal before you can submit your time sheet.
                  </div>';
            }
        }
    }
    $strOut = strOpenBlock(date('F jS, Y', $logRec->dteTSEntry) . ': Time Sheet for ' . htmlspecialchars($logRec->strUserFName . ' ' . $logRec->strUserLName), '');
    $strOut .= $clsRpt->openReport();
    $strOut .= $clsRpt->openRow() . $clsRpt->writeLabel('Time Sheet Template:', '', 'vertical-align: bottom;') . $clsRpt->writeCell(htmlspecialchars($logRec->strTSName)) . $clsRpt->closeRow();
    $strOut .= $clsRpt->openRow() . $clsRpt->writeLabel('Reporting Frequency:', '') . $clsRpt->writeCell($logRec->enumRptPeriod) . $clsRpt->closeRow();
    $strOut .= $clsRpt->openRow() . $clsRpt->writeLabel('Total Hours:', '') . $clsRpt->writeCell(strDurationViaMinutes($lMinutesTot)) . $clsRpt->closeRow();
    $strOut .= $clsRpt->openRow() . $clsRpt->writeLabel('Project Hours Assigned:', '') . $clsRpt->writeCell(strDurationViaMinutes($lMinutesTotProj) . $strLinkProjects) . $clsRpt->closeRow();
    $strOut .= $clsRpt->openRow() . $clsRpt->writeLabel('Status:', '') . $clsRpt->writeCell($strSubmitted) . $clsRpt->closeRow();
    $strOut .= $clsRpt->closeReport();
    $strOut .= strCloseBlock();
    return $strOut;
}
 private function strBeginCollapsibleHeading($lTableID, $strSafeTableName, $bSingleEntry)
 {
     $strOut = '';
     $attributes = new stdClass();
     $attributes->lTableWidth = null;
     $attributes->lMarginLeft = 15;
     $attributes->divID = 'ut_' . $lTableID . 'Div';
     $attributes->divImageID = 'ut_' . $lTableID . 'ImgDiv';
     $strOut .= strOpenBlock($strSafeTableName . ' <i>(' . ($bSingleEntry ? 'Single ' : 'Multi-') . 'entry)</i>', '', $attributes);
     return $strOut;
 }
function showUserField(&$clsForm, &$ufield, &$errMessages)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    global $gbInDiv, $gdivAtt;
    $enumType = $ufield->enumFieldType;
    $strFN = $ufield->strFieldNameInternal;
    $clsForm->strExtraFieldText = '';
    $strFieldLabel = htmlspecialchars($ufield->pff_strFieldNameUser);
    $bRequired = $ufield->pff_bRequired;
    $strValue = @$ufield->txtValue;
    $bText = $enumType == CS_FT_TEXT255 || $enumType == CS_FT_TEXT80 || $enumType == CS_FT_TEXT20 || $enumType == CS_FT_TEXTLONG;
    //      $clsForm->strExtraFieldText = '';
    if ($ufield->strFieldNotes != '') {
        $clsForm->strExtraFieldText .= '<br><i>' . nl2br(htmlspecialchars($ufield->strFieldNotes)) . '</i>';
    }
    if ($bText) {
        $clsForm->strExtraFieldText .= form_error($strFN);
        //         if (isset($errMessages[$strFN])) $clsForm->strExtraFieldText .= $errMessages[$strFN];
    }
    if (isset($errMessages[$strFN])) {
        $clsForm->strExtraFieldText .= $errMessages[$strFN];
    }
    switch ($enumType) {
        case CS_FT_CHECKBOX:
            //            if (isset($errMessages[$strFN])) $clsForm->strExtraFieldText .= $errMessages[$strFN];
            echoT($clsForm->strGenericCheckEntry($strFieldLabel, $strFN, 'true', false, $ufield->bChecked));
            break;
        case CS_FT_DATE:
            //            if (isset($errMessages[$strFN])) $clsForm->strExtraFieldText .= $errMessages[$strFN];
            echoT($clsForm->strGenericDatePicker($strFieldLabel, $strFN, $bRequired, $strValue, 'frmPTable', $strFN));
            break;
        case CS_FT_TEXT255:
            echoT($clsForm->strGenericTextEntry($strFieldLabel, $strFN, $bRequired, $strValue, 60, 255));
            break;
        case CS_FT_TEXT80:
            echoT($clsForm->strGenericTextEntry($strFieldLabel, $strFN, $bRequired, $strValue, 60, 80));
            break;
        case CS_FT_TEXT20:
            echoT($clsForm->strGenericTextEntry($strFieldLabel, $strFN, $bRequired, $strValue, 20, 20));
            break;
        case CS_FT_HEADING:
            $strBlock = '</table>';
            if ($gbInDiv) {
                $gdivAtt->bCloseDiv = true;
                $strBlock .= "\n" . strCloseBlock($gdivAtt);
            }
            $gdivAtt->bCloseDiv = false;
            //</div><!-- hello, world! --><table class="enpView" >'."\n");
            $gbInDiv = true;
            $gdivAtt->divID = $strFN . 'Div';
            $gdivAtt->divImageID = $strFN . 'DivImg';
            $strBlock .= strOpenBlock($strFieldLabel, '', $gdivAtt) . "\n" . '<table class="enpView">';
            echoT($strBlock);
            break;
        case CS_FT_TEXTLONG:
            echoT($clsForm->strNotesEntry($strFieldLabel, $strFN, $bRequired, $strValue, 3, 56));
            break;
        case CS_FT_LOG:
            break;
        case CS_FT_CLIENTID:
            //            if (isset($errMessages[$strFN])) $clsForm->strExtraFieldText .= $errMessages[$strFN];
            echoT($clsForm->strGenericTextEntry($strFieldLabel, $strFN, $bRequired, $strValue, 3, 10));
            break;
        case CS_FT_INTEGER:
            $clsForm->strExtraFieldText .= form_error($strFN);
            //            if (isset($errMessages[$strFN])) $clsForm->strExtraFieldText .= $errMessages[$strFN];
            echoT($clsForm->strGenericTextEntry($strFieldLabel, $strFN, $bRequired, $strValue, 3, 10));
            break;
        case CS_FT_CURRENCY:
            $clsForm->strExtraFieldText .= '';
            $clsForm->strTextBoxPrefix = $ufield->pff_strCurrencySymbol;
            $clsForm->strExtraFieldText .= $ufield->pff_strFlagImg;
            //            if (isset($errMessages[$strFN])) $clsForm->strExtraFieldText .= $errMessages[$strFN];
            echoT($clsForm->strGenericTextEntry($strFieldLabel, $strFN, $bRequired, $strValue, 8, 14));
            $clsForm->strTextBoxPrefix = $clsForm->strExtraFieldText = '';
            break;
        case CS_FT_DDL:
            //            if (isset($errMessages[$strFN])) $clsForm->strExtraFieldText .= $errMessages[$strFN];
            echoT($clsForm->strLabelRow($strFieldLabel . ($bRequired ? '*' : ''), $ufield->strDDL, 1));
            break;
        case CS_FT_DDLMULTI:
            $clsForm->strExtraFieldText .= '<br><font style="font-size: 7pt;"><i>CTRL-Click to select more than one entry</i></font>';
            //            if (isset($errMessages[$strFN]))  $clsForm->strExtraFieldText .= $errMessages[$strFN];
            echoT($clsForm->strLabelRow($strFieldLabel . ($bRequired ? '*' : ''), $ufield->strDDLMulti, 1));
            break;
        default:
            screamForHelp($enumType . ': unexpected field type<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
            break;
    }
}