function showClientPrograms($lClientID, $lNumCProgs, $cProgs) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- global $genumDateFormat; $attributes = new stdClass(); $attributes->divID = 'clientProgs'; $attributes->divImageID = 'clientProgsDivImg'; $attributes->bStartOpen = false; $attributes->lTableWidth = 1100; $attributes->lUnderscoreWidth = 350; openBlock('Programs <span style="font-size: 9pt;">(' . $lNumCProgs . ')</span>', '', $attributes); $attributes->lTableWidth = 900; $attributes->lUnderscoreWidth = 373; $attributes->lTitleFontSize = 10; foreach ($cProgs as $cprog) { if ($cprog->bShowCProgLink) { $lCProgID = $cprog->lKeyID; // set up link to utility that allows the user to // reassign an attendance to a different enrollment $strLinkMoveAttend = ''; $lNumEnroll = $cprog->lNumEnrollments; if ($lNumEnroll > 1) { if ($cprog->lTotAttend > 0) { $strLinkMoveAttend = strLinkUtil_CProgMoveAttend($lClientID, $lCProgID, 'Transfer attendance between enrollments', true) . ' ' . strLinkUtil_CProgMoveAttend($lClientID, $lCProgID, 'Transfer attendance between enrollments', false); } } $strOut = ''; $strProgSafeName = htmlspecialchars($cprog->strProgramName); $attributes->divID = 'clientProg' . $lCProgID; $attributes->divImageID = 'clientProg' . $lCProgID . 'DivImg'; $attributes->bCloseDiv = false; // it's the little things that make a house a home openBlock($strProgSafeName . ' <span style="font-size: 9pt;">(' . $lNumEnroll . ' enrollment' . ($lNumEnroll == 1 ? '' : 's') . ')</span>', '', $attributes); $strOut .= '<b><span style="vertical-align: bottom;"> ' . $strProgSafeName . '</b>' . "\n"; if ($cprog->bEnrolled) { $strOut .= '<br>Currently enrolled:<br> <ul style="margin-top: 0px;">'; $lETableID = $cprog->lEnrollmentTableID; $lATableID = $cprog->lAttendanceTableID; $bAnyActiveEnrollment = false; foreach ($cprog->erecs as $erec) { $lERecID = $erec->lKeyID; $bCurrentlyEnrolled = $erec->bCurrentlyEnrolled; if ($bCurrentlyEnrolled) { $bAnyActiveEnrollment = true; } $strOut .= '<li style="margin-bottom: 6px;">' . ($bCurrentlyEnrolled ? '<font>' : '<font style="color: #999;">') . strLinkView_UFMFRecordViaRecID($lETableID, $lClientID, $lERecID, 'View enrollment record', true) . ' ' . date($genumDateFormat, $erec->dteStart) . ' - '; if (is_null($erec->dteMysqlEnd)) { $strOut .= '<i>ongoing</i>' . "\n"; } else { $strOut .= date($genumDateFormat, $erec->dteEnd); } if (!$bCurrentlyEnrolled) { $strOut .= ' <i>(inactive)</i>'; } if ($erec->lNumAttend > 0) { $strViewA = ' ' . strLinkView_UFMFRecordsViaFID(CENUM_CONTEXT_CLIENT, $lATableID, $lClientID, 'View attendance records', true, '', $lERecID) . ' '; } else { $strViewA = ''; } $strOut .= '<br>Attendance records: ' . $erec->lNumAttend . $strViewA . ' '; if ($bCurrentlyEnrolled) { $strOut .= strLinkAdd_CProgAttendance(false, $lClientID, $lCProgID, $lERecID, 'Add attendance record', true) . ' ' . strLinkAdd_CProgAttendance(false, $lClientID, $lCProgID, $lERecID, 'Add attendance record', false); } $strOut .= '</li>' . "\n"; $strOut .= '</font>'; } if (!$bAnyActiveEnrollment) { $strOut .= '<li style="list-style-type: none;"><br>' . strLinkAdd_CProgEnrollment($lClientID, $lCProgID, 'Add additional enrollment', true) . ' ' . strLinkAdd_CProgEnrollment($lClientID, $lCProgID, 'Add additional enrollment', false) . ' </li> </ul></span>'; } } else { $strOut .= '<span style="text-align: bottom;">: Not enrolled. ' . strLinkAdd_CProgEnrollment($lClientID, $lCProgID, 'Enroll this client', true) . ' ' . strLinkAdd_CProgEnrollment($lClientID, $lCProgID, 'Enroll this client', false) . '</span><br>'; } $strOut .= $strLinkMoveAttend; echoT($strOut); $attributes->bCloseDiv = true; closeBlock($attributes); } } $attributes->bCloseDiv = true; closeBlock($attributes); }
function strDisplayUserTableSingle(&$clsUserTable) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- global $genumDateFormat, $gbDateFormatUS; $clsACO = new madmin_aco(); $strOut = ''; $lTableID = $clsUserTable->lKeyID; $bCollapsibleHeadings = $clsUserTable->bCollapsibleHeadings; $bCollapseDefaultHide = $clsUserTable->bCollapseDefaultHide; $strSafeTableName = htmlspecialchars($clsUserTable->strUserTableName); $strOut .= $this->strBeginCollapsibleHeading($lTableID, $strSafeTableName, true); $this->loadSingleDataRecord($lTableID, $this->lForeignID, $recInfo); $lRecID = $recInfo->lRecID; $enumTType = $clsUserTable->enumTType; $strOut .= '<fieldset class="enpFS" style="width: ' . $this->lFieldSetWidth . 'pt; align: left;"> <legend class="enpLegend"> <b><i>' . $strSafeTableName . '</b></i> ' . strLinkView_UFMFRecordViaRecID($lTableID, $this->lForeignID, $lRecID, 'View record', true, ' id="viewSingle_' . $lTableID . '" ') . ' ' . "\n" . strLinkEdit_UFMultiRecEntry($enumTType, $lTableID, $this->lForeignID, $lRecID, true, 'Edit table entries', ' id="editSingle_' . $lTableID . '" ') . ' ' . ($recInfo->bRecordEntered ? '' : '(not written) ') . ' </legend>'; $strOut .= '<table class="enpRpt">'; for ($idx = 0; $idx < $this->lNumFields; ++$idx) { $uf =& $this->fields[$idx]; $enumType = $uf->enumFieldType; $userValue = $uf->userValue; $lFieldID = $uf->pff_lKeyID; if ($enumType == CS_FT_HEADING) { $strOut .= ' <tr> <td colspan="2" class="enpRptLabel">' . htmlspecialchars($this->fields[$idx]->pff_strFieldNameUser) . ' </td> </tr>'; } else { $strOut .= ' <tr> <td width="' . $this->lLabelWidth . '" class="enpRptLabel">' . htmlspecialchars($this->fields[$idx]->pff_strFieldNameUser) . ' </td> <td class="enpRpt" width="' . $this->lFieldValWidth . '" valign="center">' . "\n"; if (is_null($userValue) && !($enumType == CS_FT_LOG || $enumType == CS_FT_DDLMULTI)) { $strOut .= ' '; } else { switch ($enumType) { case CS_FT_CHECKBOX: $strOut .= (bool) $userValue ? 'Yes' : 'No'; break; case CS_FT_DATE: $strOut .= strNumericDateViaMysqlDate($userValue, $gbDateFormatUS); break; // case CS_FT_DATETIME: // echoT(strNumericDateViaMysqlDate($userValue, $gbDateFormatUS) date($genumDateFormat.' H:i:s', $userValue)); // break; // case CS_FT_DATETIME: // echoT(strNumericDateViaMysqlDate($userValue, $gbDateFormatUS) date($genumDateFormat.' H:i:s', $userValue)); // break; case CS_FT_TEXTLONG: $strOut .= nl2br(htmlspecialchars($userValue)) . ' '; break; case CS_FT_TEXT255: case CS_FT_TEXT80: case CS_FT_TEXT20: $strOut .= htmlspecialchars($userValue) . ' '; break; case CS_FT_CLIENTID: case CS_FT_INTEGER: $strOut .= number_format($userValue); break; case CS_FT_CURRENCY: $clsACO->loadCountries(false, false, true, $this->fields[$idx]->pff_lCurrencyACO); $strOut .= $clsACO->countries[0]->strCurrencySymbol . ' ' . number_format($userValue, 2) . ' ' . $clsACO->countries[0]->strFlagImg; break; case CS_FT_DDL: $strOut .= htmlspecialchars($this->strDDLValue($userValue)); break; case CS_FT_DDL: $strOut .= htmlspecialchars($this->strDDLValue($userValue)); break; case CS_FT_LOG: $strOut .= $this->logDisplay($enumTType, $lFieldID, $lTableID, $this->lForeignID, 5); break; case CS_FT_DDLMULTI: $strDDLMultiFN = $uf->strFieldNameInternal . '_ddlMulti'; $this->loadMultiDDLSelects($lTableID, $lFieldID, $lRecID, $uf->{$strDDLMultiFN}); $strOut .= $this->strMultiDDLUL($uf->{$strDDLMultiFN}); break; default: screamForHelp($enumType . ': invalid field type<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } } } } $strOut .= ' </table>' . "\n"; $strOut .= ' </fieldset><br>' . "\n"; // if ($bCollapsibleHeadings) $strOut .= $this->strEndCollapsibleHeading(); return $strOut; }
<?php global $gbDateFormatUS, $genumDateFormat, $gstrFormatDatePicker; $clsForm = new generic_form(); $clsForm->strLabelClass = $clsForm->strLabelRowLabelClass = $clsForm->strLabelClassRequired = 'enpViewLabel'; $clsForm->strTitleClass = 'enpViewTitle'; $clsForm->strEntryClass = 'enpView'; $clsForm->bValueEscapeHTML = false; $attributes = array('name' => 'frmCloneAttendance', 'id' => 'frmAddEdit'); echoT(form_open('cprograms/attendance/cloneAttOpts/' . $lCProgID . '/' . $lARecID, $attributes)); openBlock('Clone Attendance Record', ''); echoT('<table class="enpView" style="width: 500pt;">'); // source attendance record echoT($clsForm->strLabelRowOneCol('Source Attendance Record', 2, 'style="font-weight: bold;"', 221)); echoT($clsForm->strLabelRow('attendanceID', str_pad($arec->lKeyID, 5, '0', STR_PAD_LEFT) . ' ' . strLinkView_UFMFRecordViaRecID($cprog->lAttendanceTableID, $arec->lClientID, $arec->lKeyID, 'View attendance record', true), 1)); echoT($clsForm->strLabelRow('enrollmentID', str_pad($arec->lEnrollID, 5, '0', STR_PAD_LEFT) . ' ' . strLinkView_UFMFRecordViaRecID($cprog->lEnrollmentTableID, $arec->lClientID, $arec->lEnrollID, 'View enrollment record', true), 1)); echoT($clsForm->strLabelRow('Client', htmlspecialchars($arec->strClientFName . ' ' . $arec->strClientLName) . ' ' . strLinkView_ClientRecord($arec->lClientID, 'View client record', true), 1)); echoT($clsForm->strLabelRow('Date', date($genumDateFormat, $arec->dteAttendance), 1)); echoT($clsForm->strLabelRow('Duration', number_format($arec->dDuration, 2), 1)); echoT($clsForm->strLabelRow('Case Notes', nl2br(htmlspecialchars($arec->strCaseNotes)), 1)); // target attendance record echoT($clsForm->strLabelRowOneCol('<br>Target Attendance Records', 2, 'style="font-weight: bold;"', 221)); //---------------------- // attendance date //---------------------- $clsForm->strStyleExtraLabel = 'width: 100pt; padding-top: 8px;'; echoT(strDatePicker('datepicker1', true)); $clsForm->strExtraFieldText = form_error('txtADate'); echoT($clsForm->strGenericDatePicker('Attendance Date', 'txtADate', true, $formData->txtADate, 'frmCloneAttendance', 'datepicker1')); //---------------------- // skip duplicates
function strLinkView_CProgAttendRec($lTableID, $lFID, $lARecID, $strTitle, $bShowIcon, $strAnchorExtra = '') { //--------------------------------------------------------------- // //--------------------------------------------------------------- return strLinkView_UFMFRecordViaRecID($lTableID, $lFID, $lARecID, $strTitle, $bShowIcon, $strAnchorExtra); }
<td class="enpRptLabel"> Transfer to.... </td> </tr>'); if ($erec->lNumARecs == 0) { echoT(' <tr> <td class="enpRpt" colspan="2"> <i>No ' . $cprog->strSafeAttendLabel . ' records under this ' . $cprog->strSafeEnrollLabel . '</i> </td> </tr>'); } else { foreach ($erec->arecs as $arec) { $lARecID = $arec->lKeyID; echoT('<tr> <td class="enpRpt" style="text-align: center;">' . strLinkView_UFMFRecordViaRecID($lATableID, $lClientID, $lARecID, 'View attendance record', true) . ' ' . date($genumDateFormat, $arec->dteAttendance) . ' </td> <td class="enpRpt" style="text-align: center;">' . strARecXferDDL($cprog->erecs, $lERecID, $lARecID) . ' </td> </tr>'); } } echoT(' <tr> <td class="enpRpt" style=" text-align: center; " colspan="2"> <input type="submit" name="cmdSubmit" value="Transfer Attendance" style=" text-align: center; " onclick=" this.disabled=1; this.form.submit(); " class="btn"
function writeMRecRows($lTableID, $lFID, &$utable, &$mRecs, $lEnrollRecID) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- global $genumDateFormat; $strFNPrefix = $utable->strFieldPrefix; $strFNKeyID = $strFNPrefix . '_lKeyID'; if ($utable->bCProg) { $lCProgID = $utable->cprog->lKeyID; } $bReadOnly = $utable->bReadOnly; foreach ($mRecs as $mrec) { echoT('<tr class="makeStripe">'); $lRecID = $mrec->{$strFNKeyID}; if ($utable->bCProg && !$utable->bEnrollment) { $strClone = '<br>' . strLinkClone_CPAttendance($lCProgID, $lRecID, 'Clone attendance record', true); } else { $strClone = ''; } if ($bReadOnly) { $strEditLink = ''; } else { $strEditLink = strLinkEdit_UFMultiRecEntry($utable->enumTType, $lTableID, $lFID, $lRecID, true, 'Edit record', '', $lEnrollRecID); } echoT(' <td class="enpRpt" style="text-align: center;">' . str_pad($lRecID, 5, '0', STR_PAD_LEFT) . ' ' . strLinkView_UFMFRecordViaRecID($lTableID, $lFID, $lRecID, 'View', true) . ' </td>'); echoT(' <td class="enpRpt" style="text-align: center;">' . $strEditLink . $strClone . ' </td>'); if (!$bReadOnly) { echoT(' <td class="enpRpt" style="text-align: center;">' . strLinkRem_UFMultiRecEntry($utable->enumTType, $lTableID, $lFID, $lRecID, 'Remove', true, true) . ' </td>'); } if ($utable->bCProg) { //----------------------------- // enrollment records //----------------------------- if ($utable->bEnrollment) { echoT(' <td class="enpRpt">' . date($genumDateFormat, $mrec->dteStart) . ' </td>'); if (is_null($mrec->dteMysqlEnd)) { $strEnd = '<i>Ongoing</i>'; } else { $strEnd = date($genumDateFormat, $mrec->dteEnd); } echoT(' <td class="enpRpt" style="text-align: center;">' . $strEnd . ' </td> <td class="enpRpt" style="text-align: center;">' . ($mrec->bCurrentlyEnrolled ? 'Yes' : 'No') . ' </td> <td class="enpRpt" style="text-align: center;">' . strLinkAdd_CProgAttendance(false, $lFID, $utable->cprog->lKeyID, $lRecID, 'Add attendance record', true) . ' </td> '); } else { //----------------------------- // attendance records //----------------------------- echoT(' <td class="enpRpt" style="text-align: center;">' . str_pad($mrec->lEnrollRecordID, 5, '0', STR_PAD_LEFT) . ' ' . strLinkView_UFMFRecordViaRecID($utable->cprog->lEnrollmentTableID, $lFID, $mrec->lEnrollRecordID, 'View enrollment record', true) . ' </td> <td class="enpRpt">' . date($genumDateFormat, $mrec->dteAttendance) . ' </td> <td class="enpRpt" style="text-align: right;">' . number_format($mrec->dDuration, 2) . ' </td> <td class="enpRpt" style="width: 220pt;">' . nl2br(htmlspecialchars($mrec->strCaseNotes)) . ' </td> '); $utable->dTotDuration += $mrec->dDuration; } } if ($utable->lNumFields > 0) { foreach ($utable->ufields as $ufield) { displayField($mrec, $ufield); } } echoT('</tr>'); } }