public static function doExport($document) { self::$exportFile = self::getExportFilePath(); self::openExportFile(); self::exportDocument($document); self::closeExportFile(); return self::$exportFile; }
public function exportAction() { try { $documentId = $this->getParam("documentId"); $document = Document::getById($documentId); $exportFile = PimPon_Document_Export::doExport($document); ob_end_clean(); header("Content-type: application/json"); header("Content-Disposition: attachment; filename=\"pimponexport.documents." . $document->getKey() . ".json\""); echo file_get_contents($exportFile); exit; } catch (Exception $ex) { Logger::err($ex->getMessage()); $this->_helper->json(array("success" => false, "data" => 'error'), false); } }