/**
  * function updateFieldSet
  * <pre>
  * Processes a given list of fields to be linked to this page
  * </pre>
  * @param $pageID [INTEGER] the ID of the current page
  * @param $daObjID [INTEGER] the ID of the associated Data Access Object
  * @param $isForm [INTEGER] flag indicating if associated with form DAObj
  * @param $fieldEntries [OBJECT] PageFieldList object with current data
  * @param $formList [ARRAY] the values returned from the form
  * @return [void]
  */
 function updateFieldSet($pageID, $daObjID, $isForm, $fieldEntries, $formList)
 {
     $currentFieldArray = array();
     $fieldEntries->setFirst();
     /*
      * First remove unselected fields ...
      */
     // for each entry
     while ($field = $fieldEntries->getNext()) {
         // if current field is in list returned from form
         if (in_array((string) $field->getFieldID(), $formList)) {
             // add current entry to currentArray
             $currentFieldArray[] = $field->getFieldID();
         } else {
             // else
             // delete current entry
             $field->deleteEntry();
         }
         // end if
     }
     // next entry
     /*
      * Now Add selected fields not already in table
      */
     // for each item in list returned from form
     for ($indx = 0; $indx < count($formList); $indx++) {
         // if current item not in currentArray
         if (!in_array($formList[$indx], $currentFieldArray)) {
             // create new PageField Entry in table
             $pageField = new RowManager_PageFieldManager();
             $pageField->createNewEntry();
             // fill in current data set
             $pageField->setPageID($pageID);
             $pageField->setDAObjID($daObjID);
             $pageField->setDAFieldID($formList[$indx]);
             $pageField->setIsForm($isForm);
             // update entry
             $pageField->updateDBTable();
         }
         // end if
     }
     // next item
 }