createXMLForExport() public static méthode

Create an XML-string that can be used for export.
public static createXMLForExport ( array $items ) : string
$items array The items.
Résultat string
Exemple #1
0
 /**
  * Create the XML based on the locale items.
  */
 private function createXML()
 {
     $charset = BackendModel::getContainer()->getParameter('kernel.charset');
     // create XML
     $xmlOutput = BackendLocaleModel::createXMLForExport($this->locale);
     // xml headers
     header('Content-Disposition: attachment; filename="locale_' . BackendModel::getUTCDate('d-m-Y') . '.xml"');
     header('Content-Type: application/octet-stream;charset=' . $charset);
     header('Content-Length: ' . strlen($xmlOutput));
     // output XML
     echo $xmlOutput;
     exit;
 }
Exemple #2
0
 /**
  * Create the XML based on the locale items.
  */
 public function getContent()
 {
     $charset = BackendModel::getContainer()->getParameter('kernel.charset');
     // create XML
     $xmlOutput = BackendLocaleModel::createXMLForExport($this->locale);
     return new Response($xmlOutput, Response::HTTP_OK, ['Content-Disposition' => 'attachment; filename="locale_' . BackendModel::getUTCDate('d-m-Y') . '.xml"', 'Content-Type' => 'application/octet-stream;charset=' . $charset, 'Content-Length' => '' . mb_strlen($xmlOutput)]);
 }