Exemplo n.º 1
0
 public static function updateNamedSections($szRootElement, $oParent, $aSectionArray)
 {
     // Store the current sections
     self::$_current_section_evaluations = $aSectionArray;
     $compiled_result = new XMLElement($szRootElement);
     $oSectionUpdater = new GenericSectionUpdate($oParent);
     $oSectionUpdater->storeRedirect();
     $sm = new SectionManager($oParent);
     $redirect = true;
     foreach ($aSectionArray as $entry) {
         /*
          ** Build an array of field meta-data
          */
         $field_array = array();
         $fields = end($sm->fetch($sm->fetchIDFromHandle($entry)));
         foreach ($fields->fetch() as $field) {
             $tmp = $field->get();
             $field_array[strtolower($tmp['label'])] = $tmp;
         }
         /*
          ** Run the update and return the Symphony XML
          */
         $section_arrays = $oSectionUpdater->updateSections($sm->fetchIDFromHandle($entry), $entry, $field_array);
         foreach ($section_arrays as $section) {
             $compiled_result->appendChild($section);
             if ($section->getAttribute("result") == "error") {
                 $redirect = false;
             }
         }
     }
     // Fix up the SBLs
     $oSectionUpdater->resolveLinks();
     // Do the rollback
     $oSectionUpdater->rollbackTransaction();
     // redirect if set up
     if ($redirect) {
         $oSectionUpdater->actionRedirect();
     }
     return $compiled_result;
 }