summaryrefslogtreecommitdiffstats
path: root/frontends/php/latest.php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-02-07 08:29:46 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-02-07 08:29:46 +0000
commit7c3b021cb3ad21db99d7d4d912ef659577d25fcd (patch)
tree336e53be7ebbf74c8e4dcf63e4bac944779094ab /frontends/php/latest.php
parentf0e67a7e2be2671c3750f3959534de002ed8ed3e (diff)
downloadzabbix-7c3b021cb3ad21db99d7d4d912ef659577d25fcd.tar.gz
zabbix-7c3b021cb3ad21db99d7d4d912ef659577d25fcd.tar.xz
zabbix-7c3b021cb3ad21db99d7d4d912ef659577d25fcd.zip
Frontend improvements.
git-svn-id: svn://svn.zabbix.com/trunk@2615 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/latest.php')
-rw-r--r--frontends/php/latest.php88
1 files changed, 48 insertions, 40 deletions
diff --git a/frontends/php/latest.php b/frontends/php/latest.php
index 66215c58..170fd62c 100644
--- a/frontends/php/latest.php
+++ b/frontends/php/latest.php
@@ -174,7 +174,7 @@
# echo "<a href=\"latest.php?hostid=".$_REQUEST["hostid"]."\">$host</a>";
# show_table3_v_delimiter();
- table_begin();
+// table_begin();
$header=array();
if(isset($_REQUEST["select"]))
{
@@ -182,7 +182,10 @@
}
$header=array_merge($header,array(S_DESCRIPTION, S_LAST_CHECK, S_LAST_VALUE,S_CHANGE,S_HISTORY));
- table_header($header);
+ $table=new CTableInfo();
+ $table->setHeader($header);
+
+// table_header($header);
$col=0;
if(isset($_REQUEST["select"]))
@@ -200,73 +203,78 @@
{
continue;
}
- iif_echo($col++%2 == 1,
- "<tr bgcolor=#DDDDDD>",
- "<tr bgcolor=#EEEEEE>");
+// iif_echo($col++%2 == 1,
+// "<tr bgcolor=#DDDDDD>",
+// "<tr bgcolor=#EEEEEE>");
+ $host=NULL;
if(isset($_REQUEST["select"]))
{
- table_td($row["host"],"");
+ $host=$row["host"];
}
- table_td(item_description($row["description"],$row["key_"]),"");
+ $description = item_description($row["description"],$row["key_"]);
- echo "<td>";
- if($row["status"] == 2)
+ if(isset($row["lastclock"]))
{
- echo "<font color=\"#FF6666\">";
+ $lastclock=date(S_DATE_FORMAT_YMDHMS,$row["lastclock"]);
+ }
+ else
+ {
+ $lastclock="-";
}
-
- iif_echo(!isset($row["lastclock"]),
- "<div align=center>-</div>",
- date(S_DATE_FORMAT_YMDHMS,$row["lastclock"]));
- echo "</font></td>";
if(isset($row["lastvalue"]))
{
- iif_echo( ($row["value_type"] == ITEM_VALUE_TYPE_FLOAT) || ($row["value_type"] == ITEM_VALUE_TYPE_UINT64),
- "<td>".convert_units($row["lastvalue"],$row["units"])."</td>",
- "<td>".nbsp(htmlspecialchars(substr($row["lastvalue"],0,20)." ..."))."</td>");
+ if(($row["value_type"] == ITEM_VALUE_TYPE_FLOAT) || ($row["value_type"] == ITEM_VALUE_TYPE_UINT64))
+ {
+ $lastvalue=convert_units($row["lastvalue"],$row["units"]);
+ }
+ else
+ {
+ $lastvalue=nbsp(htmlspecialchars(substr($row["lastvalue"],0,20)." ..."));
+ }
}
else
{
- table_td("-","align=center");
+ $lastvalue=new CCol("-","center");
}
if( isset($row["lastvalue"]) && isset($row["prevvalue"]) &&
($row["value_type"] == 0) && ($row["lastvalue"]-$row["prevvalue"] != 0) )
{
-// echo "<td>"; echo $row["lastvalue"]-$row["prevvalue"]; echo "</td>";
-// sprintf("%+0.2f"); does not work
if($row["lastvalue"]-$row["prevvalue"]<0)
{
- $str=convert_units($row["lastvalue"]-$row["prevvalue"],$row["units"]);
- $str=nbsp($str);
- table_td($str,"");
+ $change=convert_units($row["lastvalue"]-$row["prevvalue"],$row["units"]);
+ $change=nbsp($change);
}
else
{
- $str="+".convert_units($row["lastvalue"]-$row["prevvalue"],$row["units"]);
- $str=nbsp($str);
- table_td($str,"");
-// printf("<td>+%0.2f</td>",$row["lastvalue"]-$row["prevvalue"]);
+ $change="+".convert_units($row["lastvalue"]-$row["prevvalue"],$row["units"]);
+ $change=nbsp($change);
}
}
else
{
- echo "<td align=center>-</td>";
+ $change=new CCol("-","center");
+ }
+ if(($row["value_type"]==ITEM_VALUE_TYPE_FLOAT) ||($row["value_type"]==ITEM_VALUE_TYPE_UINT64))
+ {
+ $actions=new CLink(S_GRAPH,"history.php?action=showhistory&itemid=".$row["itemid"],"action");
+ }
+ else
+ {
+ $actions=new CLink(S_HISTORY,"history.php?action=showvalues&period=3600&itemid=".$row["itemid"],"action");
}
- iif_echo(($row["value_type"]==ITEM_VALUE_TYPE_FLOAT) ||($row["value_type"]==ITEM_VALUE_TYPE_UINT64),
- "<td align=center><a href=\"history.php?action=showhistory&itemid=".$row["itemid"]."\">".S_GRAPH."</a></td>",
- "<td align=center><a href=\"history.php?action=showvalues&period=3600&itemid=".$row["itemid"]."\">".S_HISTORY."</a></td>");
- echo "</tr>";
- cr();
+ $table->addRow(array(
+ $host,
+ $description,
+ $lastclock,
+ $lastvalue,
+ $change,
+ $actions
+ ));
}
- table_end();
- show_table_header_end();
- }
- else
- {
- table_nodata();
+ $table->show();
}
?>