function strGenericDatePicker($strLabel, $strFieldName, $bRequired, $strValue, $strForm, $strJSPickerName, $strExtraCell = '', $bOnlyCalCell = false)
 {
     //---------------------------------------------------------------
     // sample call:
     //   echoT($clsForm->strGenericDatePicker(
     //                   'Birthdate', 'txtBDate',      true,
     //                   $strBDay,    'frmEditPerson', 'datepicker'));
     //---------------------------------------------------------------
     $this->setRequired($bRequired, $strClass, $strStar);
     if ($this->bBGClearOnFocus) {
         $strOnFocus = ' onFocus="' . $strFieldName . '.style.background=\'#fff\';" ';
     } else {
         $strOnFocus = '';
     }
     if ($this->bValueEscapeHTML) {
         $strValue = htmlspecialchars($strValue);
     }
     initCalendarOpts($calOpts);
     $calOpts->strDate = $strValue;
     $calOpts->strForm = $strForm;
     $calOpts->strTextObjName = $strFieldName;
     $calOpts->strTextBoxID = $strJSPickerName;
     $calOpts->strTextOnChange = $this->calOptsTextOnChange;
     $calOpts->strTextOnFocus = $this->calOptsTextOnFocus;
     $calOpts->strImgOnClick = $this->calOptsImgOnClick;
     $calOpts->strAfterCalImg = $this->calOptsAfterCalImg;
     $strCalCell = strCalendarCell($calOpts) . $strExtraCell . $this->strExtraFieldText;
     if ($bOnlyCalCell) {
         $strHold = $strCalCell;
     } else {
         $strHold = '<tr>
           <td class="' . $strClass . '" style="' . $this->strStyleExtraLabel . '">' . $strLabel . $strStar . ($this->bAddLabelColon ? ':' : '') . '
           </td>
           <td class="' . $this->strEntryClass . '" style="padding-bottom: 4px;' . $this->strStyleExtraValue . '">' . $strCalCell . '
           </td>
        </tr>';
     }
     $this->strExtraFieldText = '';
     return $strHold;
 }
 public function strEditUserTableEntries($lEditFieldID)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $genumDateFormat, $gbDateFormatUS;
     $strOut = '';
     $clsACO = new madmin_aco();
     if (is_null($this->lForeignID)) {
         screamForHelp('Class not initialized!<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
     }
     $bAnyEdit = $lEditFieldID > 0;
     $this->loadSingleDataRecord($this->lTableID, $this->lForeignID, $recInfo);
     $utable =& $this->userTables[0];
     $enumTType = $utable->enumTType;
     $this->tableContext(0);
     $this->tableContextRecView(0);
     $strOut .= '
      <fieldset class="enpFS" style="width: ' . $this->lFieldSetWidth . 'pt; align: left;">
           <legend class="enpLegend">
              <b><i>' . htmlspecialchars($utable->strUserTableName) . '</b></i>
           </legend>';
     $strOut .= 'Entry for: ' . $this->strContextName . ' <i>(' . $this->strContextLabel . ')</i> ' . $this->strContextViewLink . '<br>';
     if ($bAnyEdit) {
         $strOut .= strDatePicker('datepickerFuture', true);
     }
     $strOut .= '
         <table class="enpRpt">';
     for ($idx = 0; $idx < $this->lNumFields; ++$idx) {
         $enumType = $this->fields[$idx]->enumFieldType;
         if ($enumType == CS_FT_HEADING) {
             $strOut .= '
                  <tr>
                     <td colspan="2" class="enpRptLabel">' . htmlspecialchars($this->fields[$idx]->pff_strFieldNameUser) . '
                     </td>';
         } else {
             if ($enumType != CS_FT_LOG) {
                 $userValue = $this->fields[$idx]->userValue;
                 $lFieldID = $this->fields[$idx]->pff_lKeyID;
                 $strFName = 'var' . $lEditFieldID;
                 $bEditField = $lEditFieldID == $lFieldID;
                 $strOut .= '
                  <tr>
                     <td width="' . $this->lLabelWidth . '" class="enpRptLabel">' . htmlspecialchars($this->fields[$idx]->pff_strFieldNameUser) . '
                     </td>
                     <td class="enpRpt" width="' . $this->lFieldValWidth . '" valign="left">';
                 if ($bEditField) {
                     $strUserErr = form_error($strFName);
                     // did user make an invalid entry?
                     $bUserEntryErr = $strUserErr . '' != '';
                     $attributes = array('name' => $this->strFormName, 'id' => 'frmAddEdit');
                     $strOut .= form_open('admin/uf_user_edit/userAddEdit/' . $this->lTableID . '/' . $this->lForeignID . '/' . $lFieldID, $attributes);
                     switch ($enumType) {
                         case CS_FT_CHECKBOX:
                             $strOut .= '
                        <input type="checkbox" value="TRUE" id="addEditEntry"
                               name="' . $strFName . '" ' . ((bool) $userValue ? 'checked' : '') . '>&nbsp;';
                             break;
                         case CS_FT_DATE:
                             if ($bUserEntryErr) {
                                 $strDate = set_value($strFName);
                             } else {
                                 if (is_null($userValue)) {
                                     $strDate = '';
                                 } else {
                                     $strDate = strNumericDateViaMysqlDate($userValue, $gbDateFormatUS);
                                 }
                             }
                             initCalendarOpts($calOpts);
                             $calOpts->strDate = $strDate;
                             $calOpts->strForm = $this->strFormName;
                             $calOpts->strTextObjName = $strFName;
                             $calOpts->strTextBoxID = 'datepickerFuture';
                             $strOut .= strCalendarCell($calOpts) . '&nbsp;';
                             //$strDate, $this->strFormName, $strFName, 'datepickerFuture')
                             break;
                             //                  case CS_FT_DATETIME:
                             //                     echoT(date($genumDateFormat.' H:i:s', $userValue));
                             //                     break;
                         //                  case CS_FT_DATETIME:
                         //                     echoT(date($genumDateFormat.' H:i:s', $userValue));
                         //                     break;
                         case CS_FT_TEXTLONG:
                             $strOut .= '<textarea name="' . $strFName . '" rows=6 cols=64 id="addEditEntry" >' . htmlspecialchars($userValue) . '</textarea><br>';
                             break;
                         case CS_FT_TEXT255:
                             $strOut .= '<input type="text" size="50" maxlength="255" name="' . $strFName . '"
                                   value="' . htmlspecialchars($userValue) . '" id="addEditEntry" >&nbsp;';
                             break;
                         case CS_FT_TEXT80:
                             $strOut .= '<input type="text" size="50" maxlength="80" name="' . $strFName . '"
                                   value="' . htmlspecialchars($userValue) . '" id="addEditEntry" >&nbsp;';
                             break;
                         case CS_FT_TEXT20:
                             $strOut .= '<input type="text" size="20" maxlength="20" name="' . $strFName . '"
                                   value="' . htmlspecialchars($userValue) . '" id="addEditEntry" >&nbsp;';
                             break;
                         case CS_FT_INTEGER:
                             if ($bUserEntryErr) {
                                 $strNumber = set_value($strFName);
                             } else {
                                 $strNumber = number_format($userValue);
                             }
                             $strOut .= '<input type="text" size="10" maxlength="10" name="' . $strFName . '"
                                value="' . $strNumber . '" id="addEditEntry" >&nbsp;';
                             break;
                         case CS_FT_CURRENCY:
                             $clsACO->loadCountries(false, false, true, $this->fields[$idx]->pff_lCurrencyACO);
                             if ($bUserEntryErr) {
                                 $strNumber = set_value($strFName);
                             } else {
                                 $strNumber = number_format($userValue, 2, '.', '');
                             }
                             $strOut .= $clsACO->countries[0]->strCurrencySymbol . ' ' . '<input type="text" size="10" maxlength="20" name="' . $strFName . '"
                                value="' . $strNumber . '" id="addEditEntry" >&nbsp;' . $clsACO->countries[0]->strFlagImg;
                             break;
                         case CS_FT_DDL:
                             $strOut .= '<select name="' . $strFName . '" id="addEditEntry" >';
                             $strOut .= $this->strDisplayUF_DDL($lEditFieldID, $userValue);
                             $strOut .= '</select>&nbsp;';
                             break;
                         default:
                             screamForHelp($enumType . ': invalid field type<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
                             break;
                     }
                     // note: including the following line in the submit button prevents
                     // the form from being submitted when unchecking a single check box ?????
                     //                           onclick="this.disabled=1; this.form.submit();"
                     $strOut .= '<input type="submit"
                        name="cmdAdd"
                        value="Save"
                        style="font-size: 8pt; height: 13pt; text-align: text-top;"
                        class="btn"
                           onmouseover="this.className=\'btn btnhov\'"
                           onmouseout="this.className=\'btn\'">' . $strUserErr;
                 } else {
                     $strOut .= strLinkEdit_UFTableEntries($enumTType, $this->lTableID, $this->lForeignID, $lFieldID, true, 'edit field', '') . '&nbsp;';
                     if (is_null($userValue)) {
                         $strOut .= '&nbsp';
                     } 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(date($genumDateFormat.' H:i:s', $userValue));
                                 //                        break;
                             //                     case CS_FT_DATETIME:
                             //                        echoT(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) . '&nbsp;';
                                 break;
                             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;
                             default:
                                 screamForHelp($enumType . ': invalid field type<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
                                 break;
                         }
                     }
                 }
             }
         }
     }
     $strOut .= '</table>';
     if ($bAnyEdit) {
         $strOut .= '</form><script type="text/javascript">frmAddEdit.addEditEntry.focus();</script>';
     }
     $strOut .= '</fieldset>';
     return $strOut;
 }