Source
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
class CClock extends CDiv {
private $width;
private $height;
private $is_enabled = true;
public function __construct() {
parent::__construct();
$this->addClass(ZBX_STYLE_CLOCK);
}
public function setWidth($value) {
$this->width = $value;
return $this;
}
public function setHeight($value) {
$this->height = $value;
return $this;
}
public function setEnabled($is_enabled) {
$this->is_enabled = $is_enabled;
return $this;
}
private function makeClockLine($width, $height, $x, $y, $deg) {
return (new CTag('rect', true))
->setAttribute('width', $width)
->setAttribute('height', $height)
->setAttribute('x', $x)
->setAttribute('y', $y)
->setAttribute('transform', 'rotate('.$deg.' 50 50)')
->addClass(ZBX_STYLE_CLOCK_LINES);
}
private function makeClockFace() {
return [
(new CTag('circle', true))
->setAttribute('cx', '50')
->setAttribute('cy', '50')
->setAttribute('r', '50')
->addClass(ZBX_STYLE_CLOCK_FACE),