protected function renderDataTable($array, $prefixLine = "")
    {
        $columnsHaveInvalidChars = $this->areTableLabelsInvalidXmlTagNames(reset($array));

        $out = '';
        foreach ($array as $rowId => $row) {
            if (!is_array($row)) {
                $value = self::formatValueXml($row);
                if (strlen($value) == 0) {
                    $out .= $prefixLine . "\t\t<$rowId />\n";
                } else {
                    $out .= $prefixLine . "\t\t<$rowId>" . $value . "</$rowId>\n";
                }
                continue;
            }

            // Handing case idgoal=7, creating a new array for that one
            $rowAttribute = '';
            if (strstr($rowId, '=') !== false) {
                $rowAttribute = explode('=', $rowId);
                $rowAttribute = " " . $rowAttribute[0] . "='" . $rowAttribute[1] . "'";
            }
            $out .= $prefixLine . "\t<row$rowAttribute>";

            if (count($row) === 1
                && key($row) === 0
            ) {
                $value = self::formatValueXml(current($row));
                $out .= $prefixLine . $value;
            } else {
                $out .= "\n";
                foreach ($row as $name => $value) {
                    // handle the recursive dataTable case by XML outputting the recursive table
                    if (is_array($value)) {
                        if (is_array(reset($value))) {
                            $value = "\n" . $this->renderDataTable($value, $prefixLine . "\t\t");
                        } else {
                            $value = "\n" . $this->renderArray($value, $prefixLine . "\t\t");
                        }
                        $value .= $prefixLine . "\t\t";
                    } else {
                        $value = self::formatValueXml($value);
                    }

                    list($tagStart, $tagEnd) = $this->getTagStartAndEndFor($name, $columnsHaveInvalidChars);

                    if (strlen($value) == 0) {
                        $out .= $prefixLine . "\t\t<$tagStart />\n";
                    } else {
                        $out .= $prefixLine . "\t\t<$tagStart>" . $value . "</$tagEnd>\n";
                    }
                }
                $out .= "\t";
            }
            $out .= $prefixLine . "</row>\n";
        }
        return $out;
    }
protected function renderDataTable($array, $prefixLine = "")
    {
        $columnsHaveInvalidChars = $this->areTableLabelsInvalidXmlTagNames(reset($array));

        $out = '';
        foreach ($array as $rowId => $row) {
            if (!is_array($row)) {
                $value = self::formatValueXml($row);
                if (strlen($value) == 0) {
                    $out .= $prefixLine . "\t\t<$rowId />\n";
                } else {
                    $out .= $prefixLine . "\t\t<$rowId>" . $value . "</$rowId>\n";
                }
                continue;
            }

            // Handing case idgoal=7, creating a new array for that one
            $rowAttribute = '';
            if (strstr($rowId, '=') !== false) {
                $rowAttribute = explode('=', $rowId);
                $rowAttribute = " " . $rowAttribute[0] . "='" . $rowAttribute[1] . "'";
            }
            $out .= $prefixLine . "\t<row$rowAttribute>";

            if (count($row) === 1
                && key($row) === 0
            ) {
                $value = self::formatValueXml(current($row));
                $out .= $prefixLine . $value;
            } else {
                $out .= "\n";
                foreach ($row as $name => $value) {
                    // handle the recursive dataTable case by XML outputting the recursive table
                    if (is_array($value)) {
                        if (is_array(reset($value))) {
                            $value = "\n" . $this->renderDataTable($value, $prefixLine . "\t\t");
                        } else {
                            $value = "\n" . $this->renderArray($value, $prefixLine . "\t\t");
                        }
                        $value .= $prefixLine . "\t\t";
                    } else {
                        $value = self::formatValueXml($value);
                    }

                    list($tagStart, $tagEnd) = $this->getTagStartAndEndFor($name, $columnsHaveInvalidChars);

                    if (strlen($value) == 0) {
                        $out .= $prefixLine . "\t\t<$tagStart />\n";
                    } else {
                        $out .= $prefixLine . "\t\t<$tagStart>" . $value . "</$tagEnd>\n";
                    }
                }
                $out .= "\t";
            }
            $out .= $prefixLine . "</row>\n";
        }
        return $out;
    }
protected function renderDataTable ( $ array , $ prefixLine = "" ) { $ columnsHaveInvalidChars = $ this -> areTableLabelsInvalidXmlTagNames ( reset ( $ array ) ) ; $ out = '' ; foreach ( $ array as $ rowId => $ row ) { if ( ! is_array ( $ row ) ) { $ value = self :: formatValueXml ( $ row ) ; if ( strlen ( $ value ) == 0 ) { $ out .= $ prefixLine . "\t\t<$rowId />\n" ; } else { $ out .= $ prefixLine . "\t\t<$rowId>" . $ value . "</$rowId>\n" ; } continue ; } // Handing case idgoal=7, creating a new array for that one $ rowAttribute = '' ; if ( strstr ( $ rowId , '=' ) !== false ) { $ rowAttribute = explode ( '=' , $ rowId ) ; $ rowAttribute = " " . $ rowAttribute [ 0 ] . "='" . $ rowAttribute [ 1 ] . "'" ; } $ out .= $ prefixLine . "\t<row$rowAttribute>" ; if ( count ( $ row ) === 1 && key ( $ row ) === 0 ) { $ value = self :: formatValueXml ( current ( $ row ) ) ; $ out .= $ prefixLine . $ value ; } else { $ out .= "\n" ; foreach ( $ row as $ name => $ value ) { // handle the recursive dataTable case by XML outputting the recursive table if ( is_array ( $ value ) ) { if ( is_array ( reset ( $ value ) ) ) { $ value = "\n" . $ this -> renderDataTable ( $ value , $ prefixLine . "\t\t" ) ; } else { $ value = "\n" . $ this -> renderArray ( $ value , $ prefixLine . "\t\t" ) ; } $ value .= $ prefixLine . "\t\t" ; } else { $ value = self :: formatValueXml ( $ value ) ; } list ( $ tagStart , $ tagEnd ) = $ this -> getTagStartAndEndFor ( $ name , $ columnsHaveInvalidChars ) ; if ( strlen ( $ value ) == 0 ) { $ out .= $ prefixLine . "\t\t<$tagStart />\n" ; } else { $ out .= $ prefixLine . "\t\t<$tagStart>" . $ value . "</$tagEnd>\n" ; } } $ out .= "\t" ; } $ out .= $ prefixLine . "</row>\n" ; } return $ out ; }
Computes the output for the given data array

@param array $array
@param string $prefixLine
@return string
Computes the output for the given data array