本文整理汇总了PHP中get_graph_title函数的典型用法代码示例。如果您正苦于以下问题:PHP get_graph_title函数的具体用法?PHP get_graph_title怎么用?PHP get_graph_title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_graph_title函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: thold_graphs_action_prepare
function thold_graphs_action_prepare($save)
{
global $colors, $config;
if ($save["drp_action"] == "plugin_thold_create") {
/* get the valid thold templates
* remove those hosts that do not have any valid templates
*/
$templates = "";
$found_list = "";
$not_found = "";
if (sizeof($save["graph_array"])) {
foreach ($save["graph_array"] as $item) {
$data_template_id = db_fetch_cell("SELECT dtr.data_template_id\r\n\t\t\t\t FROM data_template_rrd AS dtr\r\n\t\t\t\t LEFT JOIN graph_templates_item AS gti\r\n\t\t\t\t ON gti.task_item_id=dtr.id\r\n\t\t\t\t LEFT JOIN graph_local AS gl\r\n\t\t\t\t ON gl.id=gti.local_graph_id\r\n\t\t\t\t WHERE gl.id={$item}");
if ($data_template_id != "") {
if (sizeof(db_fetch_assoc("SELECT id FROM thold_template WHERE data_template_id={$data_template_id}"))) {
$found_list .= "<li>" . get_graph_title($item) . "</li>";
if (strlen($templates)) {
$templates .= ", {$data_template_id}";
} else {
$templates = "{$data_template_id}";
}
} else {
$not_found .= "<li>" . get_graph_title($item) . "</li>";
}
} else {
$not_found .= "<li>" . get_graph_title($item) . "</li>";
}
}
}
if (strlen($templates)) {
$sql = "SELECT id, name FROM thold_template WHERE data_template_id IN (" . $templates . ") ORDER BY name";
} else {
$sql = "SELECT id, name FROM thold_template ORDER BY name";
}
print "\t<tr>\r\n\t\t\t\t<td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>";
if (strlen($found_list)) {
if (strlen($not_found)) {
print "<p>The following Graphs have no Threshold Templates associated with them</p>";
print "<ul>" . $not_found . "</ul>";
}
print "<p>Are you sure you wish to create Thresholds for these Graphs?</p>\r\n\t\t\t\t\t<ul>" . $found_list . "</ul>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\n\r\n\t\t\t\t";
$form_array = array('general_header' => array('friendly_name' => 'Available Threshold Templates', 'method' => 'spacer'), 'thold_template_id' => array('method' => 'drop_sql', 'friendly_name' => 'Select a Threshold Template', 'description' => '', 'none_value' => 'None', 'value' => 'None', 'sql' => $sql));
draw_edit_form(array("config" => array("no_form_tag" => true), "fields" => $form_array));
} else {
if (strlen($not_found)) {
print "<p>There are no Threshold Templates associated with the following Graphs</p>";
print "<ul>" . $not_found . "</ul>";
}
}
} else {
return $save;
}
}
开发者ID:caiorasec,项目名称:thold,代码行数:53,代码来源:setup.php
示例2: graph_edit
function graph_edit()
{
global $colors, $struct_graph, $image_types, $consolidation_functions, $graph_item_types, $struct_graph_item;
/* ================= input validation ================= */
input_validate_input_number(get_request_var("id"));
/* ==================================================== */
/* modify for multi user start */
if ($_SESSION["permission"] < ACCESS_ADMINISTRATOR) {
// graph add
if ($_GET["id"] == "") {
if ($_GET["host_id"] != -1) {
input_validate_input_number(get_request_var("host_id"));
if (!check_host($_GET["host_id"])) {
access_denied();
}
}
// graph edit
} else {
$permission = check_graph($_GET["id"]);
if ($permission != GRAPH_PRIVATE && $permission != GRAPH_PRIVATE + GRAPH_PUBLIC) {
access_denied();
}
}
}
/* modify for multi user end */
$use_graph_template = true;
if (!empty($_GET["id"])) {
$local_graph_template_graph_id = db_fetch_cell("select local_graph_template_graph_id from graph_templates_graph where local_graph_id=" . $_GET["id"]);
$graphs = db_fetch_row("select * from graph_templates_graph where local_graph_id=" . $_GET["id"]);
$graphs_template = db_fetch_row("select * from graph_templates_graph where id={$local_graph_template_graph_id}");
$host_id = db_fetch_cell("select host_id from graph_local where id=" . $_GET["id"]);
$header_label = "[edit: " . htmlspecialchars(get_graph_title($_GET["id"])) . "]";
if ($graphs["graph_template_id"] == "0") {
$use_graph_template = false;
}
} else {
$header_label = "[new]";
$use_graph_template = false;
}
/* modify for multi user start */
if ($_SESSION["permission"] < ACCESS_ADMINISTRATOR) {
unset($_GET["debug"]);
}
/* modify for multi user end */
/* handle debug mode */
if (isset($_GET["debug"])) {
if ($_GET["debug"] == "0") {
kill_session_var("graph_debug_mode");
} elseif ($_GET["debug"] == "1") {
$_SESSION["graph_debug_mode"] = true;
}
}
if (!empty($_GET["id"])) {
?>
<table width="100%" align="center">
<tr>
<td class="textInfo" colspan="2" valign="top">
<?php
print htmlspecialchars(get_graph_title($_GET["id"]));
?>
</td>
<td class="textInfo" align="right" valign="top">
<?php
/* modify for multi user start */
if ($_SESSION["permission"] == ACCESS_ADMINISTRATOR) {
?>
<span style="color: #c16921;">*<a href='<?php
print htmlspecialchars("graphs.php?action=graph_edit&id=" . (isset($_GET["id"]) ? $_GET["id"] : "0") . "&debug=" . (isset($_SESSION["graph_debug_mode"]) ? "0" : "1"));
?>
'>Turn <strong><?php
print isset($_SESSION["graph_debug_mode"]) ? "Off" : "On";
?>
</strong> Graph Debug Mode.</a></span><br>
<?php
}
if (!empty($graphs["graph_template_id"]) && $_SESSION["permission"] == ACCESS_ADMINISTRATOR) {
?>
<span style="color: #c16921;">*<a href='<?php
print htmlspecialchars("graph_templates.php?action=template_edit&id=" . (isset($graphs["graph_template_id"]) ? $graphs["graph_template_id"] : "0"));
?>
'>Edit Graph Template.</a></span><br><?php
}
/* modify for multi user end */
if (!empty($_GET["host_id"]) || !empty($host_id)) {
?>
<span style="color: #c16921;">*<a href='<?php
print htmlspecialchars("host.php?action=edit&id=" . (isset($_GET["host_id"]) ? $_GET["host_id"] : $host_id));
?>
'>Edit Host.</a></span><br><?php
}
?>
</td>
</tr>
</table>
<br>
<?php
}
html_start_box("<strong>Graph Template Selection</strong> {$header_label}", "100%", $colors["header"], "3", "center", "");
$form_array = array("graph_template_id" => array("method" => "drop_sql", "friendly_name" => "Selected Graph Template", "description" => "Choose a graph template to apply to this graph. Please note that graph data may be lost if you change the graph template after one is already applied.", "value" => isset($graphs) ? $graphs["graph_template_id"] : "0", "none_value" => "None", "sql" => "select graph_templates.id,graph_templates.name from graph_templates order by name"), "host_id" => array("method" => "drop_sql", "friendly_name" => "Host", "description" => "Choose the host that this graph belongs to.", "value" => isset($_GET["host_id"]) ? $_GET["host_id"] : $host_id, "none_value" => "None", "sql" => "select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname"), "graph_template_graph_id" => array("method" => "hidden", "value" => isset($graphs) ? $graphs["id"] : "0"), "local_graph_id" => array("method" => "hidden", "value" => isset($graphs) ? $graphs["local_graph_id"] : "0"), "local_graph_template_graph_id" => array("method" => "hidden", "value" => isset($graphs) ? $graphs["local_graph_template_graph_id"] : "0"), "_graph_template_id" => array("method" => "hidden", "value" => isset($graphs) ? $graphs["graph_template_id"] : "0"), "_host_id" => array("method" => "hidden", "value" => isset($host_id) ? $host_id : "0"));
/* modify for multi user start */
//.........这里部分代码省略.........
开发者ID:resmon,项目名称:resmon-cacti,代码行数:101,代码来源:graphs.php
示例3: thold_add_graphs_action_prepare
function thold_add_graphs_action_prepare()
{
global $config;
$local_graph_id = get_filter_request_var('local_graph_id');
top_header();
html_start_box(__('Create Threshold from Template'), '60%', '', '3', 'center', '');
form_start('thold.php?action=add');
/* get the valid thold templates
* remove those hosts that do not have any valid templates
*/
$templates = '';
$found_list = '';
$not_found = '';
$data_template_id = db_fetch_cell("SELECT dtr.data_template_id\n\t\t FROM data_template_rrd AS dtr\n\t\t LEFT JOIN graph_templates_item AS gti\n\t\t ON gti.task_item_id=dtr.id\n\t\t LEFT JOIN graph_local AS gl\n\t\t ON gl.id=gti.local_graph_id\n\t\t WHERE gl.id={$local_graph_id}");
if ($data_template_id != '') {
if (sizeof(db_fetch_assoc("SELECT id FROM thold_template WHERE data_template_id={$data_template_id}"))) {
$found_list .= '<li>' . get_graph_title($local_graph_id) . '</li>';
if (strlen($templates)) {
$templates .= ", {$data_template_id}";
} else {
$templates = "{$data_template_id}";
}
} else {
$not_found .= '<li>' . get_graph_title($local_graph_id) . '</li>';
}
} else {
$not_found .= '<li>' . get_graph_title($local_graph_id) . '</li>';
}
if (strlen($templates)) {
$sql = 'SELECT id, name FROM thold_template WHERE data_template_id IN (' . $templates . ') ORDER BY name';
} else {
$sql = 'SELECT id, name FROM thold_template ORDER BY name';
}
print "<tr><td colspan='2' class='textArea'>\n";
if (strlen($found_list)) {
if (strlen($not_found)) {
print '<p>' . __('The following Graph has no Threshold Templates associated with them.') . '</p>';
print '<ul>' . $not_found . '</ul>';
}
print '<p>' . __('Are you sure you wish to create Thresholds for this Graph?') . '
<ul>' . $found_list . "</ul>\n\t\t\t</td>\n\t\t</tr>\n";
if (isset_request_var('tree_id')) {
get_filter_request_var('tree_id');
} else {
set_request_var('tree_id', '');
}
if (isset_request_var('leaf_id')) {
get_filter_request_var('leaf_id');
} else {
set_request_var('leaf_id', '');
}
$form_array = array('general_header' => array('friendly_name' => __('Available Threshold Templates'), 'method' => 'spacer'), 'thold_template_id' => array('method' => 'drop_sql', 'friendly_name' => __('Select a Threshold Template'), 'description' => '', 'none_value' => __('None'), 'value' => __('None'), 'sql' => $sql), 'usetemplate' => array('method' => 'hidden', 'value' => 1), 'local_graph_id' => array('method' => 'hidden', 'value' => $local_graph_id));
draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => $form_array));
} else {
if (strlen($not_found)) {
print '<p>' . __('There are no Threshold Templates associated with the following Graph.') . '</p>';
print '<ul>' . $not_found . '</ul>';
}
$form_array = array('general_header' => array('friendly_name' => __('Please select an action'), 'method' => 'spacer'), 'doaction' => array('method' => 'drop_array', 'friendly_name' => __('Threshold Action'), 'description' => __('You may either create a new Threshold Template, or an non-templated Threshold from this screen.'), 'value' => 'None', 'array' => array(1 => __('Create a new Threshold'), 2 => __('Create a Threshold Template'))), 'usetemplate' => array('method' => 'hidden', 'value' => 1), 'local_graph_id' => array('method' => 'hidden', 'value' => $local_graph_id));
draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => $form_array));
}
if (!strlen($not_found)) {
$save_html = "<input type='submit' value='" . __('Continue') . "'>";
print "<tr>\n\t\t\t<td colspan='2' class='saveRow'>\n\t\t\t\t<input type='hidden' id='action' value='actions'>\n\t\t\t\t<input type='button' onClick='cactiReturnTo()' value='" . __('Cancel') . "' title='" . __('Cancel') . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n";
} else {
$save_html = "<input type='submit' value='" . __('Continue') . "'>";
print "<tr>\n\t\t\t<td colspan='2' class='saveRow'>\n\t\t\t\t<input type='button' onClick='cactiReturnTo()' value='" . __('Cancel') . "' title='" . __('Cancel') . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n";
}
html_end_box();
print "<script type='text/javascript'>\$(function() { applySkin() ;});</script>";
bottom_footer();
}
开发者ID:Cacti,项目名称:plugin_thold,代码行数:72,代码来源:thold_webapi.php
示例4: get_graph_title
/* make sure the graph requested exists (sanity) */
if (!(db_fetch_cell("select local_graph_id from graph_templates_graph where local_graph_id=" . $_GET["local_graph_id"]))) {
print "<strong><font size='+1' color='FF0000'>GRAPH DOES NOT EXIST</font></strong>"; exit;
}
/* take graph permissions into account here, if the user does not have permission
give an "access denied" message */
if (read_config_option("auth_method") != 0) {
$access_denied = !(is_graph_allowed($_GET["local_graph_id"]));
if ($access_denied == true) {
print "<strong><font size='+1' color='FF0000'>ACCESS DENIED</font></strong>"; exit;
}
}
$graph_title = get_graph_title($_GET["local_graph_id"]);
if ($_REQUEST["view_type"] == "tree") {
print "<table width='100%' style='background-color: #ffffff; border: 1px solid #ffffff;' align='center' cellpadding='3'>";
}else{
print "<br><table width='100%' style='background-color: #f5f5f5; border: 1px solid #bbbbbb;' align='center' cellpadding='3'>";
}
$rras = get_associated_rras($_GET["local_graph_id"]);
switch ($_REQUEST["action"]) {
case 'view':
?>
<tr bgcolor='#<?php print $colors["header_panel"];?>'>
<td colspan='3' class='textHeaderDark'>
<strong>Viewing Graph</strong> '<?php print $graph_title;?>'
开发者ID:songchin,项目名称:Cacti,代码行数:31,代码来源:graph.php
示例5: update_graph_title_cache
function update_graph_title_cache($local_graph_id)
{
db_execute_prepared('UPDATE graph_templates_graph SET title_cache = ? WHERE local_graph_id = ?', array(get_graph_title($local_graph_id), $local_graph_id));
}
开发者ID:MrWnn,项目名称:cacti,代码行数:4,代码来源:variables.php
示例6: host_new_graphs_save
function host_new_graphs_save()
{
$selected_graphs_array = unserialize(stripslashes($_POST['selected_graphs_array']));
/* form an array that contains all of the data on the previous form */
while (list($var, $val) = each($_POST)) {
if (preg_match('/^g_(\\d+)_(\\d+)_(\\w+)/', $var, $matches)) {
/* 1: snmp_query_id, 2: graph_template_id, 3: field_name */
if (empty($matches[1])) {
/* this is a new graph from template field */
$values['cg'][$matches[2]]['graph_template'][$matches[3]] = $val;
} else {
/* this is a data query field */
$values['sg'][$matches[1]][$matches[2]]['graph_template'][$matches[3]] = $val;
}
} elseif (preg_match('/^gi_(\\d+)_(\\d+)_(\\d+)_(\\w+)/', $var, $matches)) {
/* 1: snmp_query_id, 2: graph_template_id, 3: graph_template_input_id, 4:field_name */
/* ================= input validation ================= */
input_validate_input_number($matches[3]);
/* ==================================================== */
/* we need to find out which graph items will be affected by saving this particular item */
$item_list = db_fetch_assoc_prepared('SELECT
graph_template_item_id
FROM graph_template_input_defs
WHERE graph_template_input_id = ?', array($matches[3]));
/* loop through each item affected and update column data */
if (sizeof($item_list) > 0) {
foreach ($item_list as $item) {
if (empty($matches[1])) {
/* this is a new graph from template field */
$values['cg'][$matches[2]]['graph_template_item'][$item['graph_template_item_id']][$matches[4]] = $val;
} else {
/* this is a data query field */
$values['sg'][$matches[1]][$matches[2]]['graph_template_item'][$item['graph_template_item_id']][$matches[4]] = $val;
}
}
}
} elseif (preg_match('/^d_(\\d+)_(\\d+)_(\\d+)_(\\w+)/', $var, $matches)) {
/* 1: snmp_query_id, 2: graph_template_id, 3: data_template_id, 4:field_name */
if (empty($matches[1])) {
/* this is a new graph from template field */
$values['cg'][$matches[2]]['data_template'][$matches[3]][$matches[4]] = $val;
} else {
/* this is a data query field */
$values['sg'][$matches[1]][$matches[2]]['data_template'][$matches[3]][$matches[4]] = $val;
}
} elseif (preg_match('/^c_(\\d+)_(\\d+)_(\\d+)_(\\d+)/', $var, $matches)) {
/* 1: snmp_query_id, 2: graph_template_id, 3: data_template_id, 4:data_input_field_id */
if (empty($matches[1])) {
/* this is a new graph from template field */
$values['cg'][$matches[2]]['custom_data'][$matches[3]][$matches[4]] = $val;
} else {
/* this is a data query field */
$values['sg'][$matches[1]][$matches[2]]['custom_data'][$matches[3]][$matches[4]] = $val;
}
} elseif (preg_match('/^di_(\\d+)_(\\d+)_(\\d+)_(\\d+)_(\\w+)/', $var, $matches)) {
/* 1: snmp_query_id, 2: graph_template_id, 3: data_template_id, 4:local_data_template_rrd_id, 5:field_name */
if (empty($matches[1])) {
/* this is a new graph from template field */
$values['cg'][$matches[2]]['data_template_item'][$matches[4]][$matches[5]] = $val;
} else {
/* this is a data query field */
$values['sg'][$matches[1]][$matches[2]]['data_template_item'][$matches[4]][$matches[5]] = $val;
}
}
}
debug_log_clear('new_graphs');
while (list($form_type, $form_array) = each($selected_graphs_array)) {
$current_form_type = $form_type;
while (list($form_id1, $form_array2) = each($form_array)) {
/* enumerate information from the arrays stored in post variables */
if ($form_type == 'cg') {
$graph_template_id = $form_id1;
} elseif ($form_type == 'sg') {
while (list($form_id2, $form_array3) = each($form_array2)) {
$snmp_index_array = $form_array3;
$snmp_query_array['snmp_query_id'] = $form_id1;
$snmp_query_array['snmp_index_on'] = get_best_data_query_index_type($_POST['host_id'], $form_id1);
$snmp_query_array['snmp_query_graph_id'] = $form_id2;
}
$graph_template_id = db_fetch_cell_prepared('SELECT graph_template_id FROM snmp_query_graph WHERE id = ?', array($snmp_query_array['snmp_query_graph_id']));
}
if ($current_form_type == 'cg') {
$return_array = create_complete_graph_from_template($graph_template_id, $_POST['host_id'], '', $values['cg']);
debug_log_insert('new_graphs', 'Created graph: ' . get_graph_title($return_array['local_graph_id']));
/* lastly push host-specific information to our data sources */
if (sizeof($return_array['local_data_id'])) {
# we expect at least one data source associated
foreach ($return_array['local_data_id'] as $item) {
push_out_host($_POST['host_id'], $item);
}
} else {
debug_log_insert('new_graphs', 'ERROR: no Data Source associated. Check Template');
}
} elseif ($current_form_type == 'sg') {
while (list($snmp_index, $true) = each($snmp_index_array)) {
$snmp_query_array['snmp_index'] = decode_data_query_index($snmp_index, $snmp_query_array['snmp_query_id'], $_POST['host_id']);
$return_array = create_complete_graph_from_template($graph_template_id, $_POST['host_id'], $snmp_query_array, $values['sg'][$snmp_query_array['snmp_query_id']]);
debug_log_insert('new_graphs', 'Created graph: ' . get_graph_title($return_array['local_graph_id']));
/* lastly push host-specific information to our data sources */
if (sizeof($return_array['local_data_id'])) {
//.........这里部分代码省略.........
开发者ID:MrWnn,项目名称:cacti,代码行数:101,代码来源:graphs_new.php
示例7: header
if ($_REQUEST['rra_id'] == 'all') {
$sql_where = ' WHERE id IS NOT NULL';
} else {
$sql_where = ' WHERE id=' . $_REQUEST['rra_id'];
}
/* make sure the graph requested exists (sanity) */
if (!db_fetch_cell_prepared('SELECT local_graph_id FROM graph_templates_graph WHERE local_graph_id = ?', array(get_request_var_request('local_graph_id')))) {
print "<strong><font class='txtErrorTextBox'>GRAPH DOES NOT EXIST</font></strong>";
exit;
}
/* take graph permissions into account here */
if (!is_graph_allowed($_REQUEST['local_graph_id'])) {
header('Location: permission_denied.php');
exit;
}
$graph_title = get_graph_title($_REQUEST['local_graph_id']);
if ($_REQUEST['view_type'] == 'tree') {
print "<table width='100%' style='background-color: #ffffff; border: 1px solid #ffffff;' align='center' cellspacing='0' cellpadding='3'>";
} else {
print "<table width='100%' style='background-color: #f5f5f5; border: 1px solid #bbbbbb;' align='center' cellspacing='0' cellpadding='3'>";
}
$rras = get_associated_rras($_REQUEST['local_graph_id']);
switch ($_REQUEST['action']) {
case 'view':
api_plugin_hook_function('page_buttons', array('lgid' => $_REQUEST['local_graph_id'], 'leafid' => '', 'mode' => 'mrtg', 'rraid' => $_REQUEST['rra_id']));
?>
<tr class='tableHeader'>
<td colspan='3' class='textHeaderDark'>
<strong>Viewing Graph</strong> '<?php
print htmlspecialchars($graph_title);
?>
开发者ID:MrWnn,项目名称:cacti,代码行数:31,代码来源:graph.php
示例8: graph_edit
function graph_edit()
{
global $struct_graph, $image_types, $consolidation_functions, $graph_item_types, $struct_graph_item;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request('id'));
/* ==================================================== */
$locked = 'false';
$use_graph_template = true;
if (!empty($_REQUEST['id'])) {
$_SESSION['sess_graph_lock_id'] = $_REQUEST['id'];
$local_graph_template_graph_id = db_fetch_cell_prepared('SELECT local_graph_template_graph_id FROM graph_templates_graph WHERE local_graph_id = ?', array($_REQUEST['id']));
if ($_REQUEST['id'] != $_SESSION['sess_graph_lock_id'] && !empty($local_graph_template_graph_id)) {
$locked = 'true';
$_SESSION['sess_graph_locked'] = $locked;
} elseif (empty($local_graph_template_graph_id)) {
$locked = 'false';
$_SESSION['sess_graph_locked'] = $locked;
} elseif (isset($_SESSION['sess_graph_locked'])) {
$locked = $_SESSION['sess_graph_locked'];
} else {
$locked = 'true';
$_SESSION['sess_graph_locked'] = $locked;
}
$graphs = db_fetch_row_prepared('SELECT * FROM graph_templates_graph WHERE local_graph_id = ?', array($_REQUEST['id']));
$graphs_template = db_fetch_row_prepared('SELECT * FROM graph_templates_graph WHERE id = ?', array($local_graph_template_graph_id));
$host_id = db_fetch_cell_prepared('SELECT host_id FROM graph_local WHERE id = ?', array($_REQUEST['id']));
$header_label = '[edit: ' . htmlspecialchars(get_graph_title($_REQUEST['id'])) . ']';
if ($graphs['graph_template_id'] == '0') {
$use_graph_template = 'false';
}
} else {
$header_label = '[new]';
$use_graph_template = false;
}
/* handle debug mode */
if (isset($_REQUEST['debug'])) {
if ($_REQUEST['debug'] == '0') {
kill_session_var('graph_debug_mode');
} elseif ($_REQUEST['debug'] == '1') {
$_SESSION['graph_debug_mode'] = true;
}
}
if (!empty($_REQUEST['id'])) {
?>
<table width="100%" align="center">
<tr>
<td class="textInfo" colspan="2" valign="top">
<?php
print htmlspecialchars(get_graph_title($_REQUEST['id']));
?>
</td>
<td class="textInfo" align="right" valign="top">
<span class="linkMarker">*<a class='hyperLink' href='<?php
print htmlspecialchars('graphs.php?action=graph_edit&id=' . (isset($_REQUEST['id']) ? $_REQUEST['id'] : '0') . '&debug=' . (isset($_SESSION['graph_debug_mode']) ? '0' : '1'));
?>
'>Turn <strong><?php
print isset($_SESSION['graph_debug_mode']) ? 'Off' : 'On';
?>
</strong> Graph Debug Mode.</a></span><br>
<?php
if (!empty($graphs['graph_template_id'])) {
?>
<span class="linkMarker">*<a class='hyperLink' href='<?php
print htmlspecialchars('graph_templates.php?action=template_edit&id=' . (isset($graphs['graph_template_id']) ? $graphs['graph_template_id'] : '0'));
?>
'>Edit Graph Template.</a></span><br><?php
}
if (!empty($_REQUEST['host_id']) || !empty($host_id)) {
?>
<span class="linkMarker">*<a class='hyperLink' href='<?php
print htmlspecialchars('host.php?action=edit&id=' . (isset($_REQUEST['host_id']) ? $_REQUEST['host_id'] : $host_id));
?>
'>Edit Device.</a></span><br><?php
}
if ($locked == 'true') {
?>
<span class="linkMarker">* <span class='hyperLink' id='unlockid'>Unlock Graph</span></span><?php
} else {
?>
<span class="linkMarker">* <span class='hyperLink' id='lockid'>Lock Graph</span></span><?php
}
?>
</td>
</tr>
</table>
<?php
}
html_start_box("<strong>Graph Template Selection</strong> {$header_label}", '100%', '', '3', 'center', '');
$form_array = array('graph_template_id' => array('method' => 'drop_sql', 'friendly_name' => 'Selected Graph Template', 'description' => 'Choose a Graph Template to apply to this Graph. Please note that Graph Data may be lost if you change the Graph Template after one is already applied.', 'value' => isset($graphs) ? $graphs['graph_template_id'] : '0', 'none_value' => 'None', 'sql' => 'SELECT graph_templates.id,graph_templates.name FROM graph_templates ORDER BY name'), 'host_id' => array('method' => 'drop_callback', 'friendly_name' => 'Device', 'description' => 'Choose the Device that this Graph belongs to.', 'sql' => "SELECT id,CONCAT_WS('',description,' (',hostname,')') as name FROM host ORDER BY description,hostname", 'action' => 'ajax_hosts_noany', 'id' => isset($_REQUEST['host_id']) ? $_REQUEST['host_id'] : $host_id, 'value' => db_fetch_cell_prepared('SELECT description AS name FROM host WHERE id = ?', isset($_REQUEST['host_id']) ? array($_REQUEST['host_id']) : array($host_id))), 'graph_template_graph_id' => array('method' => 'hidden', 'value' => isset($graphs) ? $graphs['id'] : '0'), 'local_graph_id' => array('method' => 'hidden', 'value' => isset($graphs) ? $graphs['local_graph_id'] : '0'), 'local_graph_template_graph_id' => array('method' => 'hidden', 'value' => isset($graphs) ? $graphs['local_graph_template_graph_id'] : '0'), '_graph_template_id' => array('method' => 'hidden', 'value' => isset($graphs) ? $graphs['graph_template_id'] : '0'), '_host_id' => array('method' => 'hidden', 'value' => isset($host_id) ? $host_id : '0'));
draw_edit_form(array('config' => array(), 'fields' => $form_array));
html_end_box();
/* only display the "inputs" area if we are using a graph template for this graph */
if (!empty($graphs['graph_template_id'])) {
html_start_box('<strong>Supplemental Graph Template Data</strong>', '100%', '', '3', 'center', '');
draw_nontemplated_fields_graph($graphs['graph_template_id'], $graphs, '|field|', '<strong>Graph Fields</strong>', true, true, 0);
draw_nontemplated_fields_graph_item($graphs['graph_template_id'], $_REQUEST['id'], '|field|_|id|', '<strong>Graph Item Fields</strong>', true, $locked);
html_end_box();
}
/* graph item list goes here */
if (!empty($_REQUEST['id']) && empty($graphs['graph_template_id'])) {
//.........这里部分代码省略.........
开发者ID:MrWnn,项目名称:cacti,代码行数:101,代码来源:graphs.php
示例9: draw_dhtml_tree_level
function draw_dhtml_tree_level($tree_id, $parent = 0, $graphing = false)
{
global $config;
/* Record Start Time */
list($micro, $seconds) = explode(' ', microtime());
$start = $seconds + $micro;
$dhtml_tree = array();
$heirarchy = get_allowed_tree_level($tree_id, $parent);
if (sizeof($heirarchy) > 0) {
$dhtml_tree[] = "\t\t\t<ul>\n";
foreach ($heirarchy as $leaf) {
if ($leaf['host_id'] > 0) {
//It's a host
$dhtml_tree[] = "\t\t\t\t<li id='tbranch:" . $leaf['id'] . "_thost:" . $leaf['host_id'] . "' data-jstree='{ \"type\" : \"device\" }'>Device: " . htmlspecialchars($leaf['hostname']) . "\n";
$dhtml_tree[] = "\t\t\t\t</li>\n";
} elseif ($leaf['local_graph_id'] > 0) {
$dhtml_tree[] = "\t\t\t\t<li id='tbranch:" . $leaf['id'] . "_tgraph:" . $leaf['local_graph_id'] . "' data-jstree='{ \"type\" : \"graph\" }'>Graph: " . htmlspecialchars(get_graph_title($leaf['local_graph_id'])) . "</a>\n";
$dhtml_tree[] = "\t\t\t\t</li>\n";
} else {
//It's not a host
$dhtml_tree[] = "\t\t\t\t<li class='jstree-closed' id='tbranch:" . $leaf['id'] . "'>" . htmlspecialchars($leaf['title']) . "\n";
$dhtml_tree[] = "\t\t\t\t</li>\n";
}
}
$dhtml_tree[] = "\t\t\t</ul>\n";
}
return $dhtml_tree;
}
开发者ID:MrWnn,项目名称:cacti,代码行数:28,代码来源:html_tree.php
示例10: graph_edit
function graph_edit() {
global $colors;
require_once(CACTI_BASE_PATH . "/lib/graph/graph_info.php");
/* ================= input validation ================= */
input_validate_input_number(get_request_var("id"));
/* ==================================================== */
$use_graph_template = true;
if (!empty($_GET["id"])) {
$local_graph_template_graph_id = db_fetch_cell("select local_graph_template_graph_id from graph_templates_graph where local_graph_id=" . get_request_var("id"));
$graphs = db_fetch_row("select * from graph_templates_graph where local_graph_id=" . get_request_var("id"));
$graphs_template = db_fetch_row("select * from graph_templates_graph where id=$local_graph_template_graph_id");
$device_id = db_fetch_cell("select device_id from graph_local where id=" . get_request_var("id"));
$header_label = __("[edit: ") . get_graph_title(get_request_var("id")) . "]";
if ($graphs["graph_template_id"] == "0") {
$use_graph_template = false;
}
}else{
$graphs = array();
$graphs_template = array();
$header_label = __("[new]");
$use_graph_template = false;
}
/* handle debug mode */
if (isset($_GET["debug"])) {
if (get_request_var("debug") == "0") {
kill_session_var("graph_debug_mode");
}elseif (get_request_var("debug") == "1") {
$_SESSION["graph_debug_mode"] = true;
}
}
$tip_text = "<tr><td align=\\'right\\'><a class=\\'popup_item\\' id=\\'changeGraphState\\' onClick=\\'changeGraphState()\\' href=\\'#\\'>Unlock/Lock</a></td></tr>";
$tip_text .= "<tr><td align=\\'right\\'><a class=\\'popup_item\\' href=\\'" . htmlspecialchars('graphs.php?action=graph_edit&id=' . (isset($_GET["id"]) ? get_request_var("id") : 0) . "&debug=" . (isset($_SESSION["graph_debug_mode"]) ? "0" : "1")) . "\\'>" . __("Turn") . " <strong>" . (isset($_SESSION["graph_debug_mode"]) ? __("Off") : __(CHECKED)) . "</strong> " . __("Debug Mode") . "</a></td></tr>";
if (!empty($graphs["graph_template_id"])) {
$tip_text .= "<tr><td align=\\'right\\'><a class=\\'popup_item\\' href=\\'" . htmlspecialchars('graph_templates.php?action=template_edit&id=' . (isset($graphs["graph_template_id"]) ? $graphs["graph_template_id"] : "0")) . "\\'>" . __("Edit Template") . "</a></td></tr>";
}
if (!empty($_GET["device_id"]) || !empty($device_id)) {
$tip_text .= "<tr><td align=\\'right\\'><a class=\\'popup_item\\' href=\\'" . htmlspecialchars('devices.php?action=edit&id=' . (isset($_GET["device_id"]) ? get_request_var("device_id") : $device_id)) . "\\'>" . __("Edit Host") . "</a></td></tr>";
}
if (!empty($_GET["id"])) {
?>
<script type="text/javascript">
<!--
var disabled = true;
$().ready(function() {
$("input").attr("disabled","disabled");
$("select").attr("disabled","disabled");
$("#cancel").removeAttr("disabled");
});
function changeGraphState() {
if (disabled) {
$("input").removeAttr("disabled");
$("select").removeAttr("disabled");
disabled = false;
rrdtool_graph_dependencies(); // even when unlocking, disable distinct rrdtool options
}else{
$("input").attr("disabled","disabled");
$("select").attr("disabled","disabled");
$("#cancel").removeAttr("disabled");
disabled = true;
}
}
//-->
</script>
<table width="100%" align="center">
<tr>
<td class="textInfo" colspan="2" valign="top">
<?php print get_graph_title(get_request_var("id"));?>
</td>
<td style="white-space:nowrap;" align="right" width="1"><a id='tooltip' class='popup_anchor' href='#' onMouseOver="Tip('<?php print $tip_text;?>', BGCOLOR, '#EEEEEE', FIX, ['tooltip', -45, 0], STICKY, true, SHADOW, true, CLICKCLOSE, true, FADEOUT, 400, TEXTALIGN, 'right', BORDERCOLOR, '#F5F5F5')" onMouseOut="UnTip()">Graph Options</a></td>
</tr>
</table>
<?php
}
print "<form method='post' action='" . basename($_SERVER["PHP_SELF"]) . "' name='graph_edit'>\n";
html_start_box("<strong>" . __("Graph Template Selection") . "</strong> $header_label", "100", $colors["header"], 0, "center", "");
$header_items = array(__("Field"), __("Value"));
print "<tr><td>";
html_header($header_items, 1, true, 'template');
$form_array = array(
"graph_template_id" => array(
"method" => "autocomplete",
"callback_function" => "./lib/ajax/get_graph_templates.php",
"friendly_name" => __("Selected Graph Template"),
"description" => __("Choose a graph template to apply to this graph. Please note that graph data may be lost if you change the graph template after one is already applied."),
"id" => (isset($graphs["graph_template_id"]) ? $graphs["graph_template_id"] : "0"),
"name" => db_fetch_cell("SELECT name FROM graph_templates WHERE id=" . (isset($graphs["graph_template_id"]) ? $graphs["graph_template_id"] : "0"))
),
//.........这里部分代码省略.........
开发者ID:songchin,项目名称:Cacti,代码行数:101,代码来源:graphs_form.php
示例11: reports_graphs_action_execute
/**
* reports_graphs_action_execute - perform reports_graph execute action
* @param string $action - action to be performed
* return -
* */
function reports_graphs_action_execute($action)
{
global $config;
if ($action == "reports") {
/* report */
$message = '';
/* loop through each of the graph_items selected on the previous page for skipped items */
if (isset($_POST["selected_items"])) {
$selected_items = unserialize(stripslashes($_POST["selected_items"]));
$reports_id = $_POST["reports_id"];
input_validate_input_number($reports_id);
input_validate_input_number($_POST["timespan"]);
input_validate_input_number($_POST["alignment"]);
$report = db_fetch_row("SELECT * FROM reports WHERE id=" . $reports_id);
if (sizeof($selected_items)) {
foreach ($selected_items as $local_graph_id) {
/* ================= input validation ================= */
input_validate_input_number($local_graph_id);
/* ==================================================== */
/* see if the graph is already added */
$existing = db_fetch_cell("SELECT id\n\t\t\t\t\tFROM reports_items\n\t\t\t\t\tWHERE local_graph_id=" . $local_graph_id . "\n\t\t\t\t\tAND report_id=" . $reports_id . "\n\t\t\t\t\tAND timespan=" . $_POST["timespan"]);
if (!$existing) {
$sequence = db_fetch_cell("SELECT max(sequence)\n\t\t\t\t\t\tFROM reports_items\n\t\t\t\t\t\tWHERE report_id=" . $reports_id);
$sequence++;
$graph_data = db_fetch_row("SELECT *\n\t\t\t\t\t\tFROM graph_local\n\t\t\t\t\t\tWHERE id=" . $local_graph_id);
if ($graph_data["host_id"]) {
$host_template = db_fetch_cell("SELECT host_template_id\n\t\t\t\t\t\t\tFROM host\n\t\t\t\t\t\t\tWHERE id=" . $graph_data["host_id"]);
} else {
$host_template = 0;
}
$save["id"] = 0;
$save["report_id"] = $reports_id;
$save["item_type"] = REPORTS_ITEM_GRAPH;
$save["tree_id"] = 0;
$save["branch_id"] = 0;
$save["tree_cascade"] = '';
$save["graph_name_regexp"] = '';
$save["host_template_id"] = $host_template;
$save["host_id"] = $graph_data["host_id"];
$save["graph_template_id"] = $graph_data["graph_template_id"];
$save["local_graph_id"] = $local_graph_id;
$save["timespan"] = $_POST["timespan"];
$save["align"] = $_POST["alignment"];
$save["item_text"] = '';
$save["font_size"] = $report["font_size"];
$save["sequence"] = $sequence;
$id = sql_save($save, 'reports_items');
if ($id) {
$message .= "Created Report Graph Item '<i>" . get_graph_title($local_graph_id) . "</i>'<br>";
} else {
$message .= "Failed Adding Report Graph Item '<i>" . get_graph_title($local_graph_id) . "</i>' Already Exists<br>";
}
} else {
$message .= "Skipped Report Graph Item '<i>" . get_graph_title($local_graph_id) . "</i>' Already Exists<br>";
}
}
}
}
if (strlen($message)) {
$_SESSION['reports_message'] = "{$message}";
}
raise_message('reports_message');
} else {
return $action;
}
}
开发者ID:MrWnn,项目名称:cacti,代码行数:71,代码来源:reports.php
示例12: display_reports_items
function display_reports_items($report_id)
{
global $graph_timespans;
global $item_types, $alignment;
$items = db_fetch_assoc('SELECT *
FROM reports_items
WHERE report_id=' . $report_id . '
ORDER BY sequence');
$css = db_fetch_cell('SELECT cformat FROM reports WHERE id=' . $report_id);
html_header(array('Item', 'Sequence', 'Type', 'Item Details', 'Timespan', 'Alignment', 'Font Size', 'Actions'), 2);
$i = 0;
if (sizeof($items) > 0) {
foreach ($items as $item) {
switch ($item['item_type']) {
case REPORTS_ITEM_GRAPH:
$item_details = get_graph_title($item['local_graph_id']);
$align = $item['align'] > 0 ? $alignment[$item['align']] : '';
$size = '';
$timespan = $item['timespan'] > 0 ? $graph_timespans[$item['timespan']] : '';
break;
case REPORTS_ITEM_TEXT:
$item_details = $item['item_text'];
$align = $item['align'] > 0 ? $alignment[$item['align']] : '';
$size = $item['font_size'] > 0 ? $item['font_size'] : '';
$timespan = '';
break;
case REPORTS_ITEM_TREE:
if ($item['branch_id'] > 0) {
$branch_details = db_fetch_row('SELECT * FROM graph_tree_items WHERE id=' . $item['branch_id']);
} else {
$branch_details = array();
}
$tree_name = db_fetch_cell('SELECT name FROM graph_tree WHERE id=' . $item['tree_id']);
$item_details = 'Tree: ' . $tree_name;
if ($item['branch_id'] > 0) {
if ($branch_details['host_id'] > 0) {
$item_details .= ', Host: ' . db_fetch_cell('SELECT description FROM host WHERE id=' . $branch_details['host_id']);
} else {
$item_details .= ', Branch: ' . $branch_details['title'];
if ($item['tree_cascade'] == 'on') {
$item_details .= ' (All Branches)';
} else {
$item_details .= ' (Current Branch)';
}
}
}
$align = $item['align'] > 0 ? $
|
请发表评论