function round_robin_archive_to_xml($round_robin_archive_id) { require_once(CACTI_BASE_PATH . "/lib/presets/preset_rra_info.php"); $hash = get_hash_version("round_robin_archive") . get_hash_round_robin_archive($round_robin_archive_id); $xml_text = ""; $rra = db_fetch_row("select * from rra where id=$round_robin_archive_id"); $rra_cf = db_fetch_assoc("select * from rra_cf where rra_id=$round_robin_archive_id"); if (empty($rra["id"])) { $err_msg = "Invalid round robin archive."; return $err_msg; } $xml_text .= "<hash_$hash>\n"; /* XML Branch: <> */ $fields_rra_edit = preset_rra_form_list(); reset($fields_rra_edit); while (list($field_name, $field_array) = each($fields_rra_edit)) { if (($field_array["method"] != "hidden_zero") && ($field_array["method"] != "hidden") && ($field_array["method"] != "spacer")) { if (isset($rra{$field_name})) { $xml_text .= "\t<$field_name>" . xml_character_encode($rra{$field_name}) . "</$field_name>\n"; } } } $xml_text .= "\t<cf_items>"; /* XML Branch: <cf_items> */ $i = 0; if (sizeof($rra_cf) > 0) { foreach ($rra_cf as $item) { $xml_text .= $item["consolidation_function_id"]; if (($i+1) < sizeof($rra_cf)) { $xml_text .= "|"; } $i++; } } $xml_text .= "</cf_items>\n"; $xml_text .= "</hash_$hash>"; return $xml_text; }
function rra_edit() { global $colors; require_once(CACTI_BASE_PATH . "/lib/presets/preset_rra_info.php"); /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); /* ==================================================== */ if (!empty($_GET["id"])) { $rra = db_fetch_row("select * from rra where id=" . $_GET["id"]); $header_label = "[edit: " . $rra["name"] . "]"; }else{ $header_label = "[new]"; } print "<form method='post' action='" . basename($_SERVER["PHP_SELF"]) . "' name='rra_edit'>\n"; html_start_box("<strong>" . __("Round Robin Archives") . "</strong> $header_label", "100", $colors["header"], 0, "center", ""); $header_items = array("Field", "Value"); print "<tr><td>"; html_header($header_items, 2, true, 'header_rra_edit'); draw_edit_form(array( "config" => array(), "fields" => inject_form_variables(preset_rra_form_list(), (isset($rra) ? $rra : array())) )); print "</table></td></tr>"; /* end of html_header */ html_end_box(); form_save_button_alt(); }