protected function getFooterFieldValuesArray($personID = '', $formID = '', $isRepeatable = true)
 {
     $FALSE = 0;
     $fields = new RowManager_FormFieldManager();
     $fields->setFieldGroupID(FormProcessor_EditStaffScheduleForm::NO_FIELDGROUP_ID);
     // HSMIT added
     $fvalues = new RowManager_FormFieldValueManager();
     $ftypes = new RowManager_FieldTypeManager();
     if ($personID != '') {
         //$fields->setFormID($formID);
         $fvalues->setPersonID($personID);
     }
     $fieldInfo = new MultiTableManager();
     $fieldInfo->addRowManager($fields);
     $fieldInfo->addRowManager($fvalues, new JoinPair($fvalues->getJoinOnFieldID(), $fields->getJoinOnFieldID()));
     $fieldInfo->addRowManager($ftypes, new JoinPair($fields->getJoinOnFieldTypeID(), $ftypes->getJoinOnFieldTypeID()));
     if ($this->show_hidden == false) {
         $fieldInfo->constructSearchCondition('fields_hidden', '=', $FALSE, true);
     }
     // filter out repeatable fields if flag set to FALSE
     if ($isRepeatable == false) {
         $fieldInfo->constructSearchCondition('fieldgroup_id', '=', '0', true);
     } else {
         $fieldInfo->constructSearchCondition('fieldgroup_id', '!=', '0', true);
     }
     $fieldInfo->setSortOrder('fields_priority');
     $valuesIterator = $fieldInfo->getListIterator();
     $valuesArray = $valuesIterator->getDataList();
     //        echo "field values:<br><pre>".print_r($valuesArray,true)."</pre>";
     // store field ids associated with values already in database
     $initializedFieldIds = array_keys($valuesArray);
     // since each field value is located in a DB row the result array has several arrays - one per field value
     // need to extract each field value and store it as a non-array record in a result array
     $fieldValues = array();
     $idx = $this->total_nonrepeatable_fields;
     // initialize counter to first available form ID (some used already)
     /** Go through all event fields and map each to existing field value, otherwise create new field value record **/
     $fieldsArray = array_values($this->footerFieldToFieldIDmapper);
     // store field IDs (ASSUMES formFieldToFieldIDmapper is initialized)
     //         echo 'fieldsArray = <pre>'.print_r($fieldsArray,true).'</pre>';
     reset($fieldsArray);
     reset($valuesArray);
     foreach (array_keys($fieldsArray) as $k) {
         $fieldID = current($fieldsArray);
         $form_value = '';
         // default blank field value if none found
         $form_value_id = -1;
         // to be replaced with existing or newly-created field values ID
         if (in_array($fieldID, $initializedFieldIds) == true) {
             $record = $valuesArray[$fieldID];
             $form_value = $record['fieldvalues_value'];
             $form_value_id = $record['fieldvalues_id'];
         } else {
             $updateValues = array();
             $updateValues['fields_id'] = $fieldID;
             $updateValues['fieldvalues_value'] = $form_value;
             $updateValues['person_id'] = $personID;
             $fieldvalues_manager = new RowManager_FormFieldValueManager();
             // store values in table manager object.
             $fieldvalues_manager->loadFromArray($updateValues);
             // now update the DB with the values
             if (!$fieldvalues_manager->isLoaded()) {
                 // 			        echo "new entry ".$fieldID.", ".$personID;
                 $fieldvalues_manager->createNewEntry();
                 $form_value_id = $fieldvalues_manager->getID();
             }
         }
         $fieldValues['form_field' . $idx] = $form_value;
         // store mapping associating form field label with fieldvalues_id
         $this->footerFieldToValueIDmapper['form_field' . $idx] = $form_value_id;
         next($fieldsArray);
         $idx++;
     }
     // 			echo 'labels-values = <pre>'.print_r($this->formFieldToValueIDmapper,true).'</pre>';
     // 			echo 'labels-fields = <pre>'.print_r($this->formFieldToFieldIDmapper,true).'</pre>';
     return $fieldValues;
 }