diff options
Diffstat (limited to 'ui/include/classes/graph/CSvgGraph.php')
-rw-r--r-- | ui/include/classes/graph/CSvgGraph.php | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/ui/include/classes/graph/CSvgGraph.php b/ui/include/classes/graph/CSvgGraph.php index d2b491b71c0..cea94fe3c44 100644 --- a/ui/include/classes/graph/CSvgGraph.php +++ b/ui/include/classes/graph/CSvgGraph.php @@ -390,13 +390,19 @@ class CSvgGraph extends CSvg { */ if ($step == 0) { return [ - 0 => date('H:i:s', $this->time_from), - $this->canvas_width => date('H:i:s', $this->time_till) + 0 => zbx_date2str(TIME_FORMAT_SECONDS, $this->time_from), + $this->canvas_width => zbx_date2str(TIME_FORMAT_SECONDS, $this->time_till) ]; } $start = $this->time_from + $step - $this->time_from % $step; - $time_formats = ['Y-n-d', 'n-d', 'n-d H:i','H:i', 'H:i:s']; + $time_formats = [ + SVG_GRAPH_DATE_FORMAT, + SVG_GRAPH_DATE_FORMAT_SHORT, + SVG_GRAPH_DATE_TIME_FORMAT_SHORT, + TIME_FORMAT, + TIME_FORMAT_SECONDS + ]; // Search for most appropriate time format. foreach ($time_formats as $fmt) { @@ -404,7 +410,7 @@ class CSvgGraph extends CSvg { for ($clock = $start; $this->time_till >= $clock; $clock += $step) { $relative_pos = round($this->canvas_width - $this->canvas_width * ($this->time_till - $clock) / $period); - $grid_values[$relative_pos] = date($fmt, $clock); + $grid_values[$relative_pos] = zbx_date2str($fmt, $clock); } /** @@ -1084,16 +1090,23 @@ class CSvgGraph extends CSvg { } } + $clock_fmt = ($problem['clock'] >= $today) + ? zbx_date2str(TIME_FORMAT_SECONDS, $problem['clock']) + : zbx_date2str(DATE_TIME_FORMAT_SECONDS, $problem['clock']); + + if ($problem['r_clock'] != 0) { + $r_clock_fmt = ($problem['r_clock'] >= $today) + ? zbx_date2str(TIME_FORMAT_SECONDS, $problem['r_clock']) + : zbx_date2str(DATE_TIME_FORMAT_SECONDS, $problem['r_clock']); + } + else { + $r_clock_fmt = ''; + } + $info = [ 'name' => $problem['name'], - 'clock' => ($problem['clock'] >= $today) - ? zbx_date2str(TIME_FORMAT_SECONDS, $problem['clock']) - : zbx_date2str(DATE_TIME_FORMAT_SECONDS, $problem['clock']), - 'r_clock' => ($problem['r_clock'] != 0) - ? ($problem['r_clock'] >= $today) - ? zbx_date2str(TIME_FORMAT_SECONDS, $problem['r_clock']) - : zbx_date2str(DATE_TIME_FORMAT_SECONDS, $problem['r_clock']) - : '', + 'clock' => $clock_fmt, + 'r_clock' => $r_clock_fmt, 'url' => (new CUrl('tr_events.php')) ->setArgument('triggerid', $problem['objectid']) ->setArgument('eventid', $problem['eventid']) |