' . "\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 = agents_get_name($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 = agents_get_name($item['id_agent']); echo "\n"; } if (isset($agent)) echo "\n"; $agent = null; switch (io_safe_output($item['type'])) { case 1: case 'simple_graph': break; case 'simple_baseline_graph': break; case 2: case '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 = array(); 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 = agents_get_name($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 6: case 'monitor_report': break; case 7: case 'avg_value': break; case 8: case 'max_value': break; case 9: case 'min_value': break; case 10: case 'sumatory': break; case 'agent_detailed_event': case 'event_report_agent': 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 'event_report_module': break; case 'alert_report_module': break; case 'alert_report_agent': break; case 'url': echo ""; break; case 'database_serialized': echo ""; echo ""; echo ""; break; case 'TTRT': break; case 'TTO': break; case 'MTBF': break; case 'MTTR': 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 = array(); foreach ($items as $item){ echo "\n"; echo "" . $item['id'] . "\n"; //OLD ID USE FOR parent item 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"; } $agent = ''; if ($item['id_agent'] != 0) { $agent = agents_get_name($item['id_agent']); } 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 = agents_get_name($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['label_color'])) { echo "" . $item['label_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 = $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; if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { db_pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } $hook_enterprise = enterprise_include ('extensions/resource_exportation/functions.php'); ui_print_page_header (__('Resource exportation'), "images/extensions.png", false, "", true, "" ); echo "
"; echo __("This extension makes exportation of resource template more easy. " . "Here you can export as a resource template in Pandora FMS 3.x format (.ptr). "); echo "
"; echo "

"; $table = null; $table->width = '98%'; $table->style[0] = 'width: 30%;'; $table->style[1] = 'width: 10%;'; $table->class = "databox_color"; $table->data[0][0] = __('Report'); $table->data[0][1] = html_print_select_from_sql('SELECT id_report, name FROM treport', 'report', '', '', '', 0, true); $table->data[0][2] = html_print_button(__('Export'), '', false, 'export_to_ptr(\'report\');', 'class="sub"', true); $table->data[1][0] = __('Visual console'); $table->data[1][1] = html_print_select_from_sql('SELECT id, name FROM tlayout', 'visual_console', '', '', '', 0, true); $table->data[1][2] = html_print_button(__('Export'), '', false, 'export_to_ptr(\'visual_console\');', 'class="sub"', true); if ($hook_enterprise === true) add_rows_for_enterprise($table->data); html_print_table($table); ?>