public function actionExportone($id) { // set headers header("Pragma: no-cache"); header("Expires: 0"); header("Content-Description: File Transfer"); header("Content-Type: text/xml"); header("Content-Disposition: attachment; filename=\"lazy8webExport.Templates." . CompanyController::replace_bad_filename_chars(Yii::app()->user->getState('selectedCompanyName')) . "." . date('Y-m-d_H.i.s') . ".xml\""); header("Content-Transfer-Encoding: binary"); $writer = new XMLWriter(); $writer->openURI('php://output'); $writer->startDocument('1.0', 'utf-8'); $writer->setIndent(4); $writer->startElement('lazy8webtemplates'); $writer->writeAttribute('version', '1.00'); Template::exportTemplate($writer, $id); $writer->endElement(); $writer->endDocument(); $writer->flush(); }
/** * @return array Errors Export Account information */ public static function exportAllTemplates($writer, $companyId) { $templates = Template::model()->findAll(array('order' => 'sortOrder', 'condition' => 'companyId=' . $companyId)); foreach ($templates as $template) { Template::exportTemplate($writer, $template->id); } }