array(T_ZBX_INT, O_MAND, P_SYS, DB_ID,NULL), "gitemid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), "itemid"=> array(T_ZBX_INT, O_OPT, NULL, NULL, 'isset({save})'), "color"=> array(T_ZBX_STR, O_OPT, NULL, NULL, 'isset({save})'), "drawtype"=> array(T_ZBX_INT, O_OPT, NULL, IN("0,1,2,3"), 'isset({save})'), "sortorder"=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,65535), 'isset({save})'), "yaxisside"=> array(T_ZBX_INT, O_OPT, NULL, IN("0,1"), 'isset({save})'), "calc_fnc"=> array(T_ZBX_INT, O_OPT, NULL, IN("1,2,4,7"), 'isset({save})'), "type"=> array(T_ZBX_INT, O_OPT, NULL, IN("0,1"), 'isset({save})'), "periods_cnt"=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,360), 'isset({save})'), "register"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), "save"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), "delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), "cancel"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), "form"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), "form_refresh"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL) ); check_fields($fields); ?> AddRow(new CImg("chart2.php?graphid=".$_REQUEST["graphid"]."&period=3600&from=0")); $table->Show(); if(isset($_REQUEST["form"])) { /****** FORM ******/ echo BR; insert_graphitem_form(); } else { /****** TABLE ******/ $form = new CForm(); $form->AddVar("graphid",$_REQUEST["graphid"]); $form->AddItem(new CButton("form",S_ADD_ITEM)); show_table_header(S_DISPLAYED_PARAMETERS_BIG,$form); $table = new CTableInfo("..."); $table->SetHeader(array(S_SORT_ORDER,S_HOST,S_PARAMETER,S_FUNCTION,S_TYPE,S_DRAW_STYLE,S_COLOR,S_ACTIONS)); $result=DBselect("select i.itemid,h.host,i.description,gi.*,i.key_ ". " from hosts h,graphs_items gi,items i where i.itemid=gi.itemid ". " and gi.graphid=".$_REQUEST["graphid"]." and h.hostid=i.hostid ". " order by gi.sortorder desc, i.description, i.itemid"); while($row=DBfetch($result)) { if($row["type"] == GRAPH_ITEM_AGGREGATED) { $type = S_AGGREGATED." (".$row["periods_cnt"].")"; $drawtype = "-"; $fnc_name = "-"; $color = "-"; } else { $type = S_SIMPLE; $drawtype = get_drawtype_description($row["drawtype"]); $color = $row["color"]; switch($row["calc_fnc"]) { case CALC_FNC_ALL: $fnc_name = S_ALL_SMALL; break; case CALC_FNC_MIN: $fnc_name = S_MIN_SMALL; break; case CALC_FNC_MAX: $fnc_name = S_MAX_SMALL; break; case CALC_FNC_AVG: default: $fnc_name = S_AVG_SMALL; break; } } $table->AddRow(array( $row["sortorder"], $row["host"], NEW CLink(item_description($row["description"],$row["key_"]), 'chart.php?itemid='.$row["itemid"].'&period=3600&from=0', 'action'), $fnc_name, $type, $drawtype, $color, array( new CLink(S_CHANGE,"graph.php?graphid=".$_REQUEST["graphid"]. "&gitemid=".$row["gitemid"]."&form=update#form","action"), SPACE."-".SPACE, new CLink(S_UP,"graph.php?graphid=".$_REQUEST["graphid"]. "&gitemid=".$row["gitemid"]."®ister=up","action"), SPACE."-".SPACE, new CLink(S_DOWN,"graph.php?graphid=".$_REQUEST["graphid"]. "&gitemid=".$row["gitemid"]."®ister=down","action") ) )); } $table->Show(); } ?>