/** push_out_graph - pushes out templated graph template fields to all matching children @param int $graph_template_graph_id - the id of the graph template to push out values for */ function push_out_graph($graph_template_graph_id) { require_once(CACTI_BASE_PATH . "/lib/graph/graph_info.php"); /* get information about this graph template */ $graph_template_graph = db_fetch_row("select * from graph_templates_graph where id=$graph_template_graph_id"); /* must be a graph template */ if ($graph_template_graph["graph_template_id"] == 0) { return 0; } /* loop through each graph column name (from the above array) */ $struct_graph = graph_form_list(); reset($struct_graph); while (list($field_name, $field_array) = each($struct_graph)) { /* are we allowed to push out the column? */ if (empty($graph_template_graph{"t_" . $field_name})) { db_execute("update graph_templates_graph set $field_name='" . addslashes($graph_template_graph[$field_name]) . "' where local_graph_template_graph_id=" . $graph_template_graph["id"]); /* update the title cache */ if ($field_name == "title") { update_graph_title_cache_from_template($graph_template_graph["graph_template_id"]); } } } }
function push_out_graph($graph_template_graph_id) { global $struct_graph; /* get information about this graph template */ $graph_template_graph = db_fetch_row("select * from graph_templates_graph where id={$graph_template_graph_id}"); /* must be a graph template */ if ($graph_template_graph["graph_template_id"] == 0) { return 0; } /* loop through each graph column name (from the above array) */ reset($struct_graph); while (list($field_name, $field_array) = each($struct_graph)) { /* are we allowed to push out the column? */ if (empty($graph_template_graph["t_" . $field_name])) { db_execute("update graph_templates_graph set {$field_name}='" . addslashes($graph_template_graph[$field_name]) . "' where local_graph_template_graph_id=" . $graph_template_graph["id"]); /* update the title cache */ if ($field_name == "title") { update_graph_title_cache_from_template($graph_template_graph["graph_template_id"]); } } } }