array(T_ZBX_INT, O_OPT, P_SYS|P_NZERO, DB_ID, NULL),
"showgraph"=> array(T_ZBX_INT, O_OPT, P_SYS, IN("1")."isset({serviceid})",NULL)
);
check_fields($fields);
?>
AddRow("");
$table->Show();
show_page_footer();
exit;
}
$now=time();
$result=DBselect("select serviceid,name,triggerid,status,showsla,goodsla from services order by sortorder,name");
// table_begin();
$table = new CTableInfo();
$table->SetHeader(array(S_SERVICE,S_STATUS,S_REASON,S_SLA_LAST_7_DAYS,nbsp(S_PLANNED_CURRENT_SLA),S_GRAPH));
if(isset($_REQUEST["serviceid"]))
{
$service=get_service_by_serviceid($_REQUEST["serviceid"]);
$service=new CLink($service["name"],"srv_status.php?serviceid=".$service["serviceid"],"action");
$status=get_service_status_description($service["status"]);
$reason=SPACE;
if($service["showsla"]==1)
{
$sla="
";
}
else
{
$sla=new CSpan("-","center");
}
if($service["showsla"]==1)
{
$now=time(NULL);
$period_start=$now-7*24*3600;
$period_end=$now;
$stat=calculate_service_availability($service["serviceid"],$period_start,$period_end);
if($service["goodsla"]>$stat["ok"])
{
$color="AA0000";
}
else
{
$color="00AA00";
}
$sla2=sprintf("%.2f%%/%.2f%%",$service["goodsla"],$color,$stat["ok"]);
}
else
{
$sla2="-";
}
$actions=new CLink(S_SHOW,"srv_status.php?serviceid=".$service["serviceid"]."&showgraph=1","action");
$table->addRow(array(
$service,
$status,
$reason,
$sla,
$sla2,
$actions
));
}
while($row=DBfetch($result))
{
if(!isset($_REQUEST["serviceid"]) && service_has_parent($row["serviceid"]))
{
continue;
}
if(isset($_REQUEST["serviceid"]) && service_has_no_this_parent($_REQUEST["serviceid"],$row["serviceid"]))
{
continue;
}
if(isset($row["triggerid"])&&!check_right_on_trigger("R",$row["triggerid"]))
{
continue;
}
$childs=get_num_of_service_childs($row["serviceid"]);
if(isset($row["triggerid"]))
{
$description=nbsp(expand_trigger_description($row["triggerid"]));
$description="[".S_TRIGGER_BIG."] $description";
}
else
{
$trigger_link="";
$description=$row["name"];
}
if(isset($_REQUEST["serviceid"]))
{
if($childs == 0)
{
$service="$description";
}
else
{
$service=new CLink($description,"srv_status.php?serviceid=".$row["serviceid"],"action");
}
}
else
{
if($childs == 0)
{
$service="$description";
}
else
{
$service=new CLink($description,"srv_status.php?serviceid=".$row["serviceid"],"action");
}
}
$status=get_service_status_description($row["status"]);
if($row["status"]==0)
{
$reason="-";
}
else
{
$reason="