public function processRecordGroup($element, array $group)
    {
        $xGroup = new XMLElement($element, null, $group['attr']);

        if (is_array($group['records']) && !empty($group['records'])) {
            if (isset($group['records'][0])) {
                $data = $group['records'][0]->getData();
                $pool = FieldManager::fetch(array_keys($data));
                self::$_fieldPool += $pool;
            }

            foreach ($group['records'] as $entry) {
                $xEntry = $this->processEntry($entry);

                if ($xEntry instanceof XMLElement) {
                    $xGroup->appendChild($xEntry);
                }
            }
        }

        if (is_array($group['groups']) && !empty($group['groups'])) {
            foreach ($group['groups'] as $element => $group) {
                foreach ($group as $g) {
                    $xGroup->appendChild(
                        $this->processRecordGroup($element, $g)
                    );
                }
            }
        }

        if (!$this->_param_output_only) {
            return $xGroup;
        }
    }
public function processRecordGroup($element, array $group)
    {
        $xGroup = new XMLElement($element, null, $group['attr']);

        if (is_array($group['records']) && !empty($group['records'])) {
            if (isset($group['records'][0])) {
                $data = $group['records'][0]->getData();
                $pool = FieldManager::fetch(array_keys($data));
                self::$_fieldPool += $pool;
            }

            foreach ($group['records'] as $entry) {
                $xEntry = $this->processEntry($entry);

                if ($xEntry instanceof XMLElement) {
                    $xGroup->appendChild($xEntry);
                }
            }
        }

        if (is_array($group['groups']) && !empty($group['groups'])) {
            foreach ($group['groups'] as $element => $group) {
                foreach ($group as $g) {
                    $xGroup->appendChild(
                        $this->processRecordGroup($element, $g)
                    );
                }
            }
        }

        if (!$this->_param_output_only) {
            return $xGroup;
        }
    }
public function processRecordGroup ( $ element , array $ group ) { $ xGroup = new XMLElement ( $ element , null , $ group [ 'attr' ] ) ; if ( is_array ( $ group [ 'records' ] ) && ! empty ( $ group [ 'records' ] ) ) { if ( isset ( $ group [ 'records' ] [ 0 ] ) ) { $ data = $ group [ 'records' ] [ 0 ] -> getData ( ) ; $ pool = FieldManager :: fetch ( array_keys ( $ data ) ) ; self :: $ _fieldPool += $ pool ; } foreach ( $ group [ 'records' ] as $ entry ) { $ xEntry = $ this -> processEntry ( $ entry ) ; if ( $ xEntry instanceof XMLElement ) { $ xGroup -> appendChild ( $ xEntry ) ; } } } if ( is_array ( $ group [ 'groups' ] ) && ! empty ( $ group [ 'groups' ] ) ) { foreach ( $ group [ 'groups' ] as $ element => $ group ) { foreach ( $ group as $ g ) { $ xGroup -> appendChild ( $ this -> processRecordGroup ( $ element , $ g ) ) ; } } } if ( ! $ this -> _param_output_only ) { return $ xGroup ; } }
Given a name for the group, and an associative array that
contains three keys, `attr`, `records` and `groups`. Grouping
of Entries is done by the grouping Field at a PHP level, not
through the Database.

@param string $element
The name for the XML node for this group
@param array $group
An associative array of the group data, includes `attr`, `records`
and `groups` keys.
@throws Exception
@return XMLElement
Given a name for the group and an associative array that contains three keys attr records and groups . Grouping of Entries is done by the grouping Field at a PHP level not through the Database .