summaryrefslogtreecommitdiffstats
path: root/frontends/php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-01-03 10:15:28 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-01-03 10:15:28 +0000
commitcf25f64f2acd722c391ecb8fff1ec4d058a27ff3 (patch)
tree9f8dda2178b1412d6e83f0e24bd0c8319deae041 /frontends/php
parent26905a61d0cec458a04a971a6751e18a021d1c92 (diff)
downloadzabbix-cf25f64f2acd722c391ecb8fff1ec4d058a27ff3.tar.gz
zabbix-cf25f64f2acd722c391ecb8fff1ec4d058a27ff3.tar.xz
zabbix-cf25f64f2acd722c391ecb8fff1ec4d058a27ff3.zip
PHP code cleanup. Use of class Ctable().
git-svn-id: svn://svn.zabbix.com/trunk@2485 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r--frontends/php/alarms.php11
-rw-r--r--frontends/php/alerts.php17
-rw-r--r--frontends/php/latestalarms.php13
-rw-r--r--frontends/php/report3.php28
4 files changed, 29 insertions, 40 deletions
diff --git a/frontends/php/alarms.php b/frontends/php/alarms.php
index 55df6e75..fd015dd3 100644
--- a/frontends/php/alarms.php
+++ b/frontends/php/alarms.php
@@ -69,13 +69,12 @@
$sql="select clock,value,triggerid from alarms where triggerid=".$_REQUEST["triggerid"]." order by clock desc $limit";
$result=DBselect($sql);
- table_begin();
- table_header(array(S_TIME,S_STATUS,S_DURATION,S_SUM,"%"));
+ $table = new Ctable();
+ $table->setHeader(array(S_TIME,S_STATUS,S_DURATION,S_SUM,"%"));
$truesum=0;
$falsesum=0;
$dissum=0;
$clock=mktime();
- $col=0;
while($row=DBfetch($result))
{
$lclock=$clock;
@@ -161,15 +160,15 @@
// table_td($sum,"");
// table_td($proc,"");
// echo "</TR>";
- table_row(array(
+ $table->addRow(array(
date("Y.M.d H:i:s",$row["clock"]),
$istrue,
$leng,
$sum,
$proc
- ),$col++);
+ ));
}
- table_end();
+ $table->show();
?>
<?php
diff --git a/frontends/php/alerts.php b/frontends/php/alerts.php
index 17d3c904..53b32116 100644
--- a/frontends/php/alerts.php
+++ b/frontends/php/alerts.php
@@ -88,8 +88,8 @@
}
$result=DBselect($sql);
- table_begin();
- table_header(array(S_TIME, S_TYPE, S_STATUS, S_RECIPIENTS, S_SUBJECT, S_MESSAGE, S_ERROR));
+ $table = new Ctable(S_NO_ALERTS);
+ $table->setHeader(array(S_TIME, S_TYPE, S_STATUS, S_RECIPIENTS, S_SUBJECT, S_MESSAGE, S_ERROR));
$col=0;
$zzz=0;
while($row=DBfetch($result))
@@ -123,23 +123,16 @@
{
$error=array("value"=>$row["error"],"class"=>"on");
}
- table_row(array(
+ $table->addRow(array(
$time,
$row["description"],
$status,
$sendto,
$subject,
$message,
- $error),
- $col++);
+ $error));
}
- if(DBnum_rows($result)==0)
- {
- echo "<TR BGCOLOR=#EEEEEE>";
- echo "<TD COLSPAN=7 ALIGN=CENTER>".S_NO_ALERTS."</TD>";
- echo "<TR>";
- }
- table_end();
+ $table->show();
?>
<?php
diff --git a/frontends/php/latestalarms.php b/frontends/php/latestalarms.php
index 70fe3ddc..745be4fa 100644
--- a/frontends/php/latestalarms.php
+++ b/frontends/php/latestalarms.php
@@ -148,8 +148,8 @@
$result=DBselect($sql);
- table_begin();
- table_header(array(S_TIME, S_DESCRIPTION, S_VALUE, S_SEVERITY));
+ $table = new Ctable();
+ $table->setHeader(array(S_TIME, S_DESCRIPTION, S_VALUE, S_SEVERITY));
$col=0;
$i=0;
while($row=DBfetch($result))
@@ -188,17 +188,14 @@
elseif($row["priority"]==5) $priority=array("value"=>S_DISASTER,"class"=>"disaster");
else $priority=$row["priority"];
- table_row(array(
+ $table->addRow(array(
date("Y.M.d H:i:s",$row["clock"]),
$description,
$value,
- $priority),
- $col++);
+ $priority));
}
- table_end();
+ $table->show();
?>
-</TR>
-</TABLE>
<?php
show_footer();
diff --git a/frontends/php/report3.php b/frontends/php/report3.php
index 56a94e07..af17df35 100644
--- a/frontends/php/report3.php
+++ b/frontends/php/report3.php
@@ -78,10 +78,10 @@
?>
<?php
- table_begin();
+ $table = new Ctable();
if($_REQUEST["period"]=="yearly")
{
- table_header(array(S_YEAR,S_OK,S_PROBLEMS,S_PERCENTAGE,S_SLA));
+ $table->setHeader(array(S_YEAR,S_OK,S_PROBLEMS,S_PERCENTAGE,S_SLA));
for($year=date("Y")-5;$year<=date("Y");$year++)
{
$start=mktime(0,0,0,1,1,$year);
@@ -112,18 +112,18 @@
{
$sla="-";
}
- table_row(array(
+ $table->addRow(array(
$year,
$ok,
$problems,
$percentage,
$sla
- ),$col++);
+ ));
}
}
else if($_REQUEST["period"]=="monthly")
{
- table_header(array(S_MONTH,S_OK,S_PROBLEMS,S_PERCENTAGE,S_SLA));
+ $table->setHeader(array(S_MONTH,S_OK,S_PROBLEMS,S_PERCENTAGE,S_SLA));
for($month=1;$month<=12;$month++)
{
$start=mktime(0,0,0,$month,1,$_REQUEST["year"]);
@@ -157,18 +157,18 @@
{
$sla="-";
}
- table_row(array(
+ $table->addRow(array(
date("M Y",$start),
$ok,
$problems,
$percentage,
$sla
- ),$col++);
+ ));
}
}
else if($_REQUEST["period"]=="daily")
{
- table_header(array(S_DAY,S_OK,S_PROBLEMS,S_PERCENTAGE,S_SLA));
+ $table->setHeader(array(S_DAY,S_OK,S_PROBLEMS,S_PERCENTAGE,S_SLA));
$s=mktime(0,0,0,1,1,$_REQUEST["year"]);
$e=mktime(0,0,0,1,1,$_REQUEST["year"]+1);
for($day=$s;$day<$e;$day+=24*3600)
@@ -204,19 +204,19 @@
{
$sla="-";
}
- table_row(array(
+ $table->addRow(array(
date("d M Y",$start),
$ok,
$problems,
$percentage,
$sla
- ),$col++);
+ ));
}
}
else
{
//--------Weekly-------------
- table_header(array(S_FROM,S_TILL,S_OK,S_PROBLEMS,S_PERCENTAGE,S_SLA));
+ $table->setHeader(array(S_FROM,S_TILL,S_OK,S_PROBLEMS,S_PERCENTAGE,S_SLA));
$col=0;
$year=date("Y");
for($year=date("Y")-2;$year<=date("Y");$year++)
@@ -269,19 +269,19 @@
$sla="-";
}
- table_row(array(
+ $table->addRow(array(
$from,
$till,
$ok,
$problems,
$percentage,
$sla
- ),$col++);
+ ));
}
}
//--------Weekly-------------
}
- table_end();
+ $table->show();
show_footer();
?>