");
?>
setHeader(array(S_ID,S_NAME,S_WIDTH,S_HEIGHT,S_ACTIONS));
if(isset($_REQUEST["hostid"])&&($_REQUEST["hostid"]!=0))
{
$result=DBselect("select distinct g.graphid,g.name,g.width,g.height from graphs g,items i".
",graphs_items gi where gi.itemid=i.itemid and g.graphid=gi.graphid".
" and i.hostid=".$_REQUEST["hostid"]." order by g.name");
}
else
{
$result=DBselect("select distinct g.graphid,g.name,g.width,g.height".
" from graphs g order by g.name");
}
while($row=DBfetch($result))
{
if(!check_right("Graph","U",$row["graphid"])) continue;
if(!isset($_REQUEST["hostid"]))
{
$sql="select * from graphs_items where graphid=".$row["graphid"];
$result2=DBselect($sql);
if(DBnum_rows($result2)>0) continue;
}
$table->addRow(array(
$row["graphid"],
new CLink($row["name"],"graph.php?graphid=".$row["graphid"]),
$row["width"],
$row["height"],
new CLink("Change","graphs.php?graphid=".$row["graphid"])
));
}
$table->show();
?>