summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/items.inc.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-01-10 12:39:49 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-01-10 12:39:49 +0000
commit370568ec852e6db2190a16d51f4d24abdb17651e (patch)
tree3ebd3b85b0a7f7c486aef3c689f23f959c9f6ae2 /frontends/php/include/items.inc.php
parent8d2a00e8977e1125b599c1960cc7bb6ea1c3b05c (diff)
- fixed values viwing on overview screen (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3682 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/items.inc.php')
-rw-r--r--frontends/php/include/items.inc.php44
1 files changed, 39 insertions, 5 deletions
diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php
index fc9d7e24..35989989 100644
--- a/frontends/php/include/items.inc.php
+++ b/frontends/php/include/items.inc.php
@@ -638,7 +638,7 @@
COpt::profiling_start('prepare data');
$result = DBselect('select distinct h.hostid, h.host,i.itemid, i.key_, i.value_type, i.lastvalue, i.units, '.
- ' i.description, t.priority, t.value as tr_value'.
+ ' i.description, t.priority, i.valuemapid, t.value as tr_value'.
' from hosts h,items i left join functions f on f.itemid=i.itemid left join triggers t on t.triggerid=f.triggerid '.
$group_where.
' h.hostid in ('.get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, null, null, $nodeid).') '.
@@ -656,6 +656,7 @@ COpt::profiling_start('prepare data');
'lastvalue' => $row['lastvalue'],
'units' => $row['units'],
'description' => $row['description'],
+ 'valuemapid' => $row['valuemapid'],
'severity' => $row['priority'],
'tr_value' => $row['tr_value']
);
@@ -687,11 +688,11 @@ COpt::profiling_start('prepare table');
if($ithosts[$hostname]['tr_value'] == TRIGGER_VALUE_TRUE)
$style = get_severity_style($ithosts[$hostname]['severity']);
- if($ithosts[$hostname]["value_type"] == 0)
- $value = convert_units($ithosts[$hostname]["lastvalue"],$ithosts[$hostname]["units"]);
- else
- $value = htmlspecialchars(substr($ithosts[$hostname]["lastvalue"],0,20)." ...");
+ $value = format_lastvalue($ithosts[$hostname]);
}
+
+ if($value == '-') $style = 'center';
+
array_push($table_row,new CCol($value,$style));
}
$table->AddRow($table_row);
@@ -776,4 +777,37 @@ COpt::profiling_stop('prepare table');
}
return DBexecute("delete from trends where itemid=$itemid");
}
+
+ function format_lastvalue($db_item)
+ {
+ if(isset($db_item["lastvalue"]))
+ {
+ if($db_item["value_type"] == ITEM_VALUE_TYPE_FLOAT)
+ {
+ $lastvalue=convert_units($db_item["lastvalue"],$db_item["units"]);
+ }
+ else if($db_item["value_type"] == ITEM_VALUE_TYPE_UINT64)
+ {
+ $lastvalue=convert_units($db_item["lastvalue"],$db_item["units"]);
+ }
+ else if($db_item["value_type"] == ITEM_VALUE_TYPE_TEXT)
+ {
+ $lastvalue="...";
+ }
+ else
+ {
+ $lastvalue=nbsp(htmlspecialchars(substr($db_item["lastvalue"],0,20)));
+ if(strlen($db_item["lastvalue"]) > 20)
+ $lastvalue .= " ...";
+ }
+ if($db_item["valuemapid"] > 0);
+ $lastvalue = replace_value_by_map($lastvalue, $db_item["valuemapid"]);
+
+ }
+ else
+ {
+ $lastvalue = "-";
+ }
+ return $lastvalue;
+ }
?>