'."\n"; echo "\n"; echo '\n"; if (isset($report['description'])) { echo '\n"; } $group = db_get_value('nombre', 'tgrupo', 'id_grupo', $report['id_group']); echo '\n"; $items = db_get_all_rows_field_filter( 'treport_content', 'id_report', $report['id_report'] ); foreach ($items as $item) { echo "\n"; echo ''.io_safe_output($item['type'])."\n"; echo ''.io_safe_output($item['description'])."\n"; echo ''.io_safe_output($item['period'])."\n"; if ($item['id_agent'] != 0) { $agent = db_get_value('alias', 'tagente', 'id_agente', $item['id_agent']); } if ($item['id_agent_module'] != 0) { $module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $item['id_agent_module']); $id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $item['id_agent_module']); $agent = db_get_value('alias', 'tagente', 'id_agente', $item['id_agent']); echo '\n"; } if (isset($agent)) { echo '\n"; } $agent = null; switch (io_safe_output($item['type'])) { case 2: case 'custom_graph': case 'automatic_custom_graph': $graph = db_get_value('name', 'tgraph', 'id_graph', $item['id_gs']); echo '\n"; break; case 3: case 'SLA': echo ''.$item['only_display_wrong']."\n"; echo ''.$item['monday']."\n"; echo ''.$item['tuesday']."\n"; echo ''.$item['wednesday']."\n"; echo ''.$item['thursday']."\n"; echo ''.$item['friday']."\n"; echo ''.$item['saturday']."\n"; echo ''.$item['sunday']."\n"; echo ''.$item['time_from']."\n"; echo ''.$item['time_to']."\n"; $slas = db_get_all_rows_field_filter('treport_content_sla_combined', 'id_report_content', $item['id_rc']); if ($slas === false) { $slas = []; } foreach ($slas as $sla) { $module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $sla['id_agent_module']); $id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $sla['id_agent_module']); $agent = db_get_value('alias', 'tagente', 'id_agente', $item['id_agent']); echo ''; echo '\n"; echo '\n"; echo ''.$sla['sla_max']."\n"; echo ''.$sla['sla_min']."\n"; echo ''.$sla['sla_limit']."\n"; echo ''; } break; case 'text': echo '\n"; break; case 'sql': echo '\n"; if (!empty($item['external_source'])) { echo '\n"; } else { $sql = db_get_value('sql', 'treport_custom_sql', 'id', $item['treport_custom_sql_id']); echo ''.io_safe_output($sql)."\n"; } break; case 'sql_graph_pie': case 'sql_graph_vbar': case 'sql_graph_hbar': echo ''.io_safe_output($item['header_definition'])."\n"; if (!empty($item['external_source'])) { echo ''.io_safe_output($item['external_source'])."\n"; } else { $sql = db_get_value('sql', 'treport_custom_sql', 'id', $item['treport_custom_sql_id']); echo ''.io_safe_output($sql)."\n"; } break; case 'event_report_group': $group = db_get_value('nombre', 'tgrupo', 'id_grupo', $item['id_agent']); echo '\n"; break; case 'url': echo ''; break; case 'database_serialized': echo ''; echo ''; echo ''; break; case 1: case 'simple_graph': case 'simple_baseline_graph': case 6: case 'monitor_report': case 7: case 'avg_value': case 8: case 'max_value': case 9: case 'min_value': case 10: case 'sumatory': case 'agent_detailed_event': case 'event_report_agent': case 'event_report_module': case 'alert_report_module': case 'alert_report_agent': case 'alert_report_group': default: // Do nothing. break; } echo "\n"; } echo "\n"; } function output_xml_visual_console($id) { $visual_map = db_get_row('tlayout', 'id', $id); echo ''."\n"; echo "\n"; echo '\n"; if ($visual_map['id_group'] != 0) { $group = db_get_value('nombre', 'tgrupo', 'id_grupo', $visual_map['id_group']); echo '\n"; } echo '\n"; echo ''.io_safe_output($visual_map['height'])."\n"; echo ''.io_safe_output($visual_map['width'])."\n"; $items = db_get_all_rows_field_filter('tlayout_data', 'id_layout', $visual_map['id']); if ($items === false) { $items = []; } foreach ($items as $item) { echo "\n"; echo ''.$item['id']."\n"; // OLD ID USE FOR parent item $agent = ''; if ($item['id_agent'] != 0) { $agent = db_get_value('nombre', 'tagente', 'id_agente', $item['id_agent']); } if (!empty($item['label'])) { echo '\n"; } echo ''.$item['pos_x']."\n"; echo ''.$item['pos_y']."\n"; echo ''.$item['type']."\n"; if ($item['width'] != 0) { echo ''.$item['width']."\n"; } if ($item['height'] != 0) { echo ''.$item['height']."\n"; } if (!empty($item['image'])) { echo ''.$item['image']."\n"; } if ($item['period'] != 0) { echo ''.$item['period']."\n"; } if (isset($item['id_agente_modulo'])) { if ($item['id_agente_modulo'] != 0) { $module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']); $id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']); $agent = db_get_value('nombre', 'tagente', 'id_agente', $id_agent); echo '\n"; } } if (!empty($agent)) { echo '\n"; } if ($item['id_layout_linked'] != 0) { echo ''.$item['id_layout_linked']."\n"; } if ($item['parent_item'] != 0) { echo ''.$item['parent_item']."\n"; } if (!empty($item['clock_animation'])) { echo ''.$item['clock_animation']."\n"; } if (!empty($item['fill_color'])) { echo ''.$item['fill_color']."\n"; } if (!empty($item['type_graph'])) { echo ''.$item['type_graph']."\n"; } if (!empty($item['time_format'])) { echo ''.$item['time_format']."\n"; } if (!empty($item['timezone'])) { echo ''.$item['timezone']."\n"; } if (!empty($item['border_width'])) { echo ''.$item['border_width']."\n"; } if (!empty($item['border_color'])) { echo ''.$item['border_color']."\n"; } echo "\n"; } echo "\n"; } function get_name_xml_resource($hook_enterprise) { global $config; $type = get_parameter('type'); $id = (int) get_parameter('id'); switch ($type) { case 'report': $name = db_get_value('name', 'treport', 'id_report', $id); break; case 'visual_console': $name = db_get_value('name', 'tlayout', 'id', $id); break; default: if ($hook_enterprise === true) { return enterprise_get_name_xml_resource($type, $id); } break; } $file = io_safe_output($name).'.ptr'; return $file; } function get_xml_resource() { global $config; $hook_enterprise = enterprise_include('extensions/resource_exportation/functions.php'); } function resource_exportation_extension_main() { global $config; check_login(); if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { db_pandora_audit( AUDIT_LOG_ACL_VIOLATION, 'Trying to access Setup Management' ); include 'general/noaccess.php'; return; } $hook_enterprise = enterprise_include('extensions/resource_exportation/functions.php'); ui_print_standard_header( __('Resource exportation'), 'images/extensions.png', false, '', true, [], [ [ 'link' => '', 'label' => __('Resources'), ], [ 'link' => '', 'label' => __('Resource exporting'), ], ] ); ui_print_warning_message( __('This extension makes exportation of resource template more easy.').'
'.__('You can export resource templates in .ptr format.') ); $table = new stdClass(); $table->class = 'databox filter-table-adv'; $table->id = 'resource_exportation_table'; $table->style = []; $table->style[0] = 'width: 30%'; $table->style[1] = 'vertical-align: bottom;'; $table->data = []; $table->data[0][] = html_print_label_input_block( __('Report'), html_print_div( [ 'class' => 'flex-content-left', 'content' => html_print_select_from_sql('SELECT id_report, name FROM treport', 'report', '', '', '', 0, true), ], true ) ); $table->data[0][] = html_print_button(__('Export'), '', false, 'export_to_ptr("report");', '', true); $table->data[1][] = html_print_label_input_block( __('Visual console'), html_print_div( [ 'class' => 'flex-content-left', 'content' => html_print_select_from_sql('SELECT id, name FROM tlayout', 'visual_console', '', '', '', 0, true), ], true ) ); $table->data[1][] = html_print_button(__('Export'), '', false, 'export_to_ptr("visual_console");', '', true); if ($hook_enterprise === true) { add_rows_for_enterprise($table->data); } html_print_table($table); ?>