function writeUF_TableRow(&$clsUF, &$clsUTable)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    global $gbDev;
    $lTableID = $clsUTable->lKeyID;
    if ($gbDev) {
        $strLinkDebug = '  ' . strLinkDebug_Fields($clsUTable->lKeyID, 'Internal field details', true);
    } else {
        $strLinkDebug = '';
    }
    $bHidden = $clsUTable->bHidden;
    if ($bHidden) {
        $strHideStyle = 'color: #999; font-style: italic; ';
        $strHideLabel = ' (hidden)';
        $strFieldLink = '';
    } else {
        $strHideStyle = $strHideLabel = '';
        $strFieldLink = strLinkView_UFFields($lTableID, 'View fields', true, ' id="fieldView_' . $lTableID . '" ') . ' ';
    }
    $lTableID = $clsUTable->lKeyID;
    if ($clsUTable->bMultiEntry) {
        $strMLabel = 'Multiple-entry';
        if ($clsUTable->bReadOnly) {
            $strMLabel .= ' <i>(read only)</i>';
        }
    } else {
        $strMLabel = 'Single-entry';
    }
    echoT('<tr>
           <td class="enpRpt" style="' . $strHideStyle . '" nowrap>' . "\n" . str_pad($lTableID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . strLinkView_UFTable($lTableID, 'View table record', true, '') . '&nbsp;&nbsp;' . strLinkClone_PTable($lTableID, 'Clone', true) . '
           </td>
           <td class="enpRpt" style="' . $strHideStyle . '">' . "\n" . strLinkEdit_UFTable($lTableID, $clsUF->enumTType, 'Edit table', true, '') . '
           </td>
           <td class="enpRpt" width="30%" style="' . $strHideStyle . '">
              <b>' . nl2br(htmlspecialchars($clsUTable->strUserTableName)) . $strHideLabel . '</b>
           </td>
           <td class="enpRpt" style="text-align: left; ' . $strHideStyle . '" width="25%">' . "\n" . $strMLabel . '
           </td>
           <td class="enpRpt" style="text-align: right; ' . $strHideStyle . '" width="10%">' . "\n" . $strFieldLink . $clsUTable->lNumFields . $strLinkDebug . '
           </td>
           <td class="enpRpt" width="40%" style="' . $strHideStyle . '">' . "\n" . nl2br(htmlspecialchars($clsUTable->strDescription)) . '
           </td>
        </tr>');
}
function writeClientProgRow(&$cprog)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    global $genumDateFormat, $gbDev;
    $lCProgID = $cprog->lKeyID;
    if ($cprog->bHidden) {
        $strStyle = 'color: #999; font-style: italic;';
        $strEnroll = '&nbsp;';
        $strAttend = '&nbsp;';
        $strClone = '&nbsp;';
    } else {
        $strStyle = '';
        $strEnroll = strLinkView_UFFields($cprog->lEnrollmentTableID, 'View enrollment fields', true) . '&nbsp;' . $cprog->lNumEFields;
        $strAttend = strLinkView_UFFields($cprog->lAttendanceTableID, 'View attendance fields', true) . '&nbsp;' . $cprog->lNumAFields;
        if ($gbDev) {
            $strEnroll .= '&nbsp;' . strLinkDebug_Fields($cprog->lEnrollmentTableID, 'Field debug info', true);
            $strAttend .= '&nbsp;' . strLinkDebug_Fields($cprog->lAttendanceTableID, 'Field debug info', true);
        }
        $strClone = strLinkClone_CProgram($lCProgID, 'Clone this client program', true);
    }
    if ($cprog->bMentorMentee) {
        $strProgType = '<br><i>Mentor Program</i>';
        //         &nbsp;'
        //                .strLinkEdit_CPMentorFields($lCProgID, 'Edit field association', true);
    } else {
        $strProgType = '';
    }
    echoT('
            <tr class="makeStripe">
               <td class="enpRpt" style="text-align: center; ' . $strStyle . '" nowrap>' . str_pad($lCProgID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . strLinkView_CProgram($lCProgID, 'View program record', true) . '
               </td>
               <td class="enpRpt" style="text-align: center; vertical-align: top;' . $strStyle . '" nowrap>' . $strClone . '
               </td>
               <td class="enpRpt" style="' . $strStyle . '"><b>' . htmlspecialchars($cprog->strProgramName) . '</b>' . $strProgType . '<br>' . date($genumDateFormat, $cprog->dteStart) . ' - ' . date($genumDateFormat, $cprog->dteEnd) . '
               </td>
               <td class="enpRpt" style="width: 160pt; ' . $strStyle . '">' . nl2br(htmlspecialchars($cprog->strDescription)) . '
               </td>
               <td class="enpRpt" style="' . $strStyle . ' text-align: center;">' . $strEnroll . '
               </td>
               <td class="enpRpt" style="' . $strStyle . ' text-align: center;">' . $strAttend . '
               </td>
            </tr>');
}
function showUFFieldInfo(&$clsRpt, &$schema, $lTableID)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $table =& $schema[$lTableID];
    $attributes = new stdClass();
    $attributes->lTableWidth = '';
    $attributes->divID = 'fieldsDev';
    $attributes->divImageID = 'fieldsDivImg';
    openBlock('Fields for table <b>' . htmlspecialchars($table->strUserTableName) . '</b>', strLinkView_UFFields($lTableID, 'View fields', true, '') . '&nbsp;' . strLinkView_UFFields($lTableID, 'View fields', false, ''), $attributes);
    echoT('
         <table class="enpRpt">
            <tr>
               <td class="enpRptLabel">
                  Field ID
               </td>
               <td class="enpRptLabel">
                  User Name
               </td>
               <td class="enpRptLabel">
                  Internal Name
               </td>
               <td class="enpRptLabel">
                  Sort IDX
               </td>
               <td class="enpRptLabel">
                  Field Type
               </td>
            </tr>
         ');
    foreach ($table->fields as $ufield) {
        $bHidden = $ufield->bHidden;
        if ($bHidden) {
            $strStyle = 'color: #999; font-style: italic;';
            $strHidden = ' (hidden)';
        } else {
            $strStyle = '';
            $strHidden = '';
        }
        echoT('
               <tr class="makeStripe" style="' . $strStyle . '">
                  <td class="enpRpt" style="text-align: center;">' . str_pad($ufield->lFieldID, 5, '0', STR_PAD_LEFT) . '
                  </td>
                  <td class="enpRpt" style="' . $strStyle . '">' . htmlspecialchars($ufield->strFieldNameUser) . '&nbsp;' . $strHidden . '
                  </td>
                  <td class="enpRpt" style="' . $strStyle . '">' . htmlspecialchars($ufield->strFieldNameInternal) . '
                  </td>
                  <td class="enpRpt" style="text-align: center; ' . $strStyle . '">' . $ufield->lSortIDX . '
                  </td>
                  <td class="enpRpt" style="' . $strStyle . '">' . $ufield->enumFieldType . '
                  </td>
               </tr>
            ');
    }
    echoT('
         </table>');
    $attributes = new stdClass();
    $attributes->bCloseDiv = true;
    closeBlock($attributes);
}
function showCustomTableInfo(&$crpt, &$cprog, $bEnrollment)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $attributes = new stdClass();
    $attributes->lTableWidth = 900;
    $attributes->lUnderscoreWidth = 300;
    $attributes->divID = 'group' . ($bEnrollment ? 'E' : 'A') . 'Div';
    $attributes->divImageID = 'group' . ($bEnrollment ? 'E' : 'A') . 'DivImg';
    $attributes->bStartOpen = false;
    openBlock(($bEnrollment ? 'Enrollment' : 'Attendance') . ' Table', '', $attributes);
    if ($bEnrollment) {
        $strNumFields = $cprog->lNumEFields . '&nbsp;' . strLinkView_UFFields($cprog->lEnrollmentTableID, 'View enrollment fields', true);
        $bReadOnly = $cprog->bETableReadOnly;
    } else {
        $strNumFields = $cprog->lNumAFields . '&nbsp;' . strLinkView_UFFields($cprog->lAttendanceTableID, 'View attendance fields', true);
        $bReadOnly = $cprog->bATableReadOnly;
    }
    echoT($crpt->openReport());
    echoT($crpt->openRow() . $crpt->writeLabel('# Fields:') . $crpt->writeCell($strNumFields) . $crpt->closeRow());
    echoT($crpt->openRow() . $crpt->writeLabel('Read Only?') . $crpt->writeCell($bReadOnly ? 'Yes' : 'No') . $crpt->closeRow());
    echoT($crpt->openRow() . $crpt->writeLabel('Verification File:') . $crpt->writeCell(htmlspecialchars($bEnrollment ? $cprog->strE_VerificationModule : $cprog->strA_VerificationModule)) . $crpt->closeRow());
    echoT($crpt->openRow() . $crpt->writeLabel('Entry Point:') . $crpt->writeCell(htmlspecialchars($bEnrollment ? $cprog->strE_VModEntryPoint : $cprog->strA_VModEntryPoint)) . $crpt->closeRow());
    echoT($crpt->closeReport());
    $attributes->bCloseDiv = true;
    closeBlock($attributes);
}
 function strUFTableSummaryDisplay($bLite)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $params = array('enumStyle' => 'terse');
     $clsRpt = new generic_rpt($params);
     $strOut = '';
     $utable =& $this->userTables[0];
     $clsRpt->setEntrySummary();
     $strOut .= $clsRpt->openReport();
     if ($bLite) {
         $strLink = '&nbsp;' . strLinkView_UFFields($this->lTableID, 'View table fields', true, '');
     } else {
         $strLink = '';
     }
     $strOut .= $clsRpt->openRow() . $clsRpt->writeLabel('Table:', '75pt') . $clsRpt->writeCell($strLink . ' ' . htmlspecialchars($utable->strUserTableName)) . $clsRpt->closeRow();
     $strOut .= $clsRpt->openRow() . $clsRpt->writeLabel('Table ID:', '75pt') . $clsRpt->writeCell(str_pad($utable->lKeyID, 5, '0', STR_PAD_LEFT), '', '', 1, 1, ' id="pTabSummaryID" ') . $clsRpt->closeRow();
     $strOut .= $clsRpt->openRow() . $clsRpt->writeLabel('Parent:') . $clsRpt->writeCell($utable->enumTType) . $clsRpt->closeRow();
     $strOut .= $clsRpt->openRow() . $clsRpt->writeLabel('Type:') . $clsRpt->writeCell($utable->bMultiEntry ? 'Multi-record' : 'Single-entry') . $clsRpt->closeRow();
     if (!$bLite) {
         $strOut .= $clsRpt->openRow() . $clsRpt->writeLabel('Description:') . $clsRpt->writeCell(nl2br(htmlspecialchars($this->strTableDescription))) . $clsRpt->closeRow();
     }
     $strOut .= $clsRpt->closeReport();
     return $strOut;
 }
            Name
         </td>
         <td class="enpRptLabel">
            Enroll
         </td>
         <td class="enpRptLabel">
            Attend
         </td>
      </tr>');
foreach ($utables as $idx => $ut) {
    if ($ut->bHidden) {
        $strStyleHidden = ' color: #aaa; ';
    } else {
        $strStyleHidden = '';
    }
    $strLinkFields = strLinkView_UFFields($ut->lKeyID, 'View fields', true);
    if (!is_null($ut->lCProgEID)) {
        $strPName = '<b>' . htmlspecialchars($ut->strCProgEName) . '</b>';
        $strCPID = str_pad($ut->lCProgEID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . strLinkView_CProgram($ut->lCProgEID, 'View client program', true);
        $strCPE = '<b>X</b>';
        $strCPA = '-';
        $bCP = true;
        $strLinkUTable = '';
    } elseif (!is_null($ut->lCProgAID)) {
        $strPName = '<b>' . htmlspecialchars($ut->strCProgAName) . '</b>';
        $strCPID = str_pad($ut->lCProgAID, 5, '0', STR_PAD_LEFT) . '&nbsp;' . strLinkView_CProgram($ut->lCProgAID, 'View client program', true);
        $strCPE = '-';
        $strCPA = '<b>X</b>';
        $bCP = true;
        $strLinkUTable = '';
    } else {