class CClock extends CDiv {
private $is_enabled = true;
public function __construct() {
$this->addClass(ZBX_STYLE_CLOCK);
public function setWidth($value) {
public function setHeight($value) {
public function setEnabled($is_enabled) {
$this->is_enabled = $is_enabled;
private function makeClockLine($width, $height, $x, $y, $deg) {
return (new CTag('rect', true))
->setAttribute('width', $width)
->setAttribute('height', $height)
->setAttribute('transform', 'rotate('.$deg.' 50 50)')
->addClass(ZBX_STYLE_CLOCK_LINES);
private function makeClockFace() {
(new CTag('circle', true))
->setAttribute('cx', '50')
->setAttribute('cy', '50')
->setAttribute('r', '50')
->addClass(ZBX_STYLE_CLOCK_FACE),
$this->makeClockLine('1.5', '5', '49.25', '5', '330'),
$this->makeClockLine('1.5', '5', '49.25', '5', '300'),
$this->makeClockLine('2.5', '7', '48.75', '5', '270'),
$this->makeClockLine('1.5', '5', '49.25', '5', '240'),
$this->makeClockLine('1.5', '5', '49.25', '5', '210'),
$this->makeClockLine('2.5', '7', '48.75', '5', '180'),
$this->makeClockLine('1.5', '5', '49.25', '5', '150'),
$this->makeClockLine('1.5', '5', '49.25', '5', '120'),
$this->makeClockLine('2.5', '7', '48.75', '5', '90'),
$this->makeClockLine('1.5', '5', '49.25', '5', '60'),
$this->makeClockLine('1.5', '5', '49.25', '5', '30'),
$this->makeClockLine('2.5', '7', '48.75', '5', '0')
private function makeClockHands() {
->setAttribute('width', '3.25')
->setAttribute('height', '24')
->setAttribute('x', '48.375')
->setAttribute('y', '26')
->setAttribute('rx', '1.5')
->setAttribute('ry', '1.5')
->addClass('clock-hand-h')
->addClass(ZBX_STYLE_CLOCK_HAND),
->setAttribute('width', '3.25')