diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-04-19 14:47:21 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-04-19 14:47:21 +0000 |
| commit | 979fcceb99e555800fdfbc2cecf4ba585e780b73 (patch) | |
| tree | 1c00b2ade37f4fa1ef285c070ddfe3e0d4a70247 /frontends/php/include/items.inc.php | |
| parent | d4f46d541400d6a6a55924d27c9c43430aade509 (diff) | |
| download | zabbix-979fcceb99e555800fdfbc2cecf4ba585e780b73.tar.gz zabbix-979fcceb99e555800fdfbc2cecf4ba585e780b73.tar.xz zabbix-979fcceb99e555800fdfbc2cecf4ba585e780b73.zip | |
- code optimization (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2744 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/items.inc.php')
| -rw-r--r-- | frontends/php/include/items.inc.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php index 4f6e074b..45213f30 100644 --- a/frontends/php/include/items.inc.php +++ b/frontends/php/include/items.inc.php @@ -469,26 +469,25 @@ $header=array(new CCol(S_ITEMS,"center")); $hosts=array(); - $result=DBselect("select h.hostid,h.host from hosts h,items i $group_where". + $result=DBselect("select distinct h.hostid,h.host from hosts h,items i $group_where". " h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid and i.status=".ITEM_STATUS_ACTIVE. " group by h.host,h.hostid order by h.host"); while($row=DBfetch($result)) { - if(!check_right("Host","R",$row["hostid"])) continue; //TODO optimize duplication check !!!! see buttom + if(!check_right("Host","R",$row["hostid"])) continue; array_push($header,new CImg("vtext.php?text=".$row["host"])); array_push($hosts,$row["hostid"]); } $table->SetHeader($header,"vertical_header"); - $db_items = DBselect("select distinct i.description,h.hostid from hosts h,items i $group_where". + $db_items = DBselect("select distinct i.description from hosts h,items i $group_where". " h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid and i.status=".ITEM_STATUS_ACTIVE. " order by 1"); while($item = DBfetch($db_items)) { - if(!check_right("Host","R",$row["hostid"])) continue; //TODO optimize duplication check !!!! see top - $table_row = array(nbsp($item["description"])); + $host_added = 0; foreach($hosts as $hostid) { $db_host_items = DBselect("select itemid,value_type,lastvalue,units from items where". @@ -502,6 +501,7 @@ if(!check_right("Item","R",$host_item["itemid"])) continue; + ++$host_added; // added corect host item; if(!isset($host_item["lastvalue"])) { array_push($table_row,"-"); @@ -521,7 +521,7 @@ array_push($table_row,new CCol(nbsp($value),$style)); } - $table->AddRow($table_row); + if($host_added > 0) $table->AddRow($table_row); } return $table; } |
