本文整理汇总了PHP中add_tree_names_to_actions_array函数的典型用法代码示例。如果您正苦于以下问题:PHP add_tree_names_to_actions_array函数的具体用法?PHP add_tree_names_to_actions_array怎么用?PHP add_tree_names_to_actions_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_tree_names_to_actions_array函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: host
//.........这里部分代码省略.........
</select>
</td>
<td>
<input type="button" id='refresh' value="Go" title="Set/Refresh Filters">
</td>
<td>
<input type="button" id='clear' name="clear_x" value="Clear" title="Clear Filters">
</td>
</tr>
</table>
<input type='hidden' id='page' name='page' value='<?php
print $_REQUEST['page'];
?>
'>
</form>
</td>
</tr>
<?php
html_end_box();
/* form the 'where' clause for our main sql query */
if (strlen(get_request_var_request('filter'))) {
$sql_where = "where (host.hostname like '%%" . get_request_var_request('filter') . "%%' OR host.description like '%%" . get_request_var_request('filter') . "%%')";
} else {
$sql_where = '';
}
if (get_request_var_request('host_status') == '-1') {
/* Show all items */
} elseif (get_request_var_request('host_status') == '-2') {
$sql_where .= strlen($sql_where) ? " AND host.disabled='on'" : " WHERE host.disabled='on'";
} elseif (get_request_var_request('host_status') == '-3') {
$sql_where .= strlen($sql_where) ? " AND host.disabled=''" : " WHERE host.disabled=''";
} elseif (get_request_var_request('host_status') == '-4') {
$sql_where .= strlen($sql_where) ? " AND (host.status!='3' OR host.disabled='on')" : " WHERE (host.status!='3' OR host.disabled='on')";
} else {
$sql_where .= strlen($sql_where) ? ' AND (host.status=' . get_request_var_request('host_status') . " AND host.disabled = '')" : 'where (host.status=' . get_request_var_request('host_status') . " AND host.disabled = '')";
}
if (get_request_var_request('host_template_id') == '-1') {
/* Show all items */
} elseif (get_request_var_request('host_template_id') == '0') {
$sql_where .= strlen($sql_where) ? ' AND host.host_template_id=0' : ' WHERE host.host_template_id=0';
} elseif (!empty($_REQUEST['host_template_id'])) {
$sql_where .= strlen($sql_where) ? ' AND host.host_template_id=' . get_request_var_request('host_template_id') : ' WHERE host.host_template_id=' . get_request_var_request('host_template_id');
}
/* print checkbox form for validation */
print "<form name='chk' method='post' action='host.php'>\n";
html_start_box('', '100%', '', '3', 'center', '');
$total_rows = db_fetch_cell("SELECT\n\t\tCOUNT(host.id)\n\t\tFROM host\n\t\t{$sql_where}");
$sortby = get_request_var_request('sort_column');
if ($sortby == 'hostname') {
$sortby = 'INET_ATON(hostname)';
}
$sql_query = "SELECT host.*, graphs, data_sources\n\t\tFROM host\n\t\tLEFT JOIN (SELECT host_id, COUNT(*) AS graphs FROM graph_local GROUP BY host_id) AS gl\n\t\tON host.id=gl.host_id\n\t\tLEFT JOIN (SELECT host_id, COUNT(*) AS data_sources FROM data_local GROUP BY host_id) AS dl\n\t\tON host.id=dl.host_id\n\t\t{$sql_where}\n\t\tGROUP BY host.id\n\t\tORDER BY " . $sortby . ' ' . get_request_var_request('sort_direction') . '
LIMIT ' . get_request_var_request('rows') * (get_request_var_request('page') - 1) . ',' . get_request_var_request('rows');
$hosts = db_fetch_assoc($sql_query);
$nav = html_nav_bar('host.php?filter=' . get_request_var_request('filter') . '&host_template_id=' . get_request_var_request('host_template_id') . '&host_status=' . get_request_var_request('host_status'), MAX_DISPLAY_PAGES, get_request_var_request('page'), get_request_var_request('rows'), $total_rows, 13, 'Devices', 'page', 'main');
print $nav;
$display_text = array('description' => array('display' => 'Device Description', 'align' => 'left', 'sort' => 'ASC', 'tip' => 'The name by which this Device will be referred to.'), 'hostname' => array('display' => 'Hostname', 'align' => 'left', 'sort' => 'ASC', 'tip' => 'Either an IP address, or hostname. If a hostname, it must be resolvable by either DNS, or from your hosts file.'), 'id' => array('display' => 'ID', 'align' => 'right', 'sort' => 'ASC', 'tip' => 'The internal database ID for this Device. Useful when performing automation or debugging.'), 'graphs' => array('display' => 'Graphs', 'align' => 'right', 'sort' => 'ASC', 'tip' => 'The total number of Graphs generated from this Device.'), 'data_sources' => array('display' => 'Data Sources', 'align' => 'right', 'sort' => 'ASC', 'tip' => 'The total number of Data Sources generated from this Device.'), 'status' => array('display' => 'Status', 'align' => 'center', 'sort' => 'ASC', 'tip' => 'The monitoring status of the Device based upon ping results. If this Device is a special type Device, by using the hostname "localhost", or due to the setting to not perform an Availability Check, it will always remain Up. When using cmd.php data collector, a Device with no Graphs, is not pinged by the data collector and will remain in an "Unknown" state.'), 'status_rec_date' => array('display' => 'In State', 'align' => 'right', 'sort' => 'ASC', 'tip' => 'The amount of time that this Device has been in its current state.'), 'snmp_sysUpTimeInstance' => array('display' => 'Uptime', 'align' => 'right', 'sort' => 'ASC', 'tip' => 'The current amount of time that the host has been up.'), 'polling_time' => array('display' => 'Poll Time', 'align' => 'right', 'sort' => 'ASC', 'tip' => 'The the amount of time it takes to collect data from this Device.'), 'cur_time' => array('display' => 'Current (ms)', 'align' => 'right', 'sort' => 'DESC', 'tip' => 'The current ping time in milliseconds to reach the Device.'), 'avg_time' => array('display' => 'Average (ms)', 'align' => 'right', 'sort' => 'DESC', 'tip' => 'The average ping time in milliseconds to reach the Device since the counters were cleared for this Device.'), 'availability' => array('display' => 'Availability', 'align' => 'right', 'sort' => 'ASC', 'tip' => 'The availability percentage based upon ping results insce the counters were cleared for this Device.'));
html_header_sort_checkbox($display_text, get_request_var_request('sort_column'), get_request_var_request('sort_direction'), false);
$i = 0;
if (sizeof($hosts) > 0) {
foreach ($hosts as $host) {
if ($host['disabled'] == '' && ($host['status'] == HOST_RECOVERING || $host['status'] == HOST_UP) && ($host['availability_method'] != AVAIL_NONE && $host['availability_method'] != AVAIL_PING)) {
$snmp_uptime = $host['snmp_sysUpTimeInstance'];
$days = intval($snmp_uptime / (60 * 60 * 24 * 100));
$remainder = $snmp_uptime % (60 * 60 * 24 * 100);
$hours = intval($remainder / (60 * 60 * 100));
$remainder = $remainder % (60 * 60 * 100);
$minutes = intval($remainder / (60 * 100));
$uptime = "{$days} d {$hours} h {$minutes} m";
} else {
$uptime = "N/A";
}
form_alternate_row('line' . $host['id'], true);
form_selectable_cell("<a class='linkEditMain' href='" . htmlspecialchars('host.php?action=edit&id=' . $host['id']) . "'>" . (strlen(get_request_var_request('filter')) ? preg_replace('/(' . preg_quote(get_request_var_request('filter'), '/') . ')/i', "<span class='filteredValue'>\\1</span>", htmlspecialchars($host['description'])) : htmlspecialchars($host['description'])) . '</a>', $host['id']);
form_selectable_cell(strlen(get_request_var_request('filter')) ? preg_replace('/(' . preg_quote(get_request_var_request('filter'), '/') . ')/i', "<span class='filteredValue'>\\1</span>", htmlspecialchars($host['hostname'])) : htmlspecialchars($host['hostname']), $host['id']);
form_selectable_cell($host['id'], $host['id'], '', 'text-align:right');
form_selectable_cell(number_format($host['graphs']), $host['id'], '', 'text-align:right');
form_selectable_cell(number_format($host['data_sources']), $host['id'], '', 'text-align:right');
form_selectable_cell(get_colored_device_status($host['disabled'] == 'on' ? true : false, $host['status']), $host['id'], '', 'text-align:center');
form_selectable_cell(get_timeinstate($host), $host['id'], '', 'text-align:right');
form_selectable_cell($uptime, $host['id'], '', 'text-align:right');
form_selectable_cell(round($host['polling_time'], 2), $host['id'], '', 'text-align:right');
form_selectable_cell(round($host['cur_time'], 2), $host['id'], '', 'text-align:right');
form_selectable_cell(round($host['avg_time'], 2), $host['id'], '', 'text-align:right');
form_selectable_cell(round($host['availability'], 2) . ' %', $host['id'], '', 'text-align:right');
form_checkbox_cell($host['description'], $host['id']);
form_end_row();
}
/* put the nav bar on the bottom as well */
print $nav;
} else {
print "<tr class='tableRow'><td colspan='11'><em>No Devices</em></td></tr>";
}
html_end_box(false);
/* add a list of tree names to the actions dropdown */
add_tree_names_to_actions_array();
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($device_actions);
print "</form>\n";
}
示例2: graph
//.........这里部分代码省略.........
if (get_request_var_request("host_id") == "-1") {
/* Show all items */
}elseif (get_request_var_request("host_id") == "0") {
$sql_where .= " AND graph_local.host_id=0";
}elseif (!empty($_REQUEST["host_id"])) {
$sql_where .= " AND graph_local.host_id=" . get_request_var_request("host_id");
}
if (get_request_var_request("template_id") == "-1") {
/* Show all items */
}elseif (get_request_var_request("template_id") == "0") {
$sql_where .= " AND graph_templates_graph.graph_template_id=0";
}elseif (!empty($_REQUEST["template_id"])) {
$sql_where .= " AND graph_templates_graph.graph_template_id=" . get_request_var_request("template_id");
}
html_start_box("", "100%", $colors["header"], "3", "center", "");
$total_rows = db_fetch_cell("SELECT
COUNT(graph_templates_graph.id)
FROM (graph_local,graph_templates_graph)
LEFT JOIN graph_templates ON (graph_local.graph_template_id=graph_templates.id)
WHERE graph_local.id=graph_templates_graph.local_graph_id
$sql_where");
$graph_list = db_fetch_assoc("SELECT
graph_templates_graph.id,
graph_templates_graph.local_graph_id,
graph_templates_graph.height,
graph_templates_graph.width,
graph_templates_graph.title_cache,
graph_templates.name,
graph_local.host_id
FROM (graph_local,graph_templates_graph)
LEFT JOIN graph_templates ON (graph_local.graph_template_id=graph_templates.id)
WHERE graph_local.id=graph_templates_graph.local_graph_id
$sql_where
ORDER BY " . $_REQUEST["sort_column"] . " " . get_request_var_request("sort_direction") .
" LIMIT " . (get_request_var_request("graph_rows")*(get_request_var_request("page")-1)) . "," . get_request_var_request("graph_rows"));
/* generate page list */
$url_page_select = get_page_list(get_request_var_request("page"), MAX_DISPLAY_PAGES, get_request_var_request("graph_rows"), $total_rows, "graphs.php?filter=" . get_request_var_request("filter") . "&host_id=" . get_request_var_request("host_id"));
$nav = "<tr bgcolor='#" . $colors["header"] . "'>
<td colspan='5'>
<table width='100%' cellspacing='0' cellpadding='0' border='0'>
<tr>
<td align='left' class='textHeaderDark'>
<strong><< "; if (get_request_var_request("page") > 1) { $nav .= "<a class='linkOverDark' href='graphs.php?filter=" . get_request_var_request("filter") . "&host_id=" . get_request_var_request("host_id") . "&page=" . (get_request_var_request("page")-1) . "'>"; } $nav .= "Previous"; if (get_request_var_request("page") > 1) { $nav .= "</a>"; } $nav .= "</strong>
</td>\n
<td align='center' class='textHeaderDark'>
Showing Rows " . ((get_request_var_request("graph_rows")*(get_request_var_request("page")-1))+1) . " to " . ((($total_rows < get_request_var_request("graph_rows")) || ($total_rows < (get_request_var_request("graph_rows")*get_request_var_request("page")))) ? $total_rows : (get_request_var_request("graph_rows")*get_request_var_request("page"))) . " of $total_rows [$url_page_select]
</td>\n
<td align='right' class='textHeaderDark'>
<strong>"; if ((get_request_var_request("page") * get_request_var_request("graph_rows")) < $total_rows) { $nav .= "<a class='linkOverDark' href='graphs.php?filter=" . get_request_var_request("filter") . "&host_id=" . get_request_var_request("host_id") . "&page=" . (get_request_var_request("page")+1) . "'>"; } $nav .= "Next"; if ((get_request_var_request("page") * get_request_var_request("graph_rows")) < $total_rows) { $nav .= "</a>"; } $nav .= " >></strong>
</td>\n
</tr>
</table>
</td>
</tr>\n";
print $nav;
$display_text = array(
"title_cache" => array("Graph Title", "ASC"),
"local_graph_id" => array("ID", "ASC"),
"name" => array("Template Name", "ASC"),
"height" => array("Size", "ASC"));
html_header_sort_checkbox($display_text, get_request_var_request("sort_column"), get_request_var_request("sort_direction"));
$i = 0;
if (sizeof($graph_list) > 0) {
foreach ($graph_list as $graph) {
$template_name = ((empty($graph["name"])) ? "<em>None</em>" : $graph["name"]);
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $graph["local_graph_id"]); $i++;
form_selectable_cell("<a class='linkEditMain' href='graphs.php?action=graph_edit&id=" . $graph["local_graph_id"] . "' title='" . htmlspecialchars($graph["title_cache"]) . "'>" . ((get_request_var_request("filter") != "") ? eregi_replace("(" . preg_quote(get_request_var_request("filter")) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", title_trim($graph["title_cache"], read_config_option("max_title_graph"))) : title_trim($graph["title_cache"], read_config_option("max_title_graph"))) . "</a>", $graph["local_graph_id"]);
form_selectable_cell($graph["local_graph_id"], $graph["local_graph_id"]);
form_selectable_cell(((get_request_var_request("filter") != "") ? eregi_replace("(" . preg_quote(get_request_var_request("filter")) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $template_name) : $template_name) . "</a>", $graph["local_graph_id"]);
form_selectable_cell($graph["height"] . "x" . $graph["width"], $graph["local_graph_id"]);
form_checkbox_cell($graph["title_cache"], $graph["local_graph_id"]);
form_end_row();
}
/* put the nav bar on the bottom as well */
print $nav;
}else{
print "<tr><td><em>No Graphs Found</em></td></tr>";
}
html_end_box(false);
/* add a list of tree names to the actions dropdown */
add_tree_names_to_actions_array();
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($graph_actions);
print "</form>\n";
}
示例3: host
//.........这里部分代码省略.........
html_start_box("", "100%", $colors["header"], "3", "center", "");
$total_rows = db_fetch_cell("select
COUNT(host.id)
from host
$sql_where");
$sortby = $_REQUEST["sort_column"];
if ($sortby=="hostname") {
$sortby = "INET_ATON(hostname)";
}
$host_graphs = array_rekey(db_fetch_assoc("SELECT host_id, count(*) as graphs FROM graph_local GROUP BY host_id"), "host_id", "graphs");
$host_data_sources = array_rekey(db_fetch_assoc("SELECT host_id, count(*) as data_sources FROM data_local GROUP BY host_id"), "host_id", "data_sources");
$sql_query = "SELECT
host.id,
host.disabled,
host.status,
host.hostname,
host.description,
host.min_time,
host.max_time,
host.cur_time,
host.avg_time,
host.availability
FROM host
$sql_where
ORDER BY " . $sortby . " " . $_REQUEST["sort_direction"] . "
LIMIT " . (read_config_option("num_rows_device")*($_REQUEST["page"]-1)) . "," . read_config_option("num_rows_device");
//print $sql_query;
$hosts = db_fetch_assoc($sql_query);
/* generate page list */
$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, read_config_option("num_rows_device"), $total_rows, "host.php?filter=" . $_REQUEST["filter"] . "&host_template_id=" . $_REQUEST["host_template_id"] . "&host_status=" . $_REQUEST["host_status"]);
$nav = "<tr bgcolor='#" . $colors["header"] . "'>
<td colspan='9'>
<table width='100%' cellspacing='0' cellpadding='0' border='0'>
<tr>
<td align='left' class='textHeaderDark'>
<strong><< "; if ($_REQUEST["page"] > 1) { $nav .= "<a class='linkOverDark' href='host.php?filter=" . $_REQUEST["filter"] . "&host_template_id=" . $_REQUEST["host_template_id"] . "&host_status=" . $_REQUEST["host_status"] . "&page=" . ($_REQUEST["page"]-1) . "'>"; } $nav .= "Previous"; if ($_REQUEST["page"] > 1) { $nav .= "</a>"; } $nav .= "</strong>
</td>\n
<td align='center' class='textHeaderDark'>
Showing Rows " . ((read_config_option("num_rows_device")*($_REQUEST["page"]-1))+1) . " to " . ((($total_rows < read_config_option("num_rows_device")) || ($total_rows < (read_config_option("num_rows_device")*$_REQUEST["page"]))) ? $total_rows : (read_config_option("num_rows_device")*$_REQUEST["page"])) . " of $total_rows [$url_page_select]
</td>\n
<td align='right' class='textHeaderDark'>
<strong>"; if (($_REQUEST["page"] * read_config_option("num_rows_device")) < $total_rows) { $nav .= "<a class='linkOverDark' href='host.php?filter=" . $_REQUEST["filter"] . "&host_template_id=" . $_REQUEST["host_template_id"] . "&host_status=" . $_REQUEST["host_status"] . "&page=" . ($_REQUEST["page"]+1) . "'>"; } $nav .= "Next"; if (($_REQUEST["page"] * read_config_option("num_rows_device")) < $total_rows) { $nav .= "</a>"; } $nav .= " >></strong>
</td>\n
</tr>
</table>
</td>
</tr>\n";
print $nav;
$display_text = array(
"description" => array("Description", "ASC"),
"nosort1" => array("Graphs", "ASC"),
"nosort2" => array("Data Sources", "ASC"),
"status" => array("Status", "ASC"),
"hostname" => array("Hostname", "ASC"),
"cur_time" => array("Current (ms)", "DESC"),
"avg_time" => array("Average (ms)", "DESC"),
"availability" => array("Availability", "ASC"));
html_header_sort_checkbox($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"]);
$i = 0;
if (sizeof($hosts) > 0) {
foreach ($hosts as $host) {
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $host["id"]); $i++;
form_selectable_cell("<a class='linkEditMain' href='host.php?action=edit&id=" . $host["id"] . "'>" .
(strlen($_REQUEST["filter"]) ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $host["description"]) : $host["description"]) . "</a>", $host["id"], 250);
form_selectable_cell((isset($host_graphs[$host["id"]]) ? $host_graphs[$host["id"]] : 0), $host["id"]);
form_selectable_cell((isset($host_data_sources[$host["id"]]) ? $host_data_sources[$host["id"]] : 0), $host["id"]);
form_selectable_cell(get_colored_device_status(($host["disabled"] == "on" ? true : false), $host["status"]), $host["id"]);
form_selectable_cell((strlen($_REQUEST["filter"]) ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $host["hostname"]) : $host["hostname"]), $host["id"]);
form_selectable_cell(round(($host["cur_time"]), 2), $host["id"]);
form_selectable_cell(round(($host["avg_time"]), 2), $host["id"]);
form_selectable_cell(round($host["availability"], 2), $host["id"]);
form_checkbox_cell($host["description"], $host["id"]);
form_end_row();
}
/* put the nav bar on the bottom as well */
print $nav;
}else{
print "<tr><td><em>No Hosts</em></td></tr>";
}
html_end_box(false);
/* add a list of tree names to the actions dropdown */
add_tree_names_to_actions_array();
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($device_actions);
}
示例4: host
//.........这里部分代码省略.........
</select>
</td>
<td nowrap>
<input type="image" src="images/button_go.gif" alt="Go" border="0" align="absmiddle">
<input type="image" src="images/button_clear.gif" name="clear" alt="Clear" border="0" align="absmiddle">
</td>
</tr>
</table>
</td>
<input type='hidden' name='page' value='1'>
</form>
</tr>
<?php
html_end_box();
/* form the 'where' clause for our main sql query */
if (strlen(get_request_var_request("filter"))) {
$sql_where = "where (host.hostname like '%%" . get_request_var_request("filter") . "%%' OR host.description like '%%" . get_request_var_request("filter") . "%%')";
} else {
$sql_where = "";
}
if (get_request_var_request("host_status") == "-1") {
/* Show all items */
} elseif (get_request_var_request("host_status") == "-2") {
$sql_where .= strlen($sql_where) ? " and host.disabled='on'" : "where host.disabled='on'";
} elseif (get_request_var_request("host_status") == "-3") {
$sql_where .= strlen($sql_where) ? " and host.disabled=''" : "where host.disabled=''";
} elseif (get_request_var_request("host_status") == "-4") {
$sql_where .= strlen($sql_where) ? " and (host.status!='3' or host.disabled='on')" : "where (host.status!='3' or host.disabled='on')";
} else {
$sql_where .= strlen($sql_where) ? " and (host.status=" . get_request_var_request("host_status") . " AND host.disabled = '')" : "where (host.status=" . get_request_var_request("host_status") . " AND host.disabled = '')";
}
if (get_request_var_request("host_template_id") == "-1") {
/* Show all items */
} elseif (get_request_var_request("host_template_id") == "0") {
$sql_where .= strlen($sql_where) ? " and host.host_template_id=0" : "where host.host_template_id=0";
} elseif (!empty($_REQUEST["host_template_id"])) {
$sql_where .= strlen($sql_where) ? " and host.host_template_id=" . get_request_var_request("host_template_id") : "where host.host_template_id=" . get_request_var_request("host_template_id");
}
html_start_box("", "100%", $colors["header"], "3", "center", "");
$total_rows = db_fetch_cell("select\n\t\tCOUNT(host.id)\n\t\tfrom host\n\t\t{$sql_where}");
$sortby = get_request_var_request("sort_column");
if ($sortby == "hostname") {
$sortby = "INET_ATON(hostname)";
}
$host_graphs = array_rekey(db_fetch_assoc("SELECT host_id, count(*) as graphs FROM graph_local GROUP BY host_id"), "host_id", "graphs");
$host_data_sources = array_rekey(db_fetch_assoc("SELECT host_id, count(*) as data_sources FROM data_local GROUP BY host_id"), "host_id", "data_sources");
$sql_query = "SELECT *\n\t\tFROM host\n\t\t{$sql_where}\n\t\tORDER BY " . $sortby . " " . get_request_var_request("sort_direction") . "\n\t\tLIMIT " . get_request_var_request("host_rows") * (get_request_var_request("page") - 1) . "," . get_request_var_request("host_rows");
$hosts = db_fetch_assoc($sql_query);
/* generate page list */
$url_page_select = get_page_list(get_request_var_request("page"), MAX_DISPLAY_PAGES, get_request_var_request("host_rows"), $total_rows, "host.php?filter=" . get_request_var_request("filter") . "&host_template_id=" . get_request_var_request("host_template_id") . "&host_status=" . get_request_var_request("host_status"));
$nav = "<tr bgcolor='#" . $colors["header"] . "'>\n\t\t\t<td colspan='11'>\n\t\t\t\t<table width='100%' cellspacing='0' cellpadding='0' border='0'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td align='left' class='textHeaderDark'>\n\t\t\t\t\t\t\t<strong><< ";
if (get_request_var_request("page") > 1) {
$nav .= "<a class='linkOverDark' href='host.php?filter=" . get_request_var_request("filter") . "&host_template_id=" . get_request_var_request("host_template_id") . "&host_status=" . get_request_var_request("host_status") . "&page=" . (get_request_var_request("page") - 1) . "'>";
}
$nav .= "Previous";
if (get_request_var_request("page") > 1) {
$nav .= "</a>";
}
$nav .= "</strong>\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t<td align='center' class='textHeaderDark'>\n\t\t\t\t\t\t\tShowing Rows " . (get_request_var_request("host_rows") * (get_request_var_request("page") - 1) + 1) . " to " . ($total_rows < read_config_option("num_rows_device") || $total_rows < get_request_var_request("host_rows") * get_request_var_request("page") ? $total_rows : get_request_var_request("host_rows") * get_request_var_request("page")) . " of {$total_rows} [{$url_page_select}]\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t<td align='right' class='textHeaderDark'>\n\t\t\t\t\t\t\t<strong>";
if (get_request_var_request("page") * get_request_var_request("host_rows") < $total_rows) {
$nav .= "<a class='linkOverDark' href='host.php?filter=" . get_request_var_request("filter") . "&host_template_id=" . get_request_var_request("host_template_id") . "&host_status=" . get_request_var_request("host_status") . "&page=" . (get_request_var_request("page") + 1) . "'>";
}
$nav .= "Next";
if (get_request_var_request("page") * get_request_var_request("host_rows") < $total_rows) {
$nav .= "</a>";
}
$nav .= " >></strong>\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n";
print $nav;
$display_text = array("description" => array("Description", "ASC"), "id" => array("ID", "ASC"), "nosort1" => array("Graphs", "ASC"), "nosort2" => array("Data Sources", "ASC"), "status" => array("Status", "ASC"), "status_event_count" => array("Event Count", "ASC"), "hostname" => array("Hostname", "ASC"), "cur_time" => array("Current (ms)", "DESC"), "avg_time" => array("Average (ms)", "DESC"), "availability" => array("Availability", "ASC"));
html_header_sort_checkbox($display_text, get_request_var_request("sort_column"), get_request_var_request("sort_direction"));
$i = 0;
if (sizeof($hosts) > 0) {
foreach ($hosts as $host) {
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $host["id"]);
$i++;
form_selectable_cell("<a class='linkEditMain' href='host.php?action=edit&id=" . $host["id"] . "'>" . (strlen(get_request_var_request("filter")) ? eregi_replace("(" . preg_quote(get_request_var_request("filter")) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $host["description"]) : $host["description"]) . "</a>", $host["id"], 250);
form_selectable_cell(round($host["id"], 2), $host["id"]);
form_selectable_cell(isset($host_graphs[$host["id"]]) ? $host_graphs[$host["id"]] : 0, $host["id"]);
form_selectable_cell(isset($host_data_sources[$host["id"]]) ? $host_data_sources[$host["id"]] : 0, $host["id"]);
form_selectable_cell(get_colored_device_status($host["disabled"] == "on" ? true : false, $host["status"]), $host["id"]);
form_selectable_cell(round($host["status_event_count"], 2), $host["id"]);
form_selectable_cell(strlen(get_request_var_request("filter")) ? eregi_replace("(" . preg_quote(get_request_var_request("filter")) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $host["hostname"]) : $host["hostname"], $host["id"]);
form_selectable_cell(round($host["cur_time"], 2), $host["id"]);
form_selectable_cell(round($host["avg_time"], 2), $host["id"]);
form_selectable_cell(round($host["availability"], 2), $host["id"]);
form_checkbox_cell($host["description"], $host["id"]);
form_end_row();
}
/* put the nav bar on the bottom as well */
print $nav;
} else {
print "<tr><td><em>No Hosts</em></td></tr>";
}
html_end_box(false);
/* add a list of tree names to the actions dropdown */
add_tree_names_to_actions_array();
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($device_actions);
print "</form>\n";
}
示例5: graph
//.........这里部分代码省略.........
/* form the 'where' clause for our main sql query */
if (strlen($_REQUEST["filter"])) {
$sql_where = "AND (graph_templates_graph.title_cache like '%%" . $_REQUEST["filter"] . "%%'" .
" OR graph_templates.name like '%%" . $_REQUEST["filter"] . "%%')";
}else{
$sql_where = "";
}
if ($_REQUEST["host_id"] == "-1") {
/* Show all items */
}elseif ($_REQUEST["host_id"] == "0") {
$sql_where .= " AND graph_local.host_id=0";
}elseif (!empty($_REQUEST["host_id"])) {
$sql_where .= " AND graph_local.host_id=" . $_REQUEST["host_id"];
}
html_start_box("", "100%", $colors["header"], "3", "center", "");
$total_rows = db_fetch_cell("SELECT
COUNT(graph_templates_graph.id)
FROM graph_templates_graph, graph_local
LEFT JOIN graph_templates ON (graph_local.graph_template_id=graph_templates.id)
WHERE graph_local.id=graph_templates_graph.local_graph_id
$sql_where");
$graph_list = db_fetch_assoc("SELECT
graph_templates_graph.id,
graph_templates_graph.local_graph_id,
graph_templates_graph.height,
graph_templates_graph.width,
graph_templates_graph.title_cache,
graph_templates.name,
graph_local.host_id
from graph_templates_graph,graph_local
left join graph_templates ON (graph_local.graph_template_id=graph_templates.id)
where graph_local.id=graph_templates_graph.local_graph_id
$sql_where
order by " . $_REQUEST['sort_column'] . " " . $_REQUEST['sort_direction'],
read_config_option("num_rows_graph"),(read_config_option("num_rows_graph")*($_REQUEST["page"]-1)));
/* generate page list */
$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, read_config_option("num_rows_graph"), $total_rows, "graphs.php?filter=" . $_REQUEST["filter"] . "&host_id=" . $_REQUEST["host_id"]);
$nav = "<tr bgcolor='#" . $colors["header"] . "'>
<td colspan='4'>
<table width='100%' cellspacing='0' cellpadding='0' border='0'>
<tr>
<td align='left' class='textHeaderDark'>
<strong><< "; if ($_REQUEST["page"] > 1) { $nav .= "<a class='linkOverDark' href='graphs.php?filter=" . $_REQUEST["filter"] . "&host_id=" . $_REQUEST["host_id"] . "&page=" . ($_REQUEST["page"]-1) . "'>"; } $nav .= "Previous"; if ($_REQUEST["page"] > 1) { $nav .= "</a>"; } $nav .= "</strong>
</td>\n
<td align='center' class='textHeaderDark'>
Showing Rows " . ((read_config_option("num_rows_graph")*($_REQUEST["page"]-1))+1) . " to " . ((($total_rows < read_config_option("num_rows_graph")) || ($total_rows < (read_config_option("num_rows_graph")*$_REQUEST["page"]))) ? $total_rows : (read_config_option("num_rows_graph")*$_REQUEST["page"])) . " of $total_rows [$url_page_select]
</td>\n
<td align='right' class='textHeaderDark'>
<strong>"; if (($_REQUEST["page"] * read_config_option("num_rows_graph")) < $total_rows) { $nav .= "<a class='linkOverDark' href='graphs.php?filter=" . $_REQUEST["filter"] . "&host_id=" . $_REQUEST["host_id"] . "&page=" . ($_REQUEST["page"]+1) . "'>"; } $nav .= "Next"; if (($_REQUEST["page"] * read_config_option("num_rows_graph")) < $total_rows) { $nav .= "</a>"; } $nav .= " >></strong>
</td>\n
</tr>
</table>
</td>
</tr>\n";
print $nav;
$display_text = array(
"title_cache" => array("Graph Title", "ASC"),
"name" => array("Template Name", "ASC"),
"height" => array("Size", "ASC"));
html_header_sort_checkbox($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"]);
$i = 0;
if (sizeof($graph_list) > 0) {
foreach ($graph_list as $graph) {
$template_name = ((empty($graph["name"])) ? "<em>None</em>" : $graph["name"]);
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $graph["local_graph_id"]); $i++;
form_selectable_cell("<a class='linkEditMain' href='graphs.php?action=graph_edit&id=" . $graph["local_graph_id"] . "' title='" . htmlspecialchars($graph["title_cache"]) . "'>" . (($_REQUEST["filter"] != "") ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", title_trim($graph["title_cache"], read_config_option("max_title_graph"))) : title_trim($graph["title_cache"], read_config_option("max_title_graph"))) . "</a>", $graph["local_graph_id"]);
form_selectable_cell((($_REQUEST["filter"] != "") ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $template_name) : $template_name) . "</a>", $graph["local_graph_id"]);
form_selectable_cell($graph["height"] . "x" . $graph["width"], $graph["local_graph_id"]);
form_checkbox_cell($graph["title_cache"], $graph["local_graph_id"]);
form_end_row();
}
/* put the nav bar on the bottom as well */
print $nav;
}else{
print "<tr><td><em>No Graphs Found</em></td></tr>";
}
html_end_box(false);
/* add a list of tree names to the actions dropdown */
add_tree_names_to_actions_array();
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($graph_actions);
print "</form>\n";
}
示例6: graph
//.........这里部分代码省略.........
<input type='button' id='clear' name='clear_x' value='Clear' title='Clear Filters'>
</td>
</tr>
</table>
<table cellpadding='2' cellspacing='0' border='0'>
<tr>
<td width='50'>
Search
</td>
<td>
<input id='filter' type='text' name='filter' size='25' value='<?php
print htmlspecialchars(get_request_var_request('filter'));
?>
'>
</td>
<td>
Graphs
</td>
<td>
<select id='rows' name='rows' onChange='applyFilter()'>
<?php
if (sizeof($item_rows) > 0) {
foreach ($item_rows as $key => $value) {
print "<option value='" . $key . "'";
if (get_request_var_request('rows') == $key) {
print ' selected';
}
print '>' . htmlspecialchars($value) . "</option>\n";
}
}
?>
</select>
</td>
</tr>
</table>
<input type='hidden' id='page' name='page' value='<?php
print $_REQUEST['page'];
?>
'>
</form>
</td>
</tr>
<?php
html_end_box();
/* form the 'where' clause for our main sql query */
if (strlen(get_request_var_request('filter'))) {
$sql_where = " AND (graph_templates_graph.title_cache like '%%" . get_request_var_request('filter') . "%%'" . " OR graph_templates.name like '%%" . get_request_var_request('filter') . "%%')";
} else {
$sql_where = '';
}
if (get_request_var_request('host_id') == '-1') {
/* Show all items */
} elseif (get_request_var_request('host_id') == '0') {
$sql_where .= ' AND graph_local.host_id=0';
} elseif (!empty($_REQUEST['host_id'])) {
$sql_where .= ' AND graph_local.host_id=' . get_request_var_request('host_id');
}
if (get_request_var_request('template_id') == '-1') {
/* Show all items */
} elseif (get_request_var_request('template_id') == '0') {
$sql_where .= ' AND graph_templates_graph.graph_template_id=0';
} elseif (!empty($_REQUEST['template_id'])) {
$sql_where .= ' AND graph_templates_graph.graph_template_id=' . get_request_var_request('template_id');
}
/* allow plugins to modify sql_where */
$sql_where .= api_plugin_hook_function('graphs_sql_where', $sql_where);
/* print checkbox form for validation */
print "<form name='chk' method='post' action='graphs.php'>\n";
html_start_box('', '100%', '', '3', 'center', '');
$total_rows = db_fetch_cell("SELECT\n\t\tCOUNT(graph_templates_graph.id)\n\t\tFROM (graph_local, graph_templates_graph)\n\t\tLEFT JOIN graph_templates ON (graph_local.graph_template_id = graph_templates.id)\n\t\tWHERE graph_local.id = graph_templates_graph.local_graph_id\n\t\t{$sql_where}");
$graph_list = db_fetch_assoc("SELECT\n\t\tgraph_templates_graph.id,\n\t\tgraph_templates_graph.local_graph_id,\n\t\tgraph_templates_graph.height,\n\t\tgraph_templates_graph.width,\n\t\tgraph_templates_graph.title_cache,\n\t\tgraph_templates.name,\n\t\tgraph_local.host_id\n\t\tFROM (graph_local, graph_templates_graph)\n\t\tLEFT JOIN graph_templates ON (graph_local.graph_template_id = graph_templates.id)\n\t\tWHERE graph_local.id = graph_templates_graph.local_graph_id\n\t\t{$sql_where}\n\t\tORDER BY " . $_REQUEST['sort_column'] . ' ' . get_request_var_request('sort_direction') . ' LIMIT ' . get_request_var_request('rows') * (get_request_var_request('page') - 1) . ',' . get_request_var_request('rows'));
$nav = html_nav_bar('graphs.php?filter=' . get_request_var_request('filter') . '&host_id=' . get_request_var_request('host_id'), MAX_DISPLAY_PAGES, get_request_var_request('page'), get_request_var_request('rows'), $total_rows, 5, 'Graphs', 'page', 'main');
print $nav;
$display_text = array('title_cache' => array('display' => 'Graph Name', 'align' => 'left', 'sort' => 'ASC', 'tip' => 'The Title of this Graph. Generally programatically generated from the Graph Template defition or Suggested Naming rules. The max length of the Title is controlled under Settings->Visual.'), 'local_graph_id' => array('display' => 'ID', 'align' => 'right', 'sort' => 'ASC', 'tip' => 'The internal database ID fro this Graph. Useful when performing automation or debugging.'), 'name' => array('display' => 'Template Name', 'align' => 'left', 'sort' => 'ASC', 'tip' => 'The Graph Template that this Graph was based upon.'), 'height' => array('display' => 'Size', 'align' => 'left', 'sort' => 'ASC', 'tip' => 'The size of this Graph when not in Preview mode.'));
html_header_sort_checkbox($display_text, get_request_var_request('sort_column'), get_request_var_request('sort_direction'), false);
$i = 0;
if (sizeof($graph_list) > 0) {
foreach ($graph_list as $graph) {
/* we're escaping strings here, so no need to escape them on form_selectable_cell */
$template_name = empty($graph['name']) ? '<em>None</em>' : htmlspecialchars($graph['name']);
form_alternate_row('line' . $graph['local_graph_id'], true);
form_selectable_cell("<a class='linkEditMain' href='" . htmlspecialchars('graphs.php?action=graph_edit&id=' . $graph['local_graph_id']) . "' title='" . htmlspecialchars($graph['title_cache']) . "'>" . (get_request_var_request('filter') != '' ? preg_replace('/(' . preg_quote(get_request_var_request('filter'), '/') . ')/i', "<span class='filteredValue'>\\1</span>", title_trim(htmlspecialchars($graph['title_cache']), read_config_option('max_title_length'))) : title_trim(htmlspecialchars($graph['title_cache']), read_config_option('max_title_length'))) . '</a>', $graph['local_graph_id']);
form_selectable_cell($graph['local_graph_id'], $graph['local_graph_id'], '', 'text-align:right');
form_selectable_cell(get_request_var_request('filter') != '' ? preg_replace('/(' . preg_quote(get_request_var_request('filter'), '/') . ')/i', "<span class='filteredValue'>\\1</span>", $template_name) : $template_name, $graph['local_graph_id']);
form_selectable_cell($graph['height'] . 'x' . $graph['width'], $graph['local_graph_id']);
form_checkbox_cell($graph['title_cache'], $graph['local_graph_id']);
form_end_row();
}
/* put the nav bar on the bottom as well */
print $nav;
} else {
print "<tr class='tableRow'><td colspan='5'><em>No Graphs Found</em></td></tr>";
}
html_end_box(false);
/* add a list of tree names to the actions dropdown */
add_tree_names_to_actions_array();
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($graph_actions);
print "</form>\n";
}
示例7: graph
//.........这里部分代码省略.........
</tr>
<tr>
<td width="50">
Search:
</td>
<td>
<input type="text" name="filter" size="40" value="<?php
print htmlspecialchars(get_request_var_request("filter"));
?>
">
</td>
<td style='white-space: nowrap;'>
Rows per Page:
</td>
<td width="1">
<select name="graph_rows" onChange="applyGraphsFilterChange(document.form_graph_id)">
<option value="-1"<?php
if (get_request_var_request("graph_rows") == "-1") {
?>
selected<?php
}
?>
>Default</option>
<?php
if (sizeof($item_rows) > 0) {
foreach ($item_rows as $key => $value) {
print "<option value='" . $key . "'";
if (get_request_var_request("graph_rows") == $key) {
print " selected";
}
print ">" . htmlspecialchars($value) . "</option>\n";
}
}
?>
</select>
</td>
</tr>
</table>
<input type='hidden' name='page' value='1'>
</form>
</td>
</tr>
<?php
html_end_box();
/* form the 'where' clause for our main sql query */
if (strlen(get_request_var_request("filter"))) {
$sql_where = " AND (graph_templates_graph.title_cache like '%%" . get_request_var_request("filter") . "%%'" . " OR graph_templates.name like '%%" . get_request_var_request("filter") . "%%')";
} else {
$sql_where = "";
}
if (get_request_var_request("host_id") == "-1") {
/* Show all items */
} elseif (get_request_var_request("host_id") == "0") {
$sql_where .= " AND graph_local.host_id=0";
} elseif (!empty($_REQUEST["host_id"])) {
$sql_where .= " AND graph_local.host_id=" . get_request_var_request("host_id");
}
if (get_request_var_request("template_id") == "-1") {
/* Show all items */
} elseif (get_request_var_request("template_id") == "0") {
$sql_where .= " AND graph_templates_graph.graph_template_id=0";
} elseif (!empty($_REQUEST["template_id"])) {
$sql_where .= " AND graph_templates_graph.graph_template_id=" . get_request_var_request("template_id");
}
/* allow plugins to modify sql_where */
$sql_where .= api_plugin_hook_function('graphs_sql_where', $sql_where);
/* print checkbox form for validation */
print "<form name='chk' method='post' action='graphs.php'>\n";
html_start_box("", "100%", "", "3", "center", "");
$total_rows = db_fetch_cell("SELECT\n\t\tCOUNT(graph_templates_graph.id)\n\t\tFROM (graph_local,graph_templates_graph)\n\t\tLEFT JOIN graph_templates ON (graph_local.graph_template_id=graph_templates.id)\n\t\tWHERE graph_local.id=graph_templates_graph.local_graph_id\n\t\t{$sql_where}");
$graph_list = db_fetch_assoc("SELECT\n\t\tgraph_templates_graph.id,\n\t\tgraph_templates_graph.local_graph_id,\n\t\tgraph_templates_graph.height,\n\t\tgraph_templates_graph.width,\n\t\tgraph_templates_graph.title_cache,\n\t\tgraph_templates.name,\n\t\tgraph_local.host_id\n\t\tFROM (graph_local,graph_templates_graph)\n\t\tLEFT JOIN graph_templates ON (graph_local.graph_template_id=graph_templates.id)\n\t\tWHERE graph_local.id=graph_templates_graph.local_graph_id\n\t\t{$sql_where}\n\t\tORDER BY " . $_REQUEST["sort_column"] . " " . get_request_var_request("sort_direction") . " LIMIT " . get_request_var_request("graph_rows") * (get_request_var_request("page") - 1) . "," . get_request_var_request("graph_rows"));
$nav = html_nav_bar("graphs.php?filter=" . get_request_var_request("filter") . "&host_id=" . get_request_var_request("host_id"), MAX_DISPLAY_PAGES, get_request_var_request("page"), get_request_var_request("graph_rows"), $total_rows, 5);
print $nav;
$display_text = array("title_cache" => array("Graph Title", "ASC"), "local_graph_id" => array("ID", "ASC"), "name" => array("Template Name", "ASC"), "height" => array("Size", "ASC"));
html_header_sort_checkbox($display_text, get_request_var_request("sort_column"), get_request_var_request("sort_direction"), false);
$i = 0;
if (sizeof($graph_list) > 0) {
foreach ($graph_list as $graph) {
/* we're escaping strings here, so no need to escape them on form_selectable_cell */
$template_name = empty($graph["name"]) ? "<em>None</em>" : htmlspecialchars($graph["name"]);
form_alternate_row('line' . $graph["local_graph_id"], true);
form_selectable_cell("<a class='linkEditMain' href='" . htmlspecialchars("graphs.php?action=graph_edit&id=" . $graph["local_graph_id"]) . "' title='" . htmlspecialchars($graph["title_cache"], ENT_QUOTES) . "'>" . (get_request_var_request("filter") != "" ? preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", title_trim(htmlspecialchars($graph["title_cache"]), read_config_option("max_title_graph"))) : title_trim(htmlspecialchars($graph["title_cache"]), read_config_option("max_title_graph"))) . "</a>", $graph["local_graph_id"]);
form_selectable_cell($graph["local_graph_id"], $graph["local_graph_id"]);
form_selectable_cell(get_request_var_request("filter") != "" ? preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $template_name) : $template_name, $graph["local_graph_id"]);
form_selectable_cell($graph["height"] . "x" . $graph["width"], $graph["local_graph_id"]);
form_checkbox_cell($graph["title_cache"], $graph["local_graph_id"]);
form_end_row();
}
/* put the nav bar on the bottom as well */
print $nav;
} else {
print "<tr><td><em>No Graphs Found</em></td></tr>";
}
html_end_box(false);
/* add a list of tree names to the actions dropdown */
add_tree_names_to_actions_array();
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($graph_actions);
print "</form>\n";
}