".S_NO_PERMISSIONS.""); show_page_footer(); exit; } ?> "; $h2=$h2.form_select("groupid",0,S_ALL_SMALL); $result=DBselect("select groupid,name from groups order by name"); while($row=DBfetch($result)) { // Check if at least one host with read permission exists for this group $result2=DBselect("select h.hostid,h.host from hosts h,hosts_groups hg where hg.groupid=".$row["groupid"]." and hg.hostid=h.hostid and h.status<>".HOST_STATUS_DELETED." group by h.hostid,h.host order by h.host"); $cnt=0; while($row2=DBfetch($result2)) { if(!check_right("Host","U",$row2["hostid"])) { continue; } $cnt=1; break; } if($cnt!=0) { $h2=$h2.form_select("groupid",$row["groupid"],$row["name"]); } } $h2=$h2.""; $h2=$h2." ".S_HOST." "; $h2=$h2.""; $h2=$h2." | "; $h2=$h2.""; show_header2($h1, $h2, "
", "
"); ?> SetHeader(array(S_ID,S_NAME,S_EXPRESSION, S_SEVERITY, S_STATUS, S_ERROR)); $result=DBselect("select distinct h.hostid,h.host,t.triggerid,t.expression,t.description,t.status,t.value,t.priority,t.error from triggers t,hosts h,items i,functions f where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid and h.hostid=".$_REQUEST["hostid"]." order by h.host,t.description"); while($row=DBfetch($result)) { if(check_right_on_trigger("R",$row["triggerid"]) == 0) { continue; } $description=expand_trigger_description($row["triggerid"]); if(isset($_REQUEST["hostid"])) { $description="$description"; } else { $description="$description"; } $id=" ".$row["triggerid"]; $sql="select t.triggerid,t.description from triggers t,trigger_depends d where t.triggerid=d.triggerid_up and d.triggerid_down=".$row["triggerid"]; $result1=DBselect($sql); if(DBnum_rows($result1)>0) { $description=$description."

".S_DEPENDS_ON."
"; while($row1=DBfetch($result1)) { $depid=$row1["triggerid"]; $depdescr=expand_trigger_description($depid); $description=$description."$depdescr
"; } $description=$description."

"; } if($row["priority"]==0) $priority=S_NOT_CLASSIFIED; elseif($row["priority"]==1) $priority=S_INFORMATION; elseif($row["priority"]==2) $priority=S_WARNING; elseif($row["priority"]==3) $priority=array("value"=>S_AVERAGE,"class"=>"average"); elseif($row["priority"]==4) $priority=array("value"=>S_HIGH,"class"=>"high"); elseif($row["priority"]==5) $priority=array("value"=>S_DISASTER,"class"=>"disaster"); else $priority=$row["priority"]; if($row["status"] == 1) { $status="".S_DISABLED.""; } else if($row["status"] == 2) { $status="".S_UNKNOWN.""; } else { $status="".S_ENABLED.""; } // $expression=rawurlencode($row["expression"]); if($row["error"]=="") { $row["error"]=" "; } // $actions=$actions." :: "; // if(get_action_count_by_triggerid($row["triggerid"])>0) // { // $actions=$actions."Actions"; // } // else // { // $actions=$actions."".S_ACTIONS.""; // } $table->addRow(array( $id, $description, explode_exp($row["expression"],1), $priority, $status, $row["error"] )); } $footerButtons = array(); array_push($footerButtons, new CButton('register','enable selected', "return Confirm('".S_ENABLE_SELECTED_TRIGGERS_Q."');")); array_push($footerButtons, SPACE); array_push($footerButtons, new CButton('register','disable selected', "return Confirm('Disable selected triggers?');")); array_push($footerButtons, SPACE); array_push($footerButtons, new CButton('register','delete selected', "return Confirm('".S_DISABLE_SELECTED_TRIGGERS_Q."');")); $table->SetFooter(new CCol($footerButtons),'table_footer'); $form = new CForm('triggers.php'); $form->AddVar('hostid',$_REQUEST["hostid"]); $form->AddItem($table); $form->Show(); } else { $result=DBselect("select count(*) as cnt from hosts"); $row=DBfetch($result); if($row["cnt"]>0) { echo BR; @insert_trigger_form($_REQUEST["hostid"],$_REQUEST["triggerid"]); } } ?>