/usr/share/zabbix/include/classes/class.ctable.php is in zabbix-frontend-php 1:1.8.11-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | <?php
/*
** ZABBIX
** Copyright (C) 2000-2009 SIA Zabbix
**
** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
?>
<?php
class CTable extends CTag{
public $headerClass;
public $footerClass;
protected $oddRowClass;
protected $evenRowClass;
protected $header;
protected $footer;
protected $colnum;
protected $rownum;
protected $message;
public function __construct($message=NULL,$class=NULL){
parent::__construct('table','yes');
$this->setClass($class);
$this->rownum = 0;
$this->oddRowClass = NULL;
$this->evenRowClass = NULL;
$this->header = '';
$this->headerClass = NULL;
$this->footer = '';
$this->footerClass = NULL;
$this->colnum = 1;
$this->message = $message;
}
public function setOddRowClass($value=NULL){
$this->oddRowClass = $value;
}
public function setEvenRowClass($value=NULL){
$this->evenRowClass = $value;
}
public function setAlign($value){
return $this->attributes['align'] = $value;
}
public function setCellPadding($value){
return $this->attributes['cellpadding'] = strval($value);
}
public function setCellSpacing($value){
return $this->attributes['cellspacing'] = strval($value);
}
public function prepareRow($item,$rowClass=NULL){
if(is_null($item)) return NULL;
if(is_object($item) && zbx_strtolower(get_class($item))=='ccol') {
if(isset($this->header) && !isset($item->attributes['colspan']))
$item->attributes['colspan'] = $this->colnum;
$item = new CRow($item,$rowClass);
}
if(is_object($item) && zbx_strtolower(get_class($item))=='crow') {
if(isset($rowClass))
$item->setClass($rowClass);
}
else{
$item = new CRow($item,$rowClass);
}
if(!isset($item->attributes['class']) || is_array($item->attributes['class'])){
$class = ($this->rownum % 2)?$this->oddRowClass:$this->evenRowClass;
$item->setClass($class);
$item->setAttribute('origClass', $class);
}
return $item;
}
public function setHeader($value=NULL,$class='header'){
if(isset($_REQUEST['print'])) hide_form_items($value);
if(is_null($class)) $class = $this->headerClass;
if(is_object($value) && zbx_strtolower(get_class($value))=='crow') {
if(!is_null($class)) $value->setClass($class);
}
else{
$value = new CRow($value,$class);
}
$this->colnum = $value->itemsCount();
$this->header = $value->toString();
}
public function setFooter($value=NULL,$class='footer'){
if(isset($_REQUEST['print'])) hide_form_items($value);
if(is_null($class)) $class = $this->footerClass;
$this->footer = $this->prepareRow($value,$class);
$this->footer = $this->footer->toString();
}
public function addRow($item,$rowClass=NULL){
$item = $this->addItem($this->prepareRow($item,$rowClass));
++$this->rownum;
return $item;
}
public function showRow($item,$rowClass=NULL){
echo $this->prepareRow($item,$rowClass)->toString();
//---------------
++$this->rownum;
}
public function getNumRows(){
return $this->rownum;
}
/* protected */
public function startToString(){
$ret = parent::startToString();
$ret .= $this->header;
return $ret;
}
public function endToString(){
$ret = '';
if($this->rownum == 0 && isset($this->message)) {
$ret = $this->prepareRow(new CCol($this->message,'message'));
$ret = $ret->toString();
}
$ret .= $this->footer;
$ret .= parent::endToString();
return $ret;
}
}
?>
|