Пример #1
0
        $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']);
    $_REQUEST['form'] = 'clone';
} elseif (isset($_REQUEST['save'])) {
    if (isset($_REQUEST['screenid'])) {
        $screen = array('screenid' => $_REQUEST['screenid'], 'name' => $_REQUEST['name'], 'hsize' => $_REQUEST['hsize'], 'vsize' => $_REQUEST['vsize']);
        access_deny();
    }
}
if (get_request('templateid', 0) > 0) {
    $hostids = available_hosts($_REQUEST['templateid'], 1);
    if (empty($hostids)) {
        access_deny();
    }
}
$templateids = get_request('templates', array());
if ($EXPORT_DATA) {
    $export = new CConfigurationExport(array('templates' => $templateids));
    $export->setBuilder(new CConfigurationExportBuilder());
    $export->setWriter(CExportWriterFactory::getWriter(CExportWriterFactory::XML));
    $exportData = $export->export();
    if (no_errors()) {
        print $exportData;
    } else {
        show_messages();
    }
    exit;
}
/**********************************/
/* <<<--- TEMPLATE ACTIONS --->>> */
/**********************************/
/**
 * Unlink, unlink_and_clear
 */
if (isset($_REQUEST['unlink']) || isset($_REQUEST['unlink_and_clear'])) {
    $_REQUEST['clear_templates'] = get_request('clear_templates', array());
    if (isset($_REQUEST['unlink'])) {