From a62791e9c0e9cc690329ca7dc9301718c4e987cf Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Fri, 3 Jul 2015 12:51:47 +0200 Subject: [PATCH] Encapsulated some code to format a date into an human readable string into a function --- .../include/functions_reporting.php | 55 +------------------ 1 file changed, 1 insertion(+), 54 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 3cae99783e..93d7c60ad3 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -598,60 +598,7 @@ function reporting_SLA($report, $content, $type = 'dinamic', $data['name'] = $planned_downtime['name']; $data['description'] = $planned_downtime['description']; $data['execution'] = ucfirst($planned_downtime['type_execution']); - $data['dates'] = ""; - switch ($planned_downtime['type_execution']) { - case 'once': - $data['dates'] = date ("Y-m-d H:i", $planned_downtime['date_from']) . - " " . __('to') . " ". - date ("Y-m-d H:i", $planned_downtime['date_to']); - break; - case 'periodically': - switch ($planned_downtime['type_periodicity']) { - case 'weekly': - $data['dates'] = __('Weekly:'); - $data['dates'] .= " "; - if ($planned_downtime['monday']) { - $data['dates'] .= __('Mon'); - $data['dates'] .= " "; - } - if ($planned_downtime['tuesday']) { - $data['dates'] .= __('Tue'); - $data['dates'] .= " "; - } - if ($planned_downtime['wednesday']) { - $data['dates'] .= __('Wed'); - $data['dates'] .= " "; - } - if ($planned_downtime['thursday']) { - $data['dates'] .= __('Thu'); - $data['dates'] .= " "; - } - if ($planned_downtime['friday']) { - $data['dates'] .= __('Fri'); - $data['dates'] .= " "; - } - if ($planned_downtime['saturday']) { - $data['dates'] .= __('Sat'); - $data['dates'] .= " "; - } - if ($planned_downtime['sunday']) { - $data['dates'] .= __('Sun'); - $data['dates'] .= " "; - } - $data['dates'] .= "(" . $planned_downtime['periodically_time_from']; - $data['dates'] .= "-" . $planned_downtime['periodically_time_to'] . ")"; - break; - case 'monthly': - $data['dates'] = __('Monthly:') . " "; - $data['dates'] .= __('From day') . " " . $planned_downtime['periodically_day_from']; - $data['dates'] .= " " . strtolower(__('To day')) . " "; - $data['dates'] .= $planned_downtime['periodically_day_to']; - $data['dates'] .= " (" . $planned_downtime['periodically_time_from']; - $data['dates'] .= "-" . $planned_downtime['periodically_time_to'] . ")"; - break; - } - break; - } + $data['dates'] = reporting_format_planned_downtime_dates($planned_downtime); $data['malformed'] = 0; if (!$malformed_planned_downtimes_empty && isset($malformed_planned_downtimes[$planned_downtime['id']])) {