diff options
Diffstat (limited to 'frontends/php/include/classes/html/CTableInfo.php')
-rw-r--r-- | frontends/php/include/classes/html/CTableInfo.php | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/frontends/php/include/classes/html/CTableInfo.php b/frontends/php/include/classes/html/CTableInfo.php new file mode 100644 index 00000000000..d744ecdb0f7 --- /dev/null +++ b/frontends/php/include/classes/html/CTableInfo.php @@ -0,0 +1,89 @@ +<?php +/* +** Zabbix +** Copyright (C) 2001-2014 Zabbix SIA +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** 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 General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +**/ + + +class CTableInfo extends CTable { + + public function __construct($message = '...', $class = 'tableinfo') { + parent::__construct($message, $class); + $this->setOddRowClass('odd_row'); + $this->setEvenRowClass('even_row'); + $this->attributes['cellpadding'] = 3; + $this->attributes['cellspacing'] = 1; + $this->headerClass = 'header'; + $this->footerClass = 'footer'; + $this->addMakeVerticalRotationJs = false; + } + + public function toString($destroy = true) { + $tableId = $this->getAttribute('id'); + + if(!$tableId) { + $tableId = uniqid('t'); + $this->setAttribute('id', $tableId); + } + + $string = parent::toString($destroy); + + if($this->addMakeVerticalRotationJs) { + $string .= get_js( + 'var makeVerticalRotationForTable = function() { + var table = jQuery("#'.$tableId.'"); + + table.makeVerticalRotation(); + + if (IE8) { + jQuery(".vertical_rotation_inner", table).css({ + filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)" + }); + } + else if (IE9) { + jQuery(".vertical_rotation_inner", table).css({ + "-ms-transform": "rotate(270deg)" + }); + } + + if (!IE9) { + jQuery(".vertical_rotation_inner", table).css({ + "writing-mode": "tb-rl" + }); + } + } + + if(!jQuery.isReady) { + jQuery(document).ready(makeVerticalRotationForTable); + } + else { + makeVerticalRotationForTable(); + }', + true); + } + + return $string; + } + + /** + * Rotate table header text vertical. + * Cells must be marked with "vertical_rotation" class. + */ + public function makeVerticalRotation() { + $this->addMakeVerticalRotationJs = true; + } +} |