$agent['id_agente'], 'name' => io_safe_output($agent['nombre']), 'ip' => io_safe_output($agent['direccion'])); } echo json_encode($data); return; } return; } // Load global vars require_once ("include/config.php"); require_once ("include/functions_agents.php"); require_once ("include/functions_reporting.php"); require_once ('include/functions_modules.php'); require_once ('include/functions_users.php'); check_login(); if (!check_acl ($config['id_user'], 0, "AR")) { require ("general/noaccess.php"); return; } ui_require_javascript_file ('calendar'); // Header ui_print_page_header (__("Export data"), "images/server_export.png"); $group = get_parameter_post ('group', 0); //$agent = get_parameter_post ('agent', 0); $agentName = get_parameter_post ('agent', 0); switch ($config["dbtype"]) { case "mysql": case "postgresql": $agents = agents_get_agents (array('nombre LIKE "' . $agentName . '"'), array ('id_agente')); break; case "oracle": $agents = agents_get_agents (array('nombre LIKE \'%' . $agentName . '%\''), array ('id_agente')); break; } $agent = $agents[0]['id_agente']; $module = (array) get_parameter_post ('module_arr', array ()); $start_date = get_parameter_post ('start_date', 0); $end_date = get_parameter_post ('end_date', 0); $start_time = get_parameter_post ('start_time', 0); $end_time = get_parameter_post ('end_time', 0); $export_type = get_parameter_post ('export_type', 'data'); $export_btn = get_parameter_post ('export_btn', 0); if (!empty ($export_btn) && !empty ($module)) { // Disable SQL cache global $sql_cache; $sql_cache = array ('saved' => 0); //Convert start time and end time to unix timestamps $start = strtotime ($start_date." ".$start_time); $end = strtotime ($end_date." ".$end_time); $period = $end - $start; $data = array (); //If time is negative or zero, don't process - it's invalid if ($start < 1 || $end < 1) { ui_print_error_message (__('Invalid time specified')); return; } // *************************************************** // Starts, ends and dividers // *************************************************** switch ($export_type) { case "data": case "avg": default: //HTML output - don't style or use XHTML just in case somebody needs to copy/paste it. (Office doesn't handle and
) $datastart = ''.__('Agent').' | '.__('Module').' | '.__('Data').' | '.__('Timestamp').' |
---|---|---|---|
'; $divider = ' | '; $rowend = ' |