本文整理汇总了PHP中get_graph_tree_array函数的典型用法代码示例。如果您正苦于以下问题:PHP get_graph_tree_array函数的具体用法?PHP get_graph_tree_array怎么用?PHP get_graph_tree_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_graph_tree_array函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: settings
function settings()
{
global $tabs_graphs, $settings_graphs, $current_user, $graph_views, $current_user;
/* you cannot have per-user graph settings if cacti's user management is not turned on */
if (read_config_option('auth_method') == 0) {
raise_message(6);
display_output_messages();
return;
}
if ($_REQUEST['action'] == 'edit') {
if (isset($_SERVER['HTTP_REFERER'])) {
$timespan_sel_pos = strpos($_SERVER['HTTP_REFERER'], '&predefined_timespan');
if ($timespan_sel_pos) {
$_SERVER['HTTP_REFERER'] = substr($_SERVER['HTTP_REFERER'], 0, $timespan_sel_pos);
}
}
$_SESSION['profile_referer'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'graph_view.php';
}
print "<form method='post' action='auth_profile.php'>\n";
html_start_box('<strong>User Settings</strong>', '100%', '', '3', 'center', '');
$current_user = db_fetch_row_prepared('SELECT * FROM user_auth WHERE id = ?', array($_SESSION['sess_user_id']));
if (!sizeof($current_user)) {
return;
}
/* file: user_admin.php, action: user_edit (host) */
$fields_user = array('username' => array('method' => 'value', 'friendly_name' => 'User Name', 'description' => 'The login name for this user.', 'value' => '|arg1:username|', 'max_length' => '40', 'size' => '40'), 'full_name' => array('method' => 'textbox', 'friendly_name' => 'Full Name', 'description' => 'A more descriptive name for this user, that can include spaces or special characters.', 'value' => '|arg1:full_name|', 'max_length' => '120', 'size' => '60'), 'email_address' => array('method' => 'textbox', 'friendly_name' => 'E-Mail Address', 'description' => 'An E-Mail Address you be reached at.', 'value' => '|arg1:email_address|', 'max_length' => '60', 'size' => '60'));
draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => inject_form_variables($fields_user, isset($current_user) ? $current_user : array())));
html_end_box();
if (is_view_allowed('graph_settings') == true) {
if (read_config_option('auth_method') != 0) {
$settings_graphs['tree']['default_tree_id']['sql'] = get_graph_tree_array(true);
}
html_start_box('<strong>Graph Settings</strong>', '100%', '', '3', 'center', '');
while (list($tab_short_name, $tab_fields) = each($settings_graphs)) {
$collapsible = true;
print "<tr class='spacer tableHeader" . ($collapsible ? ' collapsible' : '') . "' id='row_{$tab_short_name}'><td colspan='2' style='cursor:pointer;' class='tableSubHeaderColumn'>" . $tabs_graphs[$tab_short_name] . ($collapsible ? "<div style='float:right;padding-right:4px;'><i class='fa fa-angle-double-up'></i></div>" : "") . "</td></tr>\n";
$form_array = array();
while (list($field_name, $field_array) = each($tab_fields)) {
$form_array += array($field_name => $tab_fields[$field_name]);
if (isset($field_array['items']) && is_array($field_array['items'])) {
while (list($sub_field_name, $sub_field_array) = each($field_array['items'])) {
if (graph_config_value_exists($sub_field_name, $_SESSION['sess_user_id'])) {
$form_array[$field_name]['items'][$sub_field_name]['form_id'] = 1;
}
$form_array[$field_name]['items'][$sub_field_name]['value'] = db_fetch_cell_prepared('SELECT value FROM settings_graphs WHERE name = ? AND user_id = ?', array($sub_field_name, $_SESSION['sess_user_id']));
}
} else {
if (graph_config_value_exists($field_name, $_SESSION['sess_user_id'])) {
$form_array[$field_name]['form_id'] = 1;
}
$form_array[$field_name]['value'] = db_fetch_cell_prepared('SELECT value FROM settings_graphs WHERE name = ? AND user_id = ?', array($field_name, $_SESSION['sess_user_id']));
}
}
draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => $form_array));
}
html_end_box();
}
?>
<script type="text/javascript">
<!--
var themeFonts=<?php
print read_config_option('font_method');
?>
;
function graphSettings() {
if (themeFonts == 1) {
$('#row_fonts').hide();
$('#row_custom_fonts').hide();
$('#row_title_size').hide();
$('#row_title_font').hide();
$('#row_legend_size').hide();
$('#row_legend_font').hide();
$('#row_axis_size').hide();
$('#row_axis_font').hide();
$('#row_unit_size').hide();
$('#row_unit_font').hide();
}else{
var custom_fonts = $('#custom_fonts').is(':checked');
switch(custom_fonts) {
case true:
$('#row_fonts').show();
$('#row_title_size').show();
$('#row_title_font').show();
$('#row_legend_size').show();
$('#row_legend_font').show();
$('#row_axis_size').show();
$('#row_axis_font').show();
$('#row_unit_size').show();
$('#row_unit_font').show();
break;
case false:
$('#row_fonts').show();
$('#row_title_size').hide();
$('#row_title_font').hide();
$('#row_legend_size').hide();
$('#row_legend_font').hide();
$('#row_axis_size').hide();
$('#row_axis_font').hide();
//.........这里部分代码省略.........
开发者ID:MrWnn,项目名称:cacti,代码行数:101,代码来源:auth_profile.php
示例2: settings
function settings() {
global $colors, $tabs_graphs, $settings_graphs, $current_user, $graph_views, $current_user, $graph_tree_views;
/* you cannot have per-user graph settings if cacti's user management is not turned on */
if (read_config_option("auth_method") == 0) {
raise_message(6);
display_output_messages();
return;
}
/* Find out whether this user has right here */
if($current_user["graph_settings"] == "") {
print "<strong><font size='+1' color='#FF0000'>YOU DO NOT HAVE RIGHTS TO CHANGE GRAPH SETTINGS</font></strong>";
include_once("./include/bottom_footer.php");
exit;
}
if (read_config_option("auth_method") != 0) {
if ($current_user["policy_graphs"] == "1") {
$sql_where = "where user_auth_tree.user_id is null";
}elseif ($current_user["policy_graphs"] == "2") {
$sql_where = "where user_auth_tree.user_id is not null";
}
$settings_graphs["tree"]["default_tree_id"]["sql"] = get_graph_tree_array(true);
}
print "<form method='post' action='graph_settings.php'>\n";
html_graph_start_box(1, true);
print "<tr bgcolor='#" . $colors["header"] . "'><td colspan='3'><table cellspacing='0' cellpadding='3' width='100%'><tr><td class='textHeaderDark'><strong>Graph Settings</strong></td></tr></table></td></tr>";
while (list($tab_short_name, $tab_fields) = each($settings_graphs)) {
?>
<tr bgcolor='<?php print $colors["header_panel"];?>'>
<td colspan='2' class='textSubHeaderDark' style='padding: 3px;'>
<?php print $tabs_graphs[$tab_short_name];?>
</td>
</tr>
<?php
$form_array = array();
while (list($field_name, $field_array) = each($tab_fields)) {
$form_array += array($field_name => $tab_fields[$field_name]);
if ((isset($field_array["items"])) && (is_array($field_array["items"]))) {
while (list($sub_field_name, $sub_field_array) = each($field_array["items"])) {
if (graph_config_value_exists($sub_field_name, $_SESSION["sess_user_id"])) {
$form_array[$field_name]["items"][$sub_field_name]["form_id"] = 1;
}
$form_array[$field_name]["items"][$sub_field_name]["value"] = db_fetch_cell("select value from settings_graphs where name='$sub_field_name' and user_id=" . $_SESSION["sess_user_id"]);
}
}else{
if (graph_config_value_exists($field_name, $_SESSION["sess_user_id"])) {
$form_array[$field_name]["form_id"] = 1;
}
$form_array[$field_name]["value"] = db_fetch_cell("select value from settings_graphs where name='$field_name' and user_id=" . $_SESSION["sess_user_id"]);
}
}
draw_edit_form(
array(
"config" => array(
"no_form_tag" => true
),
"fields" => $form_array
)
);
}
html_graph_end_box();
print "<br>";
if (isset($_SERVER["HTTP_REFERER"])) {
$timespan_sel_pos = strpos($_SERVER["HTTP_REFERER"],"&predefined_timespan");
if ($timespan_sel_pos) {
$_SERVER["HTTP_REFERER"] = substr($_SERVER["HTTP_REFERER"],0,$timespan_sel_pos);
}
}
form_hidden_box("referer",(isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : ""),"");
form_hidden_box("save_component_graph_config","1","");
form_save_button("graph_settings.php", "save");
}
开发者ID:songchin,项目名称:Cacti,代码行数:89,代码来源:graph_settings.php
示例3: draw_tree_dropdown
function draw_tree_dropdown($current_tree_id) {
global $colors;
$html = "";
$tree_list = get_graph_tree_array();
if (isset($_GET["tree_id"])) {
$_SESSION["sess_view_tree_id"] = $current_tree_id;
}
/* if there is a current tree, make sure it still exists before going on */
if ((!empty($_SESSION["sess_view_tree_id"])) && (db_fetch_cell("select id from graph_tree where id=" . $_SESSION["sess_view_tree_id"]) == "")) {
$_SESSION["sess_view_tree_id"] = 0;
}
/* set a default tree if none is already selected */
if (empty($_SESSION["sess_view_tree_id"])) {
if (db_fetch_cell("select id from graph_tree where id=" . read_graph_config_option("default_tree_id")) > 0) {
$_SESSION["sess_view_tree_id"] = read_graph_config_option("default_tree_id");
}else{
if (sizeof($tree_list) > 0) {
$_SESSION["sess_view_tree_id"] = $tree_list[0]["id"];
}
}
}
/* make the dropdown list of trees */
if (sizeof($tree_list) > 1) {
$html ="<form name='form_tree_id'>
<td valign='middle' height='30' bgcolor='#" . $colors["panel"] . "'>\n
<table width='100%' cellspacing='0' cellpadding='0'>\n
<tr>\n
<td width='200' class='textHeader'>\n
Select a Graph Hierarchy: \n
</td>\n
<td bgcolor='#" . $colors["panel"] . "'>\n
<select name='cbo_tree_id' onChange='window.location=document.form_tree_id.cbo_tree_id.options[document.form_tree_id.cbo_tree_id.selectedIndex].value'>\n";
foreach ($tree_list as $tree) {
$html .= "<option value='graph_view.php?action=tree&tree_id=" . $tree["id"] . "'";
if ($_SESSION["sess_view_tree_id"] == $tree["id"]) { $html .= " selected"; }
$html .= ">" . $tree["name"] . "</option>\n";
}
$html .= "</select>\n";
$html .= "</td></tr></table></td></form>\n";
}elseif (sizeof($tree_list) == 1) {
/* there is only one tree; use it */
//print " <td valign='middle' height='5' colspan='3' bgcolor='#" . $colors["panel"] . "'>";
}
return $html;
}
开发者ID:songchin,项目名称:Cacti,代码行数:54,代码来源:html_tree.php
示例4: get_host_tree_array
function get_host_tree_array($where = "", $only_hosts = false)
{
$leafs = array();
$branchleafs = 0;
$tree_list = get_graph_tree_array();
/* auth check for hosts on the trees */
if (read_config_option("global_auth") == "on") {
$current_user = db_fetch_row("select policy_hosts from user_auth where id=" . $_SESSION["sess_user_id"]);
$sql_join = "left join user_auth_perms on (host.id=user_auth_perms.item_id and user_auth_perms.type=3 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ")";
if ($current_user["policy_hosts"] == "1") {
$sql_where = "and !(user_auth_perms.user_id is not null and graph_tree_items.host_id > 0)";
} elseif ($current_user["policy_hosts"] == "2") {
$sql_where = "and !(user_auth_perms.user_id is null and graph_tree_items.host_id > 0)";
}
} else {
$sql_join = "";
$sql_where = "";
}
/* Only return monitor items */
$sql_where .= " and ((host.disabled = '' and host.monitor = 'on') or (title != ''))";
if (strstr($where, 'and') != $where) {
$where = "and " . $where;
}
$sql_where .= $where . " ";
if (sizeof($tree_list) > 0) {
foreach ($tree_list as $tree) {
$heirarchy = db_fetch_assoc("select\n\t\t\t\tgraph_tree_items.title,\n\t\t\t\tgraph_tree_items.order_key,\n\t\t\t\tgraph_tree_items.host_id,\n\t\t\t\tgraph_tree_items.host_grouping_type,\n\t\t\t\thost.id,\n\t\t\t\thost.description,\n\t\t\t\thost.status,\n\t\t\t\thost.hostname,\n\t\t\t\thost.cur_time,\n\t\t\t\thost.status_rec_date,\n\t\t\t\thost.status_fail_date,\n\t\t\t\thost.availability\n\t\t\t\tfrom graph_tree_items\n\t\t\t\tleft join host on (host.id=graph_tree_items.host_id)\n\t\t\t\t{$sql_join}\n\t\t\t\twhere graph_tree_items.graph_tree_id=" . $tree["id"] . "\n\t\t\t\t{$sql_where}\n\t\t\t\tand graph_tree_items.local_graph_id = 0\n\t\t\t\torder by graph_tree_items.order_key");
if (sizeof($heirarchy) > 0) {
if (!$only_hosts) {
$leafs[$branchleafs] = $tree;
$branchleafs++;
}
foreach ($heirarchy as $leaf) {
$leafs[$branchleafs] = $leaf;
$branchleafs++;
}
}
}
}
return $leafs;
}
开发者ID:teddywen,项目名称:cacti,代码行数:41,代码来源:monitor.php
示例5: create_dhtml_tree
function create_dhtml_tree()
{
global $config;
$dhtml_tree = array();
$tree_list = get_graph_tree_array();
if (sizeof($tree_list)) {
foreach ($tree_list as $tree) {
$dhtml_tree['tree:' . $tree['id']] = true;
}
}
return $dhtml_tree;
}
开发者ID:MrWnn,项目名称:cacti,代码行数:12,代码来源:html_tree.php
示例6: settings
function settings() {
global $colors, $tabs_graphs, $settings_graphs, $current_user, $current_user;
/* you cannot have per-user graph settings if cacti's user management is not turned on */
if (read_config_option("auth_method") == 0) {
raise_message(6);
display_output_messages();
return;
}
/* Find out whether this user has right here */
if($current_user["graph_settings"] == "") {
print "<strong><font size='+1' color='#FF0000'>" . __("YOU DO NOT HAVE RIGHTS TO CHANGE GRAPH SETTINGS") . "</font></strong>";
include_once(CACTI_BASE_PATH . "/include/bottom_footer.php");
exit;
}
if (read_config_option("auth_method") != 0) {
if ($current_user["policy_graphs"] == "1") {
$sql_where = "where user_auth_tree.user_id is null";
}elseif ($current_user["policy_graphs"] == "2") {
$sql_where = "where user_auth_tree.user_id is not null";
}
$settings_graphs["tree"]["default_tree_id"]["sql"] = get_graph_tree_array(true);
}
/* draw the categories tabs on the top of the page */
print "<form method='post' action='graph_settings.php'>\n";
# the tabs
print "<table width='100%' cellspacing='0' cellpadding='0' align='center'><tr><td><div class='tabs'>\n";
if (sizeof($settings_graphs) > 0) {
foreach (array_keys($settings_graphs) as $tab_short_name) {
print "<div><a id='tab_" . clean_up_name($tabs_graphs[$tab_short_name]) . "' " . (($tab_short_name == "General") ? "class='tab tabSelected'" : "class='tab tabDefault'") . " onClick='selectTab(\"" . clean_up_name($tabs_graphs[$tab_short_name]) . "\")' href='#'>$tabs_graphs[$tab_short_name]</a></div>\n";
}
}
print "</div></td></tr></table>\n";
# the tab contents
while (list($tab_short_name, $tab_fields) = each($settings_graphs)) {
print "<table cellpadding='0' cellspacing='0' width='100%'><tr><td><div class='tab_settings' id='settings_" . clean_up_name($tabs_graphs[$tab_short_name]) . "'>\n";
html_start_box("<strong>" . __("Graph Settings") . " (" . $tabs_graphs[$tab_short_name] . ")</strong>", "100", $colors["header"], 0, "center", "", false, "Tab_Settings_" . clean_up_name($tabs_graphs[$tab_short_name]));
$header_items = array(__("Field"), __("Value"));
print "<tr><td>";
html_header($header_items, 2, true, "Header_Settings_" . clean_up_name($tabs_graphs[$tab_short_name]),'left wp100');
$form_array = array();
while (list($field_name, $field_array) = each($tab_fields)) {
$form_array += array($field_name => $tab_fields[$field_name]);
if ((isset($field_array["items"])) && (is_array($field_array["items"]))) {
while (list($sub_field_name, $sub_field_array) = each($field_array["items"])) {
if (graph_config_value_exists($sub_field_name, $_SESSION["sess_user_id"])) {
$form_array[$field_name]["items"][$sub_field_name]["form_id"] = 1;
}
$form_array[$field_name]["items"][$sub_field_name]["value"] = db_fetch_cell("select value from settings_graphs where name='$sub_field_name' and user_id=" . $_SESSION["sess_user_id"]);
}
}else{
if (graph_config_value_exists($field_name, $_SESSION["sess_user_id"])) {
$form_array[$field_name]["form_id"] = 1;
}
$form_array[$field_name]["value"] = db_fetch_cell("select value from settings_graphs where name='$field_name' and user_id=" . $_SESSION["sess_user_id"]);
}
}
draw_edit_form(
array(
"config" => array("no_form_tag" => true),
"fields" => $form_array
)
);
print "</table></td></tr>"; /* end of html_header */
html_end_box();
print "</div></td></tr></table>\n";
}
if (isset($_SERVER["HTTP_REFERER"])) {
$timespan_sel_pos = strpos($_SERVER["HTTP_REFERER"],"&predefined_timespan");
if ($timespan_sel_pos) {
$_SERVER["HTTP_REFERER"] = substr($_SERVER["HTTP_REFERER"],0,$timespan_sel_pos);
}
}
form_hidden_box("referer", "graph_view.php","");
form_hidden_box("save_component_graph_config","1","");
form_save_button_alt("", "save", "save");
?>
<script type="text/javascript">
<!--
function selectTab(tab) {
$('.tab_settings').hide();
$('.tab').removeClass("tabSelected");
//.........这里部分代码省略.........
开发者ID:songchin,项目名称:Cacti,代码行数:101,代码来源:graph_settings.php
示例7: settings
function settings()
{
global $tabs_graphs, $settings_graphs, $current_user, $graph_views, $current_user, $graph_tree_views;
/* you cannot have per-user graph settings if cacti's user management is not turned on */
if (read_config_option("auth_method") == 0) {
raise_message(6);
display_output_messages();
return;
}
/* Find out whether this user has right here */
if ($current_user["graph_settings"] == "") {
print "<strong><font size='+1' color='#FF0000'>YOU DO NOT HAVE RIGHTS TO CHANGE GRAPH SETTINGS</font></strong>";
include_once "./include/bottom_footer.php";
exit;
}
if (read_config_option("auth_method") != 0) {
if ($current_user["policy_graphs"] == "1") {
$sql_where = "where user_auth_tree.user_id is null";
} elseif ($current_user["policy_graphs"] == "2") {
$sql_where = "where user_auth_tree.user_id is not null";
}
$settings_graphs["tree"]["default_tree_id"]["sql"] = get_graph_tree_array(true);
}
print "<form method='post' action='graph_settings.php'>\n";
html_start_box("<strong>Graph Settings</strong>", "100%", "", "3", "center", "");
while (list($tab_short_name, $tab_fields) = each($settings_graphs)) {
?>
<tr>
<td colspan='2' class='textSubHeaderDark' style='padding: 3px;'>
<?php
print $tabs_graphs[$tab_short_name];
?>
</td>
</tr>
<?php
$form_array = array();
while (list($field_name, $field_array) = each($tab_fields)) {
$form_array += array($field_name => $tab_fields[$field_name]);
if (isset($field_array["items"]) && is_array($field_array["items"])) {
while (list($sub_field_name, $sub_field_array) = each($field_array["items"])) {
if (graph_config_value_exists($sub_field_name, $_SESSION["sess_user_id"])) {
$form_array[$field_name]["items"][$sub_field_name]["form_id"] = 1;
}
$form_array[$field_name]["items"][$sub_field_name]["value"] = db_fetch_cell("select value from settings_graphs where name='{$sub_field_name}' and user_id=" . $_SESSION["sess_user_id"]);
}
} else {
if (graph_config_value_exists($field_name, $_SESSION["sess_user_id"])) {
$form_array[$field_name]["form_id"] = 1;
}
$form_array[$field_name]["value"] = db_fetch_cell("select value from settings_graphs where name='{$field_name}' and user_id=" . $_SESSION["sess_user_id"]);
}
}
draw_edit_form(array("config" => array("no_form_tag" => true), "fields" => $form_array));
}
html_end_box();
?>
<script type="text/javascript">
<!--
function graphSettings() {
var custom_fonts = document.getElementById('custom_fonts').checked;
switch(custom_fonts) {
case true:
document.getElementById('row_title_size').style.display = "";
document.getElementById('row_title_font').style.display = "";
document.getElementById('row_legend_size').style.display = "";
document.getElementById('row_legend_font').style.display = "";
document.getElementById('row_axis_size').style.display = "";
document.getElementById('row_axis_font').style.display = "";
document.getElementById('row_unit_size').style.display = "";
document.getElementById('row_unit_font').style.display = "";
break;
case false:
document.getElementById('row_title_size').style.display = "none";
document.getElementById('row_title_font').style.display = "none";
document.getElementById('row_legend_size').style.display = "none";
document.getElementById('row_legend_font').style.display = "none";
document.getElementById('row_axis_size').style.display = "none";
document.getElementById('row_axis_font').style.display = "none";
document.getElementById('row_unit_size').style.display = "none";
document.getElementById('row_unit_font').style.display = "none";
break;
}
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
//.........这里部分代码省略.........
开发者ID:teddywen,项目名称:cacti,代码行数:101,代码来源:graph_settings.php
示例8: nmidSmokeping_create_dhtml_tree
function nmidSmokeping_create_dhtml_tree( $SmokePingServer )
{
/* Record Start Time */
list( $micro, $seconds ) = split( " ", microtime() );
$start = $seconds + $micro;
$dhtml_tree = array();
$devices = array();
$i = 0;
$tree_list = get_graph_tree_array();
if ( sizeof( $tree_list ) > 0 ) {
foreach ( $tree_list as $tree ) {
$i++;
$heirarchy = db_fetch_assoc( "select
graph_tree_items.id,
graph_tree_items.title,
graph_tree_items.order_key,
graph_tree_items.host_id,
graph_tree_items.host_grouping_type,
host.description as hostname,
host.hostname as ipaddress
from graph_tree_items
left join host on (host.id=graph_tree_items.host_id)
where graph_tree_items.graph_tree_id=" . $tree[ "id" ] . "
and graph_tree_items.local_graph_id = 0
order by graph_tree_items.order_key" );
$treeName = preg_replace( "/\s/", "_", $tree[ "name" ] );
$treeName = preg_replace( "@/@", "-", $treeName );
$treeName = preg_replace( "@\)@", "-", $treeName );
$treeName = preg_replace( "@\(@", "-", $treeName );
$treeName = preg_replace( "@\.@", "", $treeName );
$treeName = preg_replace( "@\&@", "and", $treeName );
$treeName = preg_replace( "@\,@", "and", $treeName );
$treeName = preg_replace( "@\'@", "", $treeName );
$treeName = preg_replace( "@\+@", "", $treeName );
$treeName = preg_replace( "@\|@", "-", $treeName );
$treeName = preg_replace( "@\ä@", "ae", $treeName );
$treeName = preg_replace( "@\ö@", "oe", $treeName );
$treeName = preg_replace( "@\ü@", "ue", $treeName );
$treeName = preg_replace( "@\Ä@", "Ae", $treeName );
$treeName = preg_replace( "@\Ö@", "Oe", $treeName );
$treeName = preg_replace( "@\Ü@", "Ue", $treeName );
$treeName = preg_replace( "@\Ç@", "C", $treeName );
$treeName = preg_replace( "@\²@", "2", $treeName );
$treeName = preg_replace( "/\\\/", "-", $treeName );
$treeName = preg_replace( "@\[@", "_", $treeName );
$treeName = preg_replace( "@\]@", "_", $treeName );
$treeName = preg_replace( "/::/", "__", $treeName );
$dhtml_tree[ $i ] = "+ " . $treeName . "\n" .
"menu = " . $tree[ "name" ] . "\n" .
"title = " . $tree[ "name" ] . "\n" .
"\n";
$current_tier = $treeName;
$tierArr = array();
if ( sizeof( $heirarchy ) > 0 ) {
foreach ( $heirarchy as $leaf ) {
$i++;
$tier = tree_tier( $leaf[ "order_key" ] );
if ( $leaf[ "host_id" ] > 0 ) {
$nmid_data = db_fetch_assoc( "select nwmgmt_smokeping_server,nwmgmt_settings from host where id=" . $leaf[ "host_id" ] );
if ( preg_match( "@$SmokePingServer@", $nmid_data[ 0 ][ "nwmgmt_smokeping_server" ] ) > 0 ) {
if ( preg_match( "/^s1/", $nmid_data[ 0 ][ "nwmgmt_settings" ] ) > 0 ) {
$tierString = '+';
for ( $tierCount = 0; $tierCount < $tier; $tierCount++ ) {
$tierString .= '+';
}
$host_text = preg_replace( "/\s/", "_", $leaf[ "hostname" ] );
$host_text = preg_replace( "@/@", "-", $host_text );
$host_text = preg_replace( "@\)@", "-", $host_text );
$host_text = preg_replace( "@\(@", "-", $host_text );
$host_text = preg_replace( "@\.@", "", $host_text );
$host_text = preg_replace( "@\&@", "and", $host_text );
$host_text = preg_replace( "@\,@", "and", $host_text );
$host_text = preg_replace( "@\'@", "", $host_text );
$host_text = preg_replace( "@\+@", "", $host_text );
$host_text = preg_replace( "@\|@", "-", $host_text );
$host_text = preg_replace( "@\ä@", "ae", $host_text );
$host_text = preg_replace( "@\ö@", "oe", $host_text );
$host_text = preg_replace( "@\ü@", "ue", $host_text );
$host_text = preg_replace( "@\Ä@", "Ae", $host_text );
$host_text = preg_replace( "@\Ö@", "Oe", $host_text );
$host_text = preg_replace( "@\Ü@", "Ue", $host_text );
$host_text = preg_replace( "@\Ç@", "C", $host_text );
$host_text = preg_replace( "@\²@", "2", $host_text );
$host_text = preg_replace( "/\\\/", "-", $host_text );
if ( isset ( $devices[ $host_text ] ) ) {
// nothing
}
else {
$devices[ $host_text ] = TRUE;
$dhtml_tree[ $i ] = $tierString . ' ' . $host_text . "\n" .
"menu = " . $leaf[ "hostname" ] . "\n" .
"title = Device " . $leaf[ "hostname" ] . "\n" .
//.........这里部分代码省略.........
开发者ID:avillaverdec,项目名称:cacti,代码行数:101,代码来源:setup.php
示例9: settings
function settings()
{
global $tabs_graphs, $settings_graphs, $current_user, $graph_views, $current_user;
$current_user = db_fetch_row_prepared('SELECT * FROM user_auth WHERE id = ?', array($_SESSION['sess_user_id']));
/* you cannot have per-user graph settings if cacti's user management is not turned on */
if (read_config_option('auth_method') == 0) {
raise_message(6);
display_output_messages();
return;
}
/* Find out whether this user has right here */
if (!is_view_allowed('graph_settings')) {
print "<strong><font class='txtErrorTextBox'>YOU DO NOT HAVE RIGHTS TO CHANGE GRAPH SETTINGS</font></strong>";
bottom_footer();
exit;
}
if (read_config_option('auth_method') != 0) {
$settings_graphs['tree']['default_tree_id']['sql'] = get_graph_tree_array(true);
}
print "<form method='post' action='graph_settings.php'>\n";
html_start_box('<strong>Graph Settings</strong>', '100%', '', '3', 'center', '');
while (list($tab_short_name, $tab_fields) = each($settings_graphs)) {
$collapsible = true;
print "<tr class='spacer tableHeader" . ($collapsible ? ' collapsible' : '') . "' id='row_{$tab_short_name}'><td colspan='2' style='cursor:pointer;' class='tableSubHeaderColumn'>" . $tabs_graphs[$tab_short_name] . ($collapsible ? "<div style='float:right;padding-right:4px;'><i class='fa fa-angle-double-up'></i></div>" : "") . "</td></tr>\n";
$form_array = array();
while (list($field_name, $field_array) = each($tab_fields)) {
$form_array += array($field_name => $tab_fields[$field_name]);
if (isset($field_array['items']) && is_array($field_array['items'])) {
while (list($sub_field_name, $sub_field_array) = each($field_array['items'])) {
if (graph_config_value_exists($sub_field_name, $_SESSION['sess_user_id'])) {
$form_array[$field_name]['items'][$sub_field_name]['form_id'] = 1;
}
$form_array[$field_name]['items'][$sub_field_name]['value'] = db_fetch_cell_prepared('SELECT value FROM settings_graphs WHERE name = ? AND user_id = ?', array($sub_field_name, $_SESSION['sess_user_id']));
}
} else {
if (graph_config_value_exists($field_name, $_SESSION['sess_user_id'])) {
$form_array[$field_name]['form_id'] = 1;
}
$form_array[$field_name]['value'] = db_fetch_cell_prepared('SELECT value FROM settings_graphs WHERE name = ? AND user_id = ?', array($field_name, $_SESSION['sess_user_id']));
}
}
draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => $form_array));
}
html_end_box();
?>
<script type="text/javascript">
<!--
var themeFonts=<?php
print read_config_option('font_method');
?>
;
function graphSettings() {
if (themeFonts == 1) {
$('#row_fonts').hide();
$('#row_custom_fonts').hide();
$('#row_title_size').hide();
$('#row_title_font').hide();
$('#row_legend_size').hide();
$('#row_legend_font').hide();
$('#row_axis_size').hide();
$('#row_axis_font').hide();
$('#row_unit_size').hide();
$('#row_unit_font').hide();
}else{
var custom_fonts = $('#custom_fonts').is(':checked');
switch(custom_fonts) {
case true:
$('#row_fonts').show();
$('#row_title_size').show();
$('#row_title_font').show();
$('#row_legend_size').show();
$('#row_legend_font').show();
$('#row_axis_size').show();
$('#row_axis_font').show();
$('#row_unit_size').show();
$('#row_unit_font').show();
break;
case false:
$('#row_fonts').show();
$('#row_title_size').hide();
$('#row_title_font').hide();
$('#row_legend_size').hide();
$('#row_legend_font').hide();
$('#row_axis_size').hide();
$('#row_axis_font').hide();
$('#row_unit_size').hide();
$('#row_unit_font').hide();
break;
}
}
if ($('#timespan_sel').is(':checked')) {
$('#row_default_rra_id').hide();
$('#row_default_timespan').show();
$('#row_default_timeshift').show();
$('#row_allow_graph_dates_in_future').show();
$('#row_first_weekdayid').show();
$('#row_day_shift_start').show();
//.........这里部分代码省略.........
开发者ID:MrWnn,项目名称:cacti,代码行数:101,代码来源:graph_settings.php
示例10: draw_tree_dropdown
function draw_tree_dropdown($current_tree_id)
{
$html = '';
$tree_list = get_graph_tree_array();
if (isset($_GET['tree_id'])) {
$_SESSION['sess_view_tree_id'] = $current_tree_id;
}
/* if there is a current tree, make sure it still exists before going on */
if (!empty($_SESSION['sess_view_tree_id']) && db_fetch_cell('select id from graph_tree where id=' . $_SESSION['sess_view_tree_id']) == '') {
$_SESSION['sess_view_tree_id'] = 0;
}
/* set a default tree if none is already selected */
if (empty($_SESSION['sess_view_tree_id'])) {
if (db_fetch_cell('select id from graph_tree where id=' . read_graph_config_option('default_tree_id')) > 0) {
$_SESSION['sess_view_tree_id'] = read_graph_config_option('default_tree_id');
} else {
if (sizeof($tree_list) > 0) {
$_SESSION['sess_view_tree_id'] = $tree_list[0]['id'];
}
}
}
/* make the dropdown list of trees */
if (sizeof($tree_list) > 1) {
$html = "<form name='form_tree_id' id='form_tree_id' action='graph_view.php'>\n\t\t\t<td valign='absmiddle' style='height:30px;' class='even'>\n\n\t\t\t\t<table width='100%' cellspacing='0' cellpadding='0'>\n\n\t\t\t\t\t<tr>\n\n\t\t\t\t\t\t<td width='200' class='textHeader'>\n\n\t\t\t\t\t\t\t Select a Graph Hierarchy: \n\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t<td class='even'>\n\n\t\t\t\t\t\t\t<select name='cbo_tree_id' onChange='window.location=document.form_tree_id.cbo_tree_id.options[document.form_tree_id.cbo_tree_id.selectedIndex].value'>\n";
foreach ($tree_list as $tree) {
$html .= "<option value='graph_view.php?action=tree&tree_id=" . $tree['id'] . "'";
if ($_SESSION['sess_view_tree_id'] == $tree['id']) {
$html .= ' selected';
}
$html .= '>' . $tree['name'] . "</option>\n";
}
$html .= "</select>\n";
$html .= "</td></tr></table></td></form>\n";
} elseif (sizeof($tree_list) == 1) {
/* there is only one tree; use it */
}
return $html;
}
开发者ID:teddywen,项目名称:cacti,代码行数:38,代码来源:html_tree.php
示例11: array
/* get the start and end times for the graph */
$timespan = array();
$first_weekdayid = read_user_setting('first_weekdayid');
get_timespan($timespan, time(), get_request_var('timespan'), $first_weekdayid);
$graph_tree = $tree_id;
$html = '';
$out = '';
/* detect the next graph regardless of type */
get_next_graphid($graphpp, $filter, $graph_tree, $leaf_id);
switch (read_config_option('cycle_custom_graphs_type')) {
case '0':
case '1':
/* will only use the filter for full rotation */
break;
case '2':
$tree_list = get_graph_tree_array();
if (sizeof($tree_list)) {
$html = "<td><select id='tree_id' name='tree_id' onChange='newTree()' title='" . __('Select Tree to View') . "'>\n";
foreach ($tree_list as $tree) {
$html .= "<option value='" . $tree['id'] . "'" . ($graph_tree == $tree['id'] ? ' selected' : '') . '>' . title_trim($tree['name'], 30) . "</option>\n";
}
$html .= "</select>\n";
$leaves = db_fetch_assoc("SELECT * FROM graph_tree_items WHERE title!='' AND graph_tree_id='{$graph_tree}' ORDER BY parent, position");
if (sizeof($leaves)) {
$html .= "<select id='leaf_id' name='leaf_id' onChange='newTree()' title='" . __('Select Tree Leaf to Display') . "'>\n";
$html .= "<option value='-1'" . ($leaf_id == -1 ? ' selected' : '') . ">" . __('All Levels') . "</option>\n";
$html .= "<option value='-2'" . ($leaf_id == -2 ? ' selected' : '') . ">" . __('Top Level') . "</option>\n";
foreach ($leaves as $leaf) {
$html .= "<option value='" . $leaf['id'] . "'" . ($leaf_id == $leaf['id'] ? ' selected' : '') . '>' . $leaf['title'] . "</option>\n";
}
$html .= "</select>\n";
开发者ID:Cacti,项目名称:plugin_cycle,代码行数:31,代码来源:cycle_ajax.php
示例12: cycle_config_settings
function cycle_config_settings()
{
global $tabs, $settings, $page_refresh_interval, $graph_timespans;
global $cycle_width, $cycle_height, $cycle_cols, $cycle_graphs;
/* check for an upgrade */
plugin_cycle_check_config();
if (isset($_SERVER['PHP_SELF']) && basename($_SERVER['PHP_SELF']) != 'settings.php') {
return;
}
$tabs['cycle'] = __('Cycle');
$treeList = array_rekey(get_graph_tree_array(null, true), 'id', 'name');
$temp = array('cycle_header' => array('friendly_name' => __('Cycle Graphs'), 'method' => 'spacer'), 'cycle_delay' => array('friendly_name' => __('Delay Interval'), 'description' => __('This is the time in seconds before the next graph is displayed.'), 'method' => 'drop_array', 'default' => 60, 'array' => $page_refresh_interval), 'cycle_timespan' => array('friendly_name' => __('Graph Timespan'), 'description' => __('This is the default timespan that will be displayed on the page.'), 'method' => 'drop_array', 'default' => 5, 'array' => $graph_timespans), 'cycle_columns' => array('friendly_name' => __('Column Count'), 'description' => __('In Tree Mode this is the number of columns that will be used.'), 'method' => 'drop_array', 'default' => 2, 'array' => $cycle_cols), 'cycle_graphs' => array('friendly_name' => __('Number of Graphs per Page'), 'description' => __('Select the number of graphs to display per page'), 'method' => 'drop_array', 'default' => '4', 'array' => $cycle_graphs), 'cycle_height' => array('friendly_name' => __('Graph Height'), 'description' => __('This sets the graph height for the displayed graphs.'), 'method' => 'drop_array', 'default' => '100', 'array' => $cycle_height), 'cycle_width' => array('friendly_name' => __('Graph Width'), 'description' => __('This sets the graph width for the displayed graphs.'), 'method' => 'drop_array', 'default' => '400', 'array' => $cycle_width), 'cycle_font_size' => array('friendly_name' => __('Title Font Size'), 'description' => __('This is the font size in pixels for the title. (1 - 100)'), 'method' => 'textbox', 'default' => '8', 'max_length' => 3, 'size' => 4), 'cycle_font_face' => array('friendly_name' => __('Title Font Face'), 'description' => __('This is the font face for the title.'), 'method' => 'textbox', 'max_length' => 100), 'cycle_font_color' => array('friendly_name' => __('Title Font Color'), 'description' => __('This is the font color for the title.'), 'method' => 'drop_color', 'default' => '1'), 'cycle_legend' => array('friendly_name' => __('Display Legend'), 'description' => __('Check this to display legend.'), 'method' => 'checkbox', 'default' => ''), 'cycle_cheader' => array('friendly_name' => __('Predefined Rotations'), 'method' => 'spacer'), 'cycle_custom_graphs_type' => array('friendly_name' => __('Rotation Type'), 'description' => __('Select which method to use for custom graph rotation. If you select \'Specific List\', you must define a list of graph id\'s'), 'method' => 'drop_array', 'default' => '1', 'array' => array(0 => __('Legacy (All)'), 1 => __('Specific List'), 2 => __('Tree Mode'))), 'cycle_custom_graphs_list' => array('friendly_name' => __('Custom Graph List'), 'description' => __('This must be a comma delimited list of graph id\'s to cycle through. For example \'1,2,3,4\''), 'method' => 'textbox', 'max_length' => 255), 'cycle_custom_graphs_tree' => array('friendly_name' => __('Default Tree'), 'description' => __('Select the graph tree to cycle if Tree Mode is selected'), 'method' => 'drop_array', 'default' => 'None', 'array' => $treeList));
if (isset($settings['cycle'])) {
$settings['cycle'] = array_merge($settings['cycle'], $temp);
} else {
$settings['cycle'] = $temp;
}
}
开发者ID:Cacti,项目名称:plugin_cycle,代码行数:18,代码来源:setup.php
注:本文中的get_graph_tree_array函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论