diff options
author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-23 07:34:27 +0000 |
---|---|---|
committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-23 07:34:27 +0000 |
commit | 28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89 (patch) | |
tree | 8281ccd48964ee0dd11c5ea689091fa3cef706fb /frontends/php/report5.php | |
parent | 495799b2aa61aab23d74d7faa110a0cd09d59bf0 (diff) | |
download | zabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.tar.gz zabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.tar.xz zabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.zip |
- developed group permission system (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3371 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/report5.php')
-rw-r--r-- | frontends/php/report5.php | 132 |
1 files changed, 47 insertions, 85 deletions
diff --git a/frontends/php/report5.php b/frontends/php/report5.php index 87c6b66f..7b9e25ad 100644 --- a/frontends/php/report5.php +++ b/frontends/php/report5.php @@ -19,112 +19,74 @@ **/ ?> <?php - include "include/config.inc.php"; - $page["title"] = "S_TRIGGERS_TOP_100"; - $page["file"] = "report5.php"; - show_header($page["title"],0,0); -?> + require_once "include/config.inc.php"; + require_once "include/triggers.inc.php"; -<?php -// if(!check_right("Host","R",0)) -// { -// show_table_header("<font color=\"AA0000\">No permissions !</font>"); -// show_page_footer(); -// exit; -// } -?> + $page["title"] = "S_TRIGGERS_TOP_100"; + $page["file"] = "report5.php"; + +include_once "include/page_header.php"; +?> <?php - if(!isset($_REQUEST["period"])) - { - $_REQUEST["period"]="day"; - } +// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION + $fields=array( + "period"=> array(T_ZBX_STR, O_OPT, P_SYS|P_NZERO, IN('"day","week","month","year"'), NULL) + ); - $h1=S_TRIGGERS_TOP_100_BIG; + check_fields($fields); +?> +<?php + $_REQUEST["period"] = get_request("period", "day"); - $year=date("Y"); + $form = new CForm(); + + $cmbPeriod = new CComboBox("period",$_REQUEST["period"],"submit()"); + $cmbPeriod->AddItem("day",S_DAY); + $cmbPeriod->AddItem("week",S_WEEK); + $cmbPeriod->AddItem("month",S_MONTH); + $cmbPeriod->AddItem("year",S_YEAR); - $h2=SPACE.S_LAST.SPACE; - $h2=$h2."<select class=\"biginput\" name=\"period\" onChange=\"submit()\">"; - $h2=$h2.form_select("period","day",S_DAY); - $h2=$h2.form_select("period","week",S_WEEK); - $h2=$h2.form_select("period","month",S_MONTH); - $h2=$h2.form_select("period","year",S_YEAR); - $h2=$h2."</select>"; + $form->AddItem($cmbPeriod); - show_header2($h1, $h2, "<form name=\"selection\" method=\"get\" action=\"report5.php\">", "</form>"); + show_table_header(S_TRIGGERS_TOP_100_BIG, $form); ?> - <?php $table = new CTableInfo(); $table->setHeader(array(S_HOST,S_TRIGGER,S_SEVERITY,S_NUMBER_OF_STATUS_CHANGES)); - $time_now=time(); - if($_REQUEST["period"]=="day") - { - $time_dif=24*3600; - } - elseif($_REQUEST["period"]=="week") - { - $time_dif=7*24*3600; - } - elseif($_REQUEST["period"]=="month") - { - $time_dif=30*24*3600; - } - elseif($_REQUEST["period"]=="year") + + switch($_REQUEST["period"]) { - $time_dif=365*24*3600; + case "week": $time_dif=7*24*3600; break; + case "month": $time_dif=10*24*3600; break; + case "year": $time_dif=365*24*3600; break; + case "day": + default: $time_dif=24*3600; break; } - $result=DBselect("select h.host, t.triggerid, t.description, t.priority, count(a.alarmid) as count - from hosts h, triggers t, functions f, items i, alarms a where - h.hostid = i.hostid and - i.itemid = f.itemid and - t.triggerid=f.triggerid and - t.triggerid=a.triggerid and - a.clock>$time_now-$time_dif - mod(h.hostid,100)=$ZBX_CURNODEID - group by h.host,t.triggerid,t.description,t.priority - order by 5 desc,1,3", 100); + + $denyed_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, PERM_MODE_LT); + + $result=DBselect("select h.host, t.triggerid, t.description, t.priority, count(e.eventid) as count ". + " from hosts h, triggers t, functions f, items i, events e where ". + " h.hostid = i.hostid and i.itemid = f.itemid and t.triggerid=f.triggerid and ". + " t.triggerid=e.triggerid and e.clock>".(time()-$time_dif). + " and h.hostid not in (".$denyed_hosts.") and ".DBid2nodeid("e.triggerid")."=".$ZBX_CURNODEID. + " group by h.host,t.triggerid,t.description,t.priority ". + " order by count desc, h.host, t.description, t.triggerid", 100); while($row=DBfetch($result)) { - $priority_style=NULL; - if($row["priority"]==0) $priority=S_NOT_CLASSIFIED; - elseif($row["priority"]==1) - { - $priority=S_INFORMATION; - $priority_style="information"; - } - elseif($row["priority"]==2) - { - $priority=S_WARNING; - $priority_style="warning"; - } - elseif($row["priority"]==3) - { - $priority=S_AVERAGE; - $priority_style="average"; - } - elseif($row["priority"]==4) - { - $priority=S_HIGH; - $priority_style="high"; - } - elseif($row["priority"]==5) - { - $priority=S_DISASTER; - $priority_style="disaster"; - } - else $priority=$row["priority"]; - $severity=new CSpan($priority,$priority_style); $table->addRow(array( $row["host"], - expand_trigger_description($row["triggerid"]), - new CCol($priority,$priority_style), + expand_trigger_description_by_data($row), + new CCol(get_severity_description($row["priority"]),get_severity_style($row["priority"])), $row["count"], )); } $table->show(); +?> +<?php + +include_once "include/page_footer.php"; - show_page_footer(); ?> |