".__('Pandora Agents')." » ".__('Export data').""; $group = get_parameter_post ('group', 1); $agent = get_parameter_post ('agent', 0); $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)) { //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) { print_error_message (__('Invalid time specified')); return; } // Data $data = array (); switch ($export_type) { case "data": case "excel": case "csv": foreach ($module as $selected) { $data_single = get_agentmodule_data ($selected, $period, $start); if (!empty ($data_single)) { $data = array_merge ($data, $data_single); } } break; case "avg": foreach ($module as $selected) { $arr = array (); $arr["data"] = get_agentmodule_data_average ($selected, $period, $start); if ($arr["data"] === false) { continue; } $arr["module_name"] = get_agentmodule_name ($selected); $arr["agent_name"] = get_agentmodule_agent_name ($selected); $arr["agent_id"] = get_agentmodule_agent ($selected); $arr["utimestamp"] = $end; array_push ($data, $arr); } break; default: print_error_message (__('Invalid method supplied')); return; break; } // 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 = ' |