/**
  * Export configuration data.
  *
  * $params structure:
  * array(
  * 	'options' => array(
  * 		'hosts' => array with host ids,
  * 		'templates' => array with templateids,
  *		 ...
  * 	),
  * 	'format' => 'json'|'xml'
  * )
  *
  * @param array $params
  *
  * @return string
  */
 public function export(array $params)
 {
     $export = new CConfigurationExport($params['options']);
     $export->setBuilder(new CConfigurationExportBuilder());
     $writer = CExportWriterFactory::getWriter($params['format']);
     $writer->formatOutput(false);
     $export->setWriter($writer);
     return $export->export();
 }
Beispiel #2
0
    $options = array('screenids' => $_REQUEST['screenid'], 'editable' => true, 'output' => API_OUTPUT_EXTEND, 'selectScreenItems' => API_OUTPUT_EXTEND);
    if (isset($_REQUEST['templateid'])) {
        $screens = API::TemplateScreen()->get($options);
    } else {
        $screens = API::Screen()->get($options);
    }
    if (empty($screens)) {
        access_deny();
    }
}
/*
 * Export
 */
if ($isExportData) {
    $screens = get_request('screens', array());
    $export = new CConfigurationExport(array('screens' => $screens));
    $export->setBuilder(new CConfigurationExportBuilder());
    $export->setWriter(CExportWriterFactory::getWriter(CExportWriterFactory::XML));
    $exportData = $export->export();
    if (!no_errors()) {
        show_messages();
    } else {
        print $exportData;
    }
    exit;
}
/*
 * Actions
 */
if (isset($_REQUEST['clone']) && isset($_REQUEST['screenid'])) {
    unset($_REQUEST['screenid']);