function gprint_preset_to_xml($gprint_preset_id) { require_once(CACTI_BASE_PATH . "/lib/presets/preset_gprint_info.php"); $hash = get_hash_version("gprint_preset") . get_hash_gprint($gprint_preset_id); $xml_text = ""; $graph_templates_gprint = db_fetch_row("select * from graph_templates_gprint where id=$gprint_preset_id"); if (empty($graph_templates_gprint["id"])) { $err_msg = "Invalid GPRINT preset."; return $err_msg; } $xml_text .= "<hash_$hash>\n"; /* XML Branch: <> */ $fields_gprint_presets_edit = preset_gprint_form_list(); reset($fields_gprint_presets_edit); while (list($field_name, $field_array) = each($fields_gprint_presets_edit)) { if (($field_array["method"] != "hidden_zero") && ($field_array["method"] != "hidden") && ($field_array["method"] != "spacer")) { $xml_text .= "\t<$field_name>" . xml_character_encode($graph_templates_gprint{$field_name}) . "</$field_name>\n"; } } $xml_text .= "</hash_$hash>"; return $xml_text; }
function gprint_presets_edit() { global $colors; require_once(CACTI_BASE_PATH . "/lib/presets/preset_gprint_info.php"); /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); /* ==================================================== */ if (!empty($_GET["id"])) { $gprint_preset = db_fetch_row("select * from graph_templates_gprint where id=" . $_GET["id"]); $header_label = __("[edit: ") . $gprint_preset["name"] . "]"; }else{ $header_label = __("[new]"); } print "<form method='post' action='" . basename($_SERVER["PHP_SELF"]) . "' name='gprint_edit'>\n"; html_start_box("<strong>" . __("GPRINT Presets") . "</strong> $header_label", "100", $colors["header"], 0, "center", ""); $header_items = array(__("Field"), __("Value")); print "<tr><td>"; html_header($header_items, 2, true, 'header_gprint_preset'); draw_edit_form(array( "config" => array(), "fields" => inject_form_variables(preset_gprint_form_list(), (isset($gprint_preset) ? $gprint_preset : array())) )); print "</table></td></tr>"; /* end of html_header */ html_end_box(); form_save_button_alt(); }