|
|
|
|
@ -115,8 +115,13 @@ class Export |
|
|
|
|
* @param string Name of the root element. A root element should always be given. |
|
|
|
|
* @param string Encoding in which the data is provided |
|
|
|
|
*/ |
|
|
|
|
public static function arrayToXml($data, $filename = 'export', $item_tagname = 'item', $wrapper_tagname = null, $encoding = null) |
|
|
|
|
{ |
|
|
|
|
public static function arrayToXml( |
|
|
|
|
$data, |
|
|
|
|
$filename = 'export', |
|
|
|
|
$item_tagname = 'item', |
|
|
|
|
$wrapper_tagname = null, |
|
|
|
|
$encoding = null |
|
|
|
|
) { |
|
|
|
|
if (empty($encoding)) { |
|
|
|
|
$encoding = api_get_system_encoding(); |
|
|
|
|
} |
|
|
|
|
@ -150,8 +155,12 @@ class Export |
|
|
|
|
* @param string Encoding in which the data is provided |
|
|
|
|
* @return void Prompts the user for a file download |
|
|
|
|
*/ |
|
|
|
|
public static function export_complex_table_xml ($data, $filename = 'export', $wrapper_tagname, $encoding = 'ISO-8859-1') |
|
|
|
|
{ |
|
|
|
|
public static function export_complex_table_xml( |
|
|
|
|
$data, |
|
|
|
|
$filename = 'export', |
|
|
|
|
$wrapper_tagname, |
|
|
|
|
$encoding = 'ISO-8859-1' |
|
|
|
|
) { |
|
|
|
|
$file = api_get_path(SYS_ARCHIVE_PATH).'/'.uniqid('').'.xml'; |
|
|
|
|
$handle = fopen($file, 'a+'); |
|
|
|
|
fwrite($handle, '<?xml version="1.0" encoding="'.$encoding.'"?>'."\n");
|
|
|
|
|
@ -175,7 +184,7 @@ class Export |
|
|
|
|
* @param int Level of recursivity. Allows the XML to be finely presented |
|
|
|
|
* @return string The XML string to be inserted into the root element |
|
|
|
|
*/ |
|
|
|
|
public static function _export_complex_table_xml_helper ($data, $level = 1) |
|
|
|
|
public static function _export_complex_table_xml_helper($data, $level = 1) |
|
|
|
|
{ |
|
|
|
|
if (count($data) < 1) { |
|
|
|
|
return ''; |
|
|
|
|
@ -259,6 +268,7 @@ class Export |
|
|
|
|
$row++; |
|
|
|
|
} |
|
|
|
|
$table_tp_html = $table->toHtml(); |
|
|
|
|
|
|
|
|
|
return $table_tp_html; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|