mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Encapsulated some code to format a date into an human readable string into a function
This commit is contained in:
parent
c0320fd160
commit
a62791e9c0
@ -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']])) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user