diff options
| author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-10-26 13:07:57 +0000 |
|---|---|---|
| committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-10-26 13:07:57 +0000 |
| commit | 3ad9ec2c7d4be13068a49fb19a1fb8f3781dd485 (patch) | |
| tree | aa2576f5266f28ddd94a7a22b15270802e1d8339 /frontends/php/include/classes | |
| parent | 20dfeb5d1966879f9d76e69cab4872831119ba9f (diff) | |
- [DEV-57] added better "hosts info" selection in screens (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@4920 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/classes')
| -rw-r--r-- | frontends/php/include/classes/chostsinfo.mod.php | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/frontends/php/include/classes/chostsinfo.mod.php b/frontends/php/include/classes/chostsinfo.mod.php index 00644ed8..44f5bec5 100644 --- a/frontends/php/include/classes/chostsinfo.mod.php +++ b/frontends/php/include/classes/chostsinfo.mod.php @@ -22,10 +22,12 @@ class CHostsInfo extends CTable { //var $style; - function CHostsInfo($style = STYLE_HORISONTAL) + function CHostsInfo($groupid=0, $style = STYLE_HORISONTAL) { + $this->nodeid = id2nodeid($groupid); + $this->groupid = $groupid; $this->style = null; - + parent::CTable(NULL,"hosts_info"); $this->SetOrientation($style); } @@ -40,21 +42,51 @@ function BodyToString() { + global $USER_DETAILS; $this->CleanItems(); - $db_host_cnt = DBselect("select count(*) as cnt from hosts where available=".HOST_AVAILABLE_TRUE); + $accessible_groups = get_accessible_groups_by_user($USER_DETAILS,PERM_READ_ONLY); + + $cond = (remove_nodes_from_id($this->groupid)>0)?(' AND hg.groupid='.zbx_dbstr($this->groupid)):(' AND '.DBin_node('hg.groupid', $this->nodeid)); + + $db_host_cnt = DBselect('SELECT COUNT(*) as cnt '. + ' FROM hosts h, hosts_groups hg'. + ' WHERE h.available='.HOST_AVAILABLE_TRUE. + ' AND hg.groupid IN ('.$accessible_groups.') '.$cond); + $host_cnt = DBfetch($db_host_cnt); - $avail = $host_cnt["cnt"]; + $avail = $host_cnt['cnt']; + + $db_host_cnt = DBselect('SELECT COUNT(*) as cnt '. + ' FROM hosts h, hosts_groups hg'. + ' WHERE h.available='.HOST_AVAILABLE_FALSE. + ' AND hg.groupid IN ('.$accessible_groups.') '.$cond); - $db_host_cnt = DBselect("select count(*) as cnt from hosts where available=".HOST_AVAILABLE_FALSE); $host_cnt = DBfetch($db_host_cnt); - $notav = $host_cnt["cnt"]; + $notav = $host_cnt['cnt']; + + $db_host_cnt = DBselect('SELECT COUNT(*) as cnt '. + ' FROM hosts h, hosts_groups hg'. + ' WHERE h.available='.HOST_AVAILABLE_UNKNOWN. + ' AND hg.groupid IN ('.$accessible_groups.') '.$cond); + - $db_host_cnt = DBselect("select count(*) as cnt from hosts where available=".HOST_AVAILABLE_UNKNOWN); $host_cnt = DBfetch($db_host_cnt); - $uncn = $host_cnt["cnt"]; + $uncn = $host_cnt['cnt']; - $header = new CCol(S_HOSTS_INFO,"header"); + $node = get_node_by_nodeid($this->nodeid); + $header_str = S_HOSTS_INFO.SPACE; + + if(remove_nodes_from_id($this->groupid)>0){ + $group = get_hostgroup_by_groupid($this->groupid); + $header_str.= S_FOR_GROUP_SMALL.SPACE.'"('.$node['name'].')'.SPACE.$group['name'].'"'; + } + else{ + $header_str.= S_FOR_NODE_SMALL.SPACE.'"('.$node['name'].')"'; + } + + + $header = new CCol($header_str,"header"); if($this->style == STYLE_HORISONTAL) $header->SetColspan(3); |
