本文整理汇总了PHP中form_alternate_row_color函数的典型用法代码示例。如果您正苦于以下问题:PHP form_alternate_row_color函数的具体用法?PHP form_alternate_row_color怎么用?PHP form_alternate_row_color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了form_alternate_row_color函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: templates
function templates()
{
global $config, $colors, $ds_actions;
html_start_box('<strong>GPS Templates</strong>', '100%', $colors['header'], '3', 'center', 'gpstemplates.php?action=add');
html_header_checkbox(array('Host Template', 'Up Image', 'Recovering Image', 'Down Image', 'Is AP'));
$template_list = db_fetch_assoc('SELECT * FROM gpsmap_templates ORDER BY templateID');
$i = 0;
if (sizeof($template_list) > 0) {
foreach ($template_list as $template) {
if ($template['AP']) {
$isAP = "True";
} else {
$isAP = "False";
}
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $template["templateID"]);
$i++;
form_selectable_cell($template['templateName'], $template["templateID"]);
form_selectable_cell($template['upimage'], $template["templateID"]);
form_selectable_cell($template['recoverimage'], $template["templateID"]);
form_selectable_cell($template['downimage'], $template["templateID"]);
form_selectable_cell($isAP, $template["templateID"]);
form_checkbox_cell($template['templateID'], $template["templateID"]);
form_end_row();
}
} else {
print "<tr><td><em>No Data Templates</em></td></tr>\n";
}
html_end_box(false);
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($ds_actions);
print "</form>\n";
}
示例2: draw_edit_form
function draw_edit_form($array) {
global $colors;
//print "<pre>";print_r($array);print "</pre>";
if (sizeof($array) > 0) {
while (list($top_branch, $top_children) = each($array)) {
if ($top_branch == "config") {
$config_array = $top_children;
}elseif ($top_branch == "fields") {
$fields_array = $top_children;
}
}
}
$i = 0;
if (sizeof($fields_array) > 0) {
while (list($field_name, $field_array) = each($fields_array)) {
if ($i == 0) {
if (!isset($config_array["no_form_tag"])) {
print "<form method='post' action='" . ((isset($config_array["post_to"])) ? $config_array["post_to"] : basename($_SERVER["PHP_SELF"])) . "'" . ((isset($config_array["form_name"])) ? " name='" . $config_array["form_name"] . "'" : "") . ">\n";
}
}
if ($field_array["method"] == "hidden") {
form_hidden_box($field_name, $field_array["value"], ((isset($field_array["default"])) ? $field_array["default"] : ""));
}elseif ($field_array["method"] == "hidden_zero") {
form_hidden_box($field_name, $field_array["value"], "0");
}elseif ($field_array["method"] == "spacer") {
print "<tr bgcolor='" . $colors["header_panel"] . "'><td colspan='2' class='textSubHeaderDark'>" . $field_array["friendly_name"] . "</td></tr>\n";
}else{
if (isset($config_array["force_row_color"])) {
print "<tr bgcolor='#" . $config_array["force_row_color"] . "'>";
}else{
form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i);
}
print "<td width='" . ((isset($config_array["left_column_width"])) ? $config_array["left_column_width"] : "50%") . "'>\n<font class='textEditTitle'>" . $field_array["friendly_name"] . "</font><br>\n";
if (isset($field_array["sub_checkbox"])) {
form_checkbox($field_array["sub_checkbox"]["name"], $field_array["sub_checkbox"]["value"], $field_array["sub_checkbox"]["friendly_name"], "", ((isset($field_array["form_id"])) ? $field_array["form_id"] : ""));
}
print ((isset($field_array["description"])) ? $field_array["description"] : "") . "</td>\n";
print "<td>";
draw_edit_control($field_name, $field_array);
print "</td>\n</tr>\n";
$i++;
}
if ($i == sizeof($fields_array)) {
//print "</form>";
}
}
}
}
示例3: draw_edit_form
function draw_edit_form($array)
{
global $colors;
if (sizeof($array) > 0) {
while (list($top_branch, $top_children) = each($array)) {
if ($top_branch == "config") {
$config_array = $top_children;
} elseif ($top_branch == "fields") {
$fields_array = $top_children;
}
}
}
$i = 0;
if (sizeof($fields_array) > 0) {
while (list($field_name, $field_array) = each($fields_array)) {
if ($i == 0) {
if (!isset($config_array["no_form_tag"])) {
print "<tr style='display:none;'><td><form method='post' autocomplete='off' action='" . (isset($config_array["post_to"]) ? $config_array["post_to"] : basename($_SERVER["PHP_SELF"])) . "'" . (isset($config_array["form_name"]) ? " name='" . $config_array["form_name"] . "'" : "") . (isset($config_array["enctype"]) ? " enctype='" . $config_array["enctype"] . "'" : "") . "></td></tr>\n";
}
}
if ($field_array["method"] == "hidden") {
form_hidden_box($field_name, $field_array["value"], isset($field_array["default"]) ? $field_array["default"] : "");
} elseif ($field_array["method"] == "hidden_zero") {
form_hidden_box($field_name, $field_array["value"], "0");
} elseif ($field_array["method"] == "spacer") {
print "<tr id='row_{$field_name}' bgcolor='#" . $colors["header_panel"] . "'><td colspan='2' class='tableSubHeaderColumn'>" . $field_array["friendly_name"] . "</td></tr>\n";
} else {
if (isset($config_array["force_row_color"])) {
print "<tr id='row_{$field_name}' bgcolor='#" . $config_array["force_row_color"] . "'>";
} else {
form_alternate_row_color($colors["form_alternate1"], $colors["form_alternate2"], $i, 'row_' . $field_name);
}
print "<td width='" . (isset($config_array["left_column_width"]) ? $config_array["left_column_width"] : "50%") . "'>\n<font class='textEditTitle'>" . $field_array["friendly_name"] . "</font><br>\n";
if (isset($field_array["sub_checkbox"])) {
form_checkbox($field_array["sub_checkbox"]["name"], $field_array["sub_checkbox"]["value"], $field_array["sub_checkbox"]["friendly_name"], "", isset($check_array["on_change"]) ? $check_array["on_change"] : "", isset($field_array["form_id"]) ? $field_array["form_id"] : "");
}
print (isset($field_array["description"]) ? $field_array["description"] : "") . "</td>\n";
print "<td>";
draw_edit_control($field_name, $field_array);
print "</td>\n</tr>\n";
}
$i++;
}
}
}
示例4: import
function import()
{
global $colors, $hash_type_names;
?>
<form method="post" action="templates_import.php" enctype="multipart/form-data">
<?php
if (isset($_SESSION["import_debug_info"]) && is_array($_SESSION["import_debug_info"])) {
html_start_box("<strong>Import Results</strong>", "100%", "aaaaaa", "3", "center", "");
print "<tr bgcolor='#" . $colors["form_alternate1"] . "'><td><p class='textArea'>Cacti has imported the following items:</p>";
while (list($type, $type_array) = each($_SESSION["import_debug_info"])) {
print "<p><strong>" . $hash_type_names[$type] . "</strong></p>";
while (list($index, $vals) = each($type_array)) {
if ($vals["result"] == "success") {
$result_text = "<span style='color: green;'>[success]</span>";
} else {
$result_text = "<span style='color: red;'>[fail]</span>";
}
if ($vals["type"] == "update") {
$type_text = "<span style='color: gray;'>[update]</span>";
} else {
$type_text = "<span style='color: blue;'>[new]</span>";
}
print "<span style='font-family: monospace;'>{$result_text} " . $vals["title"] . " {$type_text}</span><br>\n";
$dep_text = "";
$there_are_dep_errors = false;
if (isset($vals["dep"]) && sizeof($vals["dep"]) > 0) {
while (list($dep_hash, $dep_status) = each($vals["dep"])) {
if ($dep_status == "met") {
$dep_status_text = "<span style='color: navy;'>Found Dependency:</span>";
} else {
$dep_status_text = "<span style='color: red;'>Unmet Dependency:</span>";
$there_are_dep_errors = true;
}
$dep_text .= "<span style='font-family: monospace;'> + {$dep_status_text} " . hash_to_friendly_name($dep_hash, true) . "</span><br>\n";
}
}
/* only print out dependency details if they contain errors; otherwise it would get too long */
if ($there_are_dep_errors == true) {
print $dep_text;
}
}
}
print "</td></tr>";
html_end_box();
kill_session_var("import_debug_info");
}
html_start_box("<strong>Import Templates</strong>", "100%", $colors["header"], "3", "center", "");
form_alternate_row_color($colors["form_alternate1"], $colors["form_alternate2"], 0);
?>
<td width="50%">
<font class="textEditTitle">Import Template from Local File</font><br>
If the XML file containing template data is located on your local machine, select it here.
</td>
<td>
<input type="file" name="import_file">
</td>
</tr>
<?php
form_alternate_row_color($colors["form_alternate1"], $colors["form_alternate2"], 1);
?>
<td width="50%">
<font class="textEditTitle">Import Template from Text</font><br>
If you have the XML file containing template data as text, you can paste it into this box to
import it.
</td>
<td>
<?php
form_text_area("import_text", "", "10\t", "50", "");
?>
</td>
</tr>
<?php
form_alternate_row_color($colors["form_alternate1"], $colors["form_alternate2"], 0);
?>
<td width="50%">
<font class="textEditTitle">Import RRA Settings</font><br>
Choose whether to allow Cacti to import custom RRA settings from imported templates or whether to use the defaults for this installation.
</td>
<td>
<?php
form_radio_button("import_rra", 1, 1, "Use defaults for this installation (Recommended)", 1);
echo "<br />";
form_radio_button("import_rra", 1, 2, "Use custom RRA settings from the template", 1);
?>
</td>
</tr>
<?php
form_hidden_box("save_component_import", "1", "");
html_end_box();
form_save_button("templates_import.php", "save");
}
示例5: draw_nontemplated_fields_custom_data
function draw_nontemplated_fields_custom_data($data_template_data_id, $field_name_format = "|field|", $header_title = "", $alternate_colors = true, $include_hidden_fields = true, $snmp_query_id = 0) {
global $colors;
$data = db_fetch_row("select id,data_input_id,data_template_id,name,local_data_id from data_template_data where id=$data_template_data_id");
$host_id = db_fetch_cell("select host.id from data_local,host where data_local.host_id=host.id and data_local.id=" . $data["local_data_id"]);
$template_data = db_fetch_row("select id,data_input_id from data_template_data where data_template_id=" . $data["data_template_id"] . " and local_data_id=0");
$draw_any_items = false;
/* get each INPUT field for this data input source */
$fields = db_fetch_assoc("select * from data_input_fields where data_input_id=" . $data["data_input_id"] . " and input_output='in' order by name");
/* loop through each field found */
$i = 0;
if (sizeof($fields) > 0) {
foreach ($fields as $field) {
$data_input_data = db_fetch_row("select * from data_input_data where data_template_data_id=" . $data["id"] . " and data_input_field_id=" . $field["id"]);
if (sizeof($data_input_data) > 0) {
$old_value = $data_input_data["value"];
}else{
$old_value = "";
}
/* if data template then get t_value from template, else always allow user input */
if (empty($data["data_template_id"])) {
$can_template = "on";
}else{
$can_template = db_fetch_cell("select t_value from data_input_data where data_template_data_id=" . $template_data["id"] . " and data_input_field_id=" . $field["id"]);
}
/* find our field name */
$form_field_name = str_replace("|id|", $field["id"], $field_name_format);
if ((!empty($host_id)) && (eregi('^' . VALID_HOST_FIELDS . '$', $field["type_code"])) && (empty($can_template))) { /* no host fields */
if ($include_hidden_fields == true) {
form_hidden_box($form_field_name, $old_value, "");
}
}elseif ((!empty($snmp_query_id)) && (eregi('^(index_type|index_value|output_type)$', $field["type_code"]))) { /* no data query fields */
if ($include_hidden_fields == true) {
form_hidden_box($form_field_name, $old_value, "");
}
}elseif (empty($can_template)) { /* no templated fields */
if ($include_hidden_fields == true) {
form_hidden_box($form_field_name, $old_value, "");
}
}else{
if (($draw_any_items == false) && ($header_title != "")) {
print "<tr bgcolor='#" . $colors["header_panel"] . "'><td colspan='2' style='font-size: 10px; color: white;'>$header_title</td></tr>\n";
}
if ($alternate_colors == true) {
form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i);
}else{
print "<tr bgcolor='#" . $colors["form_alternate1"] . "'>\n";
}
print "<td width='50%'><strong>" . $field["name"] . "</strong></td>\n";
print "<td>";
draw_custom_data_row($form_field_name, $field["id"], $data["id"], $old_value);
print "</td>";
print "</tr>\n";
$draw_any_items = true;
$i++;
}
}
}
return $i;
}
示例6: ds
function ds()
{
global $colors, $ds_actions;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("host_id"));
input_validate_input_number(get_request_var_request("page"));
/* ==================================================== */
/* clean up search string */
if (isset($_REQUEST["filter"])) {
$_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
}
/* clean up sort_column string */
if (isset($_REQUEST["sort_column"])) {
$_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column"));
}
/* clean up sort_direction string */
if (isset($_REQUEST["sort_direction"])) {
$_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction"));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear_x"])) {
kill_session_var("sess_ds_current_page");
kill_session_var("sess_ds_filter");
kill_session_var("sess_ds_sort_column");
kill_session_var("sess_ds_sort_direction");
kill_session_var("sess_ds_host_id");
unset($_REQUEST["page"]);
unset($_REQUEST["filter"]);
unset($_REQUEST["sort_column"]);
unset($_REQUEST["sort_direction"]);
unset($_REQUEST["host_id"]);
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("page", "sess_ds_current_page", "1");
load_current_session_value("filter", "sess_ds_filter", "");
load_current_session_value("sort_column", "sess_ds_sort_column", "name_cache");
load_current_session_value("sort_direction", "sess_ds_sort_direction", "ASC");
load_current_session_value("host_id", "sess_ds_host_id", "-1");
$host = db_fetch_row("select hostname from host where id=" . $_REQUEST["host_id"]);
html_start_box("<strong>Data Sources</strong> [host: " . (empty($host["hostname"]) ? "No Host" : $host["hostname"]) . "]", "100%", $colors["header"], "3", "center", "data_sources.php?action=ds_edit&host_id=" . $_REQUEST["host_id"]);
include "./include/html/inc_data_source_filter_table.php";
html_end_box();
/* form the 'where' clause for our main sql query */
if (strlen($_REQUEST["filter"])) {
$sql_where = "AND (data_template_data.name_cache like '%%" . $_REQUEST["filter"] . "%%'" . " OR data_template.name like '%%" . $_REQUEST["filter"] . "%%'" . " OR data_input.name like '%%" . $_REQUEST["filter"] . "%%')";
} else {
$sql_where = "";
}
if ($_REQUEST["host_id"] == "-1") {
/* Show all items */
} elseif ($_REQUEST["host_id"] == "0") {
$sql_where .= " AND data_local.host_id=0";
} elseif (!empty($_REQUEST["host_id"])) {
$sql_where .= " AND data_local.host_id=" . $_REQUEST["host_id"];
}
$total_rows = sizeof(db_fetch_assoc("SELECT\n\t\tdata_local.id\n\t\tFROM (data_local,data_template_data)\n\t\tLEFT JOIN data_input\n\t\tON (data_input.id=data_template_data.data_input_id)\n\t\tLEFT JOIN data_template\n\t\tON (data_local.data_template_id=data_template.id)\n\t\tWHERE data_local.id=data_template_data.local_data_id\n\t\t{$sql_where}"));
$poller_intervals = array_rekey(db_fetch_assoc("SELECT data_template_data.local_data_id AS id,\n\t\tMin(data_template_data.rrd_step*rra.steps) AS poller_interval\n\t\tFROM data_template\n\t\tINNER JOIN (data_local\n\t\tINNER JOIN ((data_template_data_rra\n\t\tINNER JOIN data_template_data ON data_template_data_rra.data_template_data_id=data_template_data.id)\n\t\tINNER JOIN rra ON data_template_data_rra.rra_id = rra.id) ON data_local.id = data_template_data.local_data_id) ON data_template.id = data_template_data.data_template_id\n\t\t{$sql_where}\n\t\tGROUP BY data_template_data.local_data_id"), "id", "poller_interval");
$data_sources = db_fetch_assoc("SELECT\n\t\tdata_template_data.local_data_id,\n\t\tdata_template_data.name_cache,\n\t\tdata_template_data.active,\n\t\tdata_input.name as data_input_name,\n\t\tdata_template.name as data_template_name,\n\t\tdata_local.host_id\n\t\tFROM (data_local,data_template_data)\n\t\tLEFT JOIN data_input\n\t\tON (data_input.id=data_template_data.data_input_id)\n\t\tLEFT JOIN data_template\n\t\tON (data_local.data_template_id=data_template.id)\n\t\tWHERE data_local.id=data_template_data.local_data_id\n\t\t{$sql_where}\n\t\tORDER BY " . $_REQUEST['sort_column'] . " " . $_REQUEST['sort_direction'] . " LIMIT " . read_config_option("num_rows_data_source") * ($_REQUEST["page"] - 1) . "," . read_config_option("num_rows_data_source"));
html_start_box("", "100%", $colors["header"], "3", "center", "");
/* generate page list */
$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, read_config_option("num_rows_data_source"), $total_rows, "data_sources.php?filter=" . $_REQUEST["filter"] . "&host_id=" . $_REQUEST["host_id"]);
$nav = "<tr bgcolor='#" . $colors["header"] . "'>\n\t\t\t<td colspan='6'>\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 ($_REQUEST["page"] > 1) {
$nav .= "<a class='linkOverDark' href='data_sources.php?filter=" . $_REQUEST["filter"] . "&host_id=" . $_REQUEST["host_id"] . "&page=" . ($_REQUEST["page"] - 1) . "'>";
}
$nav .= "Previous";
if ($_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 " . (read_config_option("num_rows_data_source") * ($_REQUEST["page"] - 1) + 1) . " to " . ($total_rows < read_config_option("num_rows_data_source") || $total_rows < read_config_option("num_rows_data_source") * $_REQUEST["page"] ? $total_rows : read_config_option("num_rows_data_source") * $_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 ($_REQUEST["page"] * read_config_option("num_rows_data_source") < $total_rows) {
$nav .= "<a class='linkOverDark' href='data_sources.php?filter=" . $_REQUEST["filter"] . "&host_id=" . $_REQUEST["host_id"] . "&page=" . ($_REQUEST["page"] + 1) . "'>";
}
$nav .= "Next";
if ($_REQUEST["page"] * read_config_option("num_rows_data_source") < $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("name_cache" => array("Name", "ASC"), "data_input_name" => array("Data Input Method", "ASC"), "nosort" => array("Poller<br>Interval", "ASC"), "active" => array("Active", "ASC"), "data_template_name" => array("Template Name", "ASC"));
html_header_sort_checkbox($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"]);
$i = 0;
if (sizeof($data_sources) > 0) {
foreach ($data_sources as $data_source) {
$data_template_name = empty($data_source["data_template_name"]) ? "<em>None</em>" : $data_source["data_template_name"];
$data_input_name = empty($data_source["data_input_name"]) ? "<em>External</em>" : $data_source["data_input_name"];
$poller_interval = isset($poller_intervals[$data_source["local_data_id"]]) ? $poller_intervals[$data_source["local_data_id"]] : 0;
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $data_source["local_data_id"]);
$i++;
form_selectable_cell("<a class='linkEditMain' href='data_sources.php?action=ds_edit&id=" . $data_source["local_data_id"] . "'>" . ($_REQUEST["filter"] != "" ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", title_trim(htmlentities($data_source["name_cache"]), read_config_option("max_title_data_source"))) : title_trim(htmlentities($data_source["name_cache"]), read_config_option("max_title_data_source"))) . "</a>", $data_source["local_data_id"]);
form_selectable_cell(($_REQUEST["filter"] != "" ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $data_input_name) : $data_input_name) . "</a>", $data_source["local_data_id"]);
form_selectable_cell(get_poller_interval($poller_interval), $data_source["local_data_id"]);
form_selectable_cell($data_source['active'], $data_source["local_data_id"]);
form_selectable_cell(($_REQUEST["filter"] != "" ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $data_source['data_template_name']) : $data_source['data_template_name']) . "</a>", $data_source["local_data_id"]);
form_checkbox_cell($data_source["name_cache"], $data_source["local_data_id"]);
form_end_row();
}
/* put the nav bar on the bottom as well */
print $nav;
} else {
//.........这里部分代码省略.........
示例7: syslog_alerts
//.........这里部分代码省略.........
unset($_REQUEST["rows"]);
unset($_REQUEST["sort_column"]);
unset($_REQUEST["sort_direction"]);
} else {
/* if any of the settings changed, reset the page number */
$changed = 0;
$changed += syslog_check_changed("filter", "sess_syslog_alerts_filter");
$changed += syslog_check_changed("enabled", "sess_syslog_alerts_enabled");
$changed += syslog_check_changed("rows", "sess_syslog_alerts_rows");
$changed += syslog_check_changed("sort_column", "sess_syslog_alerts_sort_column");
$changed += syslog_check_changed("sort_direction", "sess_syslog_alerts_sort_direction");
if ($changed) {
$_REQUEST["page"] = "1";
}
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("page", "sess_syslog_alerts_paage", "1");
load_current_session_value("rows", "sess_syslog_alerts_rows", "-1");
load_current_session_value("enabled", "sess_syslog_alerts_enabled", "-1");
load_current_session_value("filter", "sess_syslog_alerts_filter", "");
load_current_session_value("sort_column", "sess_syslog_alerts_sort_column", "name");
load_current_session_value("sort_direction", "sess_syslog_alerts_sort_direction", "ASC");
html_start_box("<strong>Syslog Alert Filters</strong>", "100%", $colors["header"], "3", "center", "syslog_alerts.php?action=edit");
syslog_filter();
html_end_box();
html_start_box("", "100%", $colors["header"], "3", "center", "");
$sql_where = "";
if ($_REQUEST["rows"] == "-1") {
$row_limit = read_config_option("num_rows_syslog");
} elseif ($_REQUEST["rows"] == -2) {
$row_limit = 999999;
} else {
$row_limit = $_REQUEST["rows"];
}
$alerts = syslog_get_alert_records($sql_where, $row_limit);
$rows_query_string = "SELECT COUNT(*)\n\t\tFROM `" . $syslogdb_default . "`.`syslog_alert`\n\t\t{$sql_where}";
$total_rows = syslog_db_fetch_cell($rows_query_string);
?>
<script type="text/javascript">
<!--
function applyChange(objForm) {
strURL = '?enabled=' + objForm.enabled.value;
strURL = strURL + '&filter=' + objForm.filter.value;
strURL = strURL + '&rows=' + objForm.rows.value;
document.location = strURL;
}
-->
</script>
<?php
/* generate page list */
$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, $row_limit, $total_rows, "syslog_alerts.php?filter=" . $_REQUEST["filter"]);
if ($total_rows > 0) {
$nav = "<tr bgcolor='#" . $colors["header"] . "'>\n\t\t\t\t\t<td colspan='13'>\n\t\t\t\t\t\t<table width='100%' cellspacing='0' cellpadding='0' border='0'>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td align='left' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t\t<strong><< ";
if ($_REQUEST["page"] > 1) {
$nav .= "<a class='linkOverDark' href='syslog_alerts.php?report=arp&page=" . ($_REQUEST["page"] - 1) . "'>";
}
$nav .= "Previous";
if ($_REQUEST["page"] > 1) {
$nav .= "</a>";
}
$nav .= "</strong>\n\t\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t\t<td align='center' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t\tShowing Rows " . ($total_rows == 0 ? "None" : $row_limit * ($_REQUEST["page"] - 1) + 1 . " to " . ($total_rows < $row_limit || $total_rows < $row_limit * $_REQUEST["page"] ? $total_rows : $row_limit * $_REQUEST["page"]) . " of {$total_rows} [{$url_page_select}]") . "\n\t\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t\t<td align='right' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t\t<strong>";
if ($_REQUEST["page"] * $row_limit < $total_rows) {
$nav .= "<a class='linkOverDark' href='syslog_alerts.php?report=arp&page=" . ($_REQUEST["page"] + 1) . "'>";
}
$nav .= "Next";
if ($_REQUEST["page"] * $row_limit < $total_rows) {
$nav .= "</a>";
}
$nav .= " >></strong>\n\t\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
} else {
$nav = "<tr bgcolor='#" . $colors["header"] . "' class='noprint'>\n\t\t\t\t\t<td colspan='22'>\n\t\t\t\t\t\t<table width='100%' cellspacing='0' cellpadding='0' border='0'>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td align='center' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t\tNo Rows Found\n\t\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
}
print $nav;
$display_text = array("name" => array("Alert<br>Name", "ASC"), "severity" => array("<br>Severity", "ASC"), "method" => array("<br>Method", "ASC"), "num" => array("Threshold<br>Count", "ASC"), "enabled" => array("<br>Enabled", "ASC"), "type" => array("Match<br>Type", "ASC"), "message" => array("Search<br>String", "ASC"), "email" => array("E-Mail<br>Addresses", "DESC"), "date" => array("Last<br>Modified", "ASC"), "user" => array("By<br>User", "DESC"));
html_header_sort_checkbox($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"]);
$i = 0;
if (sizeof($alerts) > 0) {
foreach ($alerts as $alert) {
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $alert["id"]);
$i++;
form_selectable_cell("<a class='linkEditMain' href='" . $config['url_path'] . "plugins/syslog/syslog_alerts.php?action=edit&id=" . $alert["id"] . "'>" . ($_REQUEST["filter"] != "" ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $alert["name"]) : $alert["name"]) . "</a>", $alert["id"]);
form_selectable_cell($severities[$alert["severity"]], $alert["id"]);
form_selectable_cell($alert["method"] == 1 ? "Threshold" : "Individual", $alert["id"]);
form_selectable_cell($alert["method"] == 1 ? $alert["num"] : "N/A", $alert["id"]);
form_selectable_cell($alert["enabled"] == "on" ? "Yes" : "No", $alert["id"]);
form_selectable_cell($message_types[$alert["type"]], $alert["id"]);
form_selectable_cell(title_trim($alert["message"], 60), $alert["id"]);
form_selectable_cell(substr_count($alert["email"], ",") ? "Multiple" : $alert["email"], $alert["id"]);
form_selectable_cell(date("Y-m-d H:i:s", $alert["date"]), $alert["id"]);
form_selectable_cell($alert["user"], $alert["id"]);
form_checkbox_cell($alert["name"], $alert["id"]);
form_end_row();
}
} else {
print "<tr><td colspan='4'><em>No Syslog Alerts Defined</em></td></tr>";
}
html_end_box(false);
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($syslog_actions);
}
示例8: data_query
function data_query() {
global $colors;
html_start_box("<strong>Data Queries</strong>", "98%", $colors["header"], "3", "center", "data_queries.php?action=edit");
print "<tr bgcolor='#" . $colors["header_panel"] . "'>";
DrawMatrixHeaderItem("Name",$colors["header_text"],1);
DrawMatrixHeaderItem("Data Input Method",$colors["header_text"],1);
DrawMatrixHeaderItem(" ",$colors["header_text"],1);
print "</tr>";
$snmp_queries = db_fetch_assoc("SELECT
snmp_query.id,
snmp_query.name,
data_input.name AS data_input_method
FROM snmp_query INNER JOIN data_input ON snmp_query.data_input_id = data_input.id
ORDER BY snmp_query.name");
$i = 0;
if (sizeof($snmp_queries) > 0) {
foreach ($snmp_queries as $snmp_query) {
form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++;
?>
<td>
<a class="linkEditMain" href="data_queries.php?action=edit&id=<?php print $snmp_query["id"];?>"><?php print $snmp_query["name"];?></a>
</td>
<td>
<?php print $snmp_query["data_input_method"]; ?>
</td>
<td align="right">
<a href="data_queries.php?action=remove&id=<?php print $snmp_query["id"];?>"><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a>
</td>
</tr>
<?php
}
}
html_end_box();
}
示例9: get_checkbox_style
<td colspan='3'>
<table width='100%' cellspacing='0' cellpadding='3' border='0'>
<tr>
<?php
print "<td width='1%' align='right' class='textHeaderDark' style='" . get_checkbox_style() . "'><input type='checkbox' style='margin: 0px;' name='all' title='Select All' onClick='SelectAllGraphs(\"graph_\",this.checked)'></td><td bgcolor='#6D88AD'><strong>Select All</strong></td>\n";
?>
</tr>
</table>
</td>
</tr>
<?php
$i = 0;
if (sizeof($graphs) > 0) {
foreach ($graphs as $graph) {
form_alternate_row_color("f5f5f5", "ffffff", $i);
print "<td width='1%'>";
print "<input type='checkbox' name='graph_" . $graph["local_graph_id"] . "' id='graph_" . $graph["local_graph_id"] . "' value='" . $graph["local_graph_id"] . "'";
if (isset($graph_list[$graph["local_graph_id"]])) {
print " checked";
}
print ">\n";
print "</td>\n";
print "<td><strong><a href='graph.php?local_graph_id=" . $graph["local_graph_id"] . "&rra_id=all'>" . $graph["title_cache"] . "</a></strong></td>\n";
print "<td>" . $graph["height"] . "x" . $graph["width"] . "</td>\n";
print "</tr>";
$i++;
}
示例10: boost_display_run_status
//.........这里部分代码省略.........
/* This is the correct way to loop over the directory. */
while (FALSE !== ($file = readdir($handle))) {
$directory_contents[] = $file;
}
closedir($handle);
/* get size of directory */
$directory_size = 0;
$cache_files = 0;
if (sizeof($directory_contents)) {
/* goto the cache directory */
chdir($cache_directory);
/* check and fry as applicable */
foreach ($directory_contents as $file) {
/* only remove jpeg's and png's */
if (substr_count(strtolower($file), ".png") || substr_count(strtolower($file), ".jpg")) {
$cache_files++;
$directory_size += filesize($file);
}
}
}
$directory_size = boost_file_size_display($directory_size);
$cache_files = $cache_files . " Files";
} else {
$directory_size = "<strong>WARNING:</strong> Can not open directory";
$cache_files = "<strong>WARNING:</strong> Unknown";
}
} else {
$directory_size = "<strong>WARNING:</strong> Directory Does NOT Exist!!";
$cache_files = "<strong>WARNING:</strong> N/A";
}
$i = 0;
/* boost status display */
html_header(array("Current Boost Status"), 2);
form_alternate_row_color($colors["alternate"], $colors["light"], $i);
$i++;
print "<td><strong>Boost On Demand Updating:</strong></td><td><strong>" . ($rrd_updates == "" ? "Disabled" : $boost_status_text) . "</strong></td>";
form_alternate_row_color($colors["alternate"], $colors["light"], $i);
$i++;
print "<td><strong>Total Data Sources:</strong></td><td>" . $total_data_sources . "</td>";
if ($total_records > 0) {
form_alternate_row_color($colors["alternate"], $colors["light"], $i);
$i++;
print "<td><strong>Pending Boost Records:</strong></td><td>" . $pending_records . "</td>";
form_alternate_row_color($colors["alternate"], $colors["light"], $i);
$i++;
print "<td><strong>Archived Boost Records:</strong></td><td>" . $arch_records . "</td>";
form_alternate_row_color($colors["alternate"], $colors["light"], $i);
$i++;
print "<td><strong>Total Boost Records:</strong></td><td>" . $total_records . "</td>";
}
/* boost status display */
html_header(array("Boost Storage Statistics"), 2);
/* describe the table format */
form_alternate_row_color($colors["alternate"], $colors["light"], $i);
$i++;
print "<td><strong>Database Engine:</strong></td><td>" . $engine . "</td>";
/* tell the user how big the table is */
form_alternate_row_color($colors["alternate"], $colors["light"], $i);
$i++;
print "<td><strong>Current Boost Tables Size:</strong></td><td>" . boost_file_size_display($data_length, 2) . "</td>";
/* tell the user about the average size/record */
form_alternate_row_color($colors["alternate"], $colors["light"], $i);
$i++;
print "<td><strong>Avg Bytes/Record:</strong></td><td>" . boost_file_size_display($avg_row_length) . "</td>";
/* tell the user about the average size/record */
$output_length = read_config_option("boost_max_output_length");
示例11: cdef
function cdef() {
global $colors;
html_start_box("<strong>CDEF's</strong>", "98%", $colors["header"], "3", "center", "cdef.php?action=edit");
print "<tr bgcolor='#" . $colors["header_panel"] . "'>";
DrawMatrixHeaderItem("Name",$colors["header_text"],1);
DrawMatrixHeaderItem(" ",$colors["header_text"],1);
print "</tr>";
$cdefs = db_fetch_assoc("select * from cdef order by name");
$i = 0;
if (sizeof($cdefs) > 0) {
foreach ($cdefs as $cdef) {
form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++;
?>
<td>
<a class="linkEditMain" href="cdef.php?action=edit&id=<?php print $cdef["id"];?>"><?php print $cdef["name"];?></a>
</td>
<td align="right">
<a href="cdef.php?action=remove&id=<?php print $cdef["id"];?>"><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a>
</td>
</tr>
<?php
}
}
html_end_box();
}
示例12: weathermap_group_editor
function weathermap_group_editor()
{
global $colors, $config;
html_start_box("<strong>Edit Map Groups</strong>", "70%", $colors["header"], "2", "center", "weathermap-cacti-plugin-mgmt.php?action=group_form&id=0");
html_header(array("", "Group Name", "Settings", "Sort Order", ""));
$groups = db_fetch_assoc("select * from weathermap_groups order by sortorder");
$n = 0;
if( is_array($groups) )
{
if(sizeof($groups)>0)
{
foreach( $groups as $group)
{
form_alternate_row_color($colors["alternate"],$colors["light"],$n);
print '<td><a href="weathermap-cacti-plugin-mgmt.php?action=group_form&id='.intval($group['id']).'"><img src="../../images/graph_properties.gif" width="16" height="16" border="0" alt="Rename This Group" title="Rename This Group">Rename</a></td>';
print "<td>".htmlspecialchars($group['name'])."</td>";
print "<td>";
print "<a href='?action=map_settings&id=-".$group['id']."'>";
$setting_count = db_fetch_cell("select count(*) from weathermap_settings where mapid=0 and groupid=".$group['id']);
if($setting_count > 0)
{
print $setting_count." special";
if($setting_count>1) print "s";
}
else
{
print "standard";
}
print "</a>";
print "</td>";
print '<td>';
print '<a href="weathermap-cacti-plugin-mgmt.php?action=move_group_up&order='.$group['sortorder'].'&id='.$group['id'].'"><img src="../../images/move_up.gif" width="14" height="10" border="0" alt="Move Group Up" title="Move Group Up"></a>';
print '<a href="weathermap-cacti-plugin-mgmt.php?action=move_group_down&order='.$group['sortorder'].'&id='.$group['id'].'"><img src="../../images/move_down.gif" width="14" height="10" border="0" alt="Move Group Down" title="Move Group Down"></a>';
// print $map['sortorder'];
print "</td>";
print '<td>';
if($group['id']>1)
{
print '<a href="weathermap-cacti-plugin-mgmt.php?action=groupadmin_delete&id='.intval($group['id']).'"><img src="../../images/delete_icon.gif" width="10" height="10" border="0" alt="Remove this definition from this map"></a>';
}
print '</td>';
print "</tr>";
$n++;
}
}
else
{
print "<tr>";
print "<td colspan=2>No groups are defined.</td>";
print "</tr>";
}
}
html_end_box();
}
示例13: draw_graph_items_list
function draw_graph_items_list($item_list, $filename, $url_data, $disable_controls) {
global $colors, $config;
include($config["include_path"] . "/config_arrays.php");
print "<tr bgcolor='#" . $colors["header_panel"] . "'>";
DrawMatrixHeaderItem("Graph Item",$colors["header_text"],1);
DrawMatrixHeaderItem("Data Source",$colors["header_text"],1);
DrawMatrixHeaderItem("Graph Item Type",$colors["header_text"],1);
DrawMatrixHeaderItem("CF Type",$colors["header_text"],1);
DrawMatrixHeaderItem("Item Color",$colors["header_text"],4);
print "</tr>";
$group_counter = 0; $_graph_type_name = ""; $i = 0;
$alternate_color_1 = $colors["alternate"]; $alternate_color_2 = $colors["alternate"];
if (sizeof($item_list) > 0) {
foreach ($item_list as $item) {
/* graph grouping display logic */
$this_row_style = ""; $use_custom_row_color = false; $hard_return = "";
if ($graph_item_types{$item["graph_type_id"]} != "GPRINT") {
$this_row_style = "font-weight: bold;"; $use_custom_row_color = true;
if ($group_counter % 2 == 0) {
$alternate_color_1 = "EEEEEE";
$alternate_color_2 = "EEEEEE";
$custom_row_color = "D5D5D5";
}else{
$alternate_color_1 = $colors["alternate"];
$alternate_color_2 = $colors["alternate"];
$custom_row_color = "D2D6E7";
}
$group_counter++;
}
$_graph_type_name = $graph_item_types{$item["graph_type_id"]};
/* alternating row color */
if ($use_custom_row_color == false) {
form_alternate_row_color($alternate_color_1,$alternate_color_2,$i);
}else{
print "<tr bgcolor='#$custom_row_color'>";
}
print "<td>";
if ($disable_controls == false) { print "<a href='$filename?action=item_edit&id=" . $item["id"] . "&$url_data'>"; }
print "<strong>Item # " . ($i+1) . "</strong>";
if ($disable_controls == false) { print "</a>"; }
print "</td>\n";
if (empty($item["data_source_name"])) { $item["data_source_name"] = "No Task"; }
switch (true) {
case ereg("(AREA|STACK|GPRINT|LINE[123])", $_graph_type_name):
$matrix_title = "(" . $item["data_source_name"] . "): " . $item["text_format"];
break;
case ereg("(HRULE|VRULE)", $_graph_type_name):
$matrix_title = "HRULE: " . $item["value"];
break;
case ereg("(COMMENT)", $_graph_type_name):
$matrix_title = "COMMENT: " . $item["text_format"];
break;
}
if ($item["hard_return"] == "on") {
$hard_return = "<strong><font color=\"#FF0000\"><HR></font></strong>";
}
print "<td style='$this_row_style'>" . htmlspecialchars($matrix_title) . $hard_return . "</td>\n";
print "<td style='$this_row_style'>" . $graph_item_types{$item["graph_type_id"]} . "</td>\n";
print "<td style='$this_row_style'>" . $consolidation_functions{$item["consolidation_function_id"]} . "</td>\n";
print "<td" . ((!empty($item["hex"])) ? " bgcolor='#" . $item["hex"] . "'" : "") . " width='1%'> </td>\n";
print "<td style='$this_row_style'>" . $item["hex"] . "</td>\n";
if ($disable_controls == false) {
print "<td><a href='$filename?action=item_movedown&id=" . $item["id"] . "&$url_data'><img src='images/move_down.gif' border='0' alt='Move Down'></a>
<a href='$filename?action=item_moveup&id=" . $item["id"] . "&$url_data'><img src='images/move_up.gif' border='0' alt='Move Up'></a></td>\n";
print "<td align='right'><a href='$filename?action=item_remove&id=" . $item["id"] . "&$url_data'><img src='images/delete_icon.gif' width='10' height='10' border='0' alt='Delete'></a></td>\n";
}
print "</tr>";
$i++;
}
}else{
print "<tr bgcolor='#" . $colors["form_alternate2"] . "'><td colspan='7'><em>No Items</em></td></tr>";
}
}
示例14: template
function template() {
global $colors, $host_actions;
/* clean up sort_column */
if (isset($_REQUEST["sort_column"])) {
$_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column"));
}
/* clean up search string */
if (isset($_REQUEST["sort_direction"])) {
$_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction"));
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("sort_column", "sess_host_template_column", "name");
load_current_session_value("sort_direction", "sess_host_template_sort_direction", "ASC");
display_output_messages();
html_start_box("<strong>Host Templates</strong>", "98%", $colors["header"], "3", "center", "host_templates.php?action=edit");
$display_text = array(
"name" => array("Template Title", "ASC"));
html_header_sort_checkbox($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"]);
$host_templates = db_fetch_assoc("SELECT *
FROM host_template
ORDER BY " . $_REQUEST['sort_column'] . " " . $_REQUEST['sort_direction']);
$i = 0;
if (sizeof($host_templates) > 0) {
foreach ($host_templates as $host_template) {
form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++;
?>
<td>
<a class="linkEditMain" href="host_templates.php?action=edit&id=<?php print $host_template["id"];?>"><?php print $host_template["name"];?></a>
</td>
<td style="<?php print get_checkbox_style();?>" width="1%" align="right">
<input type='checkbox' style='margin: 0px;' name='chk_<?php print $host_template["id"];?>' title="<?php print $host_template["name"];?>">
</td>
</tr>
<?php
}
}else{
print "<tr><td><em>No Host Templates</em></td></tr>\n";
}
html_end_box(false);
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($host_actions);
print "</form>\n";
}
示例15: templates
//.........这里部分代码省略.........
</table>
</form>
</td>
</tr>
<?php
html_end_box();
$sql_where = '';
$limit = ' LIMIT ' . $_REQUEST["rows"] * ($_REQUEST['page'] - 1) . "," . $_REQUEST["rows"];
$order = "ORDER BY " . $_REQUEST['sort_column'] . " " . $_REQUEST['sort_direction'];
if (strlen($_REQUEST["filter"])) {
$sql_where .= (strlen($sql_where) ? " AND" : "WHERE") . " thold_template.name LIKE '%%" . $_REQUEST["filter"] . "%%'";
}
define('MAX_DISPLAY_PAGES', 21);
$total_rows = db_fetch_cell("SELECT count(*) FROM thold_template");
$template_list = db_fetch_assoc("SELECT * FROM thold_template {$sql_where} {$order} {$limit}");
if ($total_rows) {
/* generate page list */
$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, $_REQUEST["rows"], $total_rows, "thold_templates.php?tab=thold");
$nav = "<tr bgcolor='#" . $colors["header"] . "'>\r\n\t\t\t\t<td colspan='10'>\r\n\t\t\t\t\t<table width='100%' cellspacing='0' cellpadding='0' border='0'>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td align='left' class='textHeaderDark'>\r\n\t\t\t\t\t\t\t\t<strong><< ";
if ($_REQUEST["page"] > 1) {
$nav .= "<a class='linkOverDark' href='" . htmlspecialchars("thold_templates.php?filter=" . $_REQUEST["filter"] . "&page=" . ($_REQUEST["page"] - 1)) . "'>";
}
$nav .= "Previous";
if ($_REQUEST["page"] > 1) {
$nav .= "</a>";
}
$nav .= "</strong>\r\n\t\t\t\t\t\t\t</td>\n\r\n\t\t\t\t\t\t\t<td align='center' class='textHeaderDark'>\r\n\t\t\t\t\t\t\t\tShowing Rows " . ($_REQUEST["rows"] * ($_REQUEST["page"] - 1) + 1) . " to " . ($total_rows < read_config_option("num_rows_device") || $total_rows < $_REQUEST["rows"] * $_REQUEST["page"] ? $total_rows : $_REQUEST["rows"] * $_REQUEST["page"]) . " of {$total_rows} [{$url_page_select}]\r\n\t\t\t\t\t\t\t</td>\n\r\n\t\t\t\t\t\t\t<td align='right' class='textHeaderDark'>\r\n\t\t\t\t\t\t\t\t<strong>";
if ($_REQUEST["page"] * $_REQUEST["rows"] < $total_rows) {
$nav .= "<a class='linkOverDark' href='" . htmlspecialchars("thold_templates.php?filter=" . $_REQUEST["filter"] . "&page=" . ($_REQUEST["page"] + 1)) . "'>";
}
$nav .= "Next";
if ($_REQUEST["page"] * $_REQUEST["rows"] < $total_rows) {
$nav .= "</a>";
}
$nav .= " >></strong>\r\n\t\t\t\t\t\t\t</td>\n\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\n";
} else {
$nav = "<tr bgcolor='#" . $colors["header"] . "'>\r\n\t\t\t\t<td colspan='10'>\r\n\t\t\t\t\t<table width='100%' cellspacing='0' cellpadding='0' border='0'>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td align='center' class='textHeaderDark'>\r\n\t\t\t\t\t\t\t\tNo Rows Found\r\n\t\t\t\t\t\t\t</td>\n\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\n";
}
/* print checkbox form for validation */
print "<form name='chk' method='post' action='thold_templates.php'>\n";
html_start_box('', '100%', $colors['header'], '3', 'center', '');
print $nav;
html_header_sort_checkbox(array('name' => array('Name', 'ASC'), 'data_template_name' => array('Data Template', 'ASC'), 'data_source_name' => array('DS Name', 'ASC'), 'thold_type' => array('Type', 'ASC'), 'nosort1' => array('High/Up', ''), 'nosort2' => array('Low/Down', ''), 'nosort3' => array('Trigger', ''), 'nosort4' => array('Duration', ''), 'nosort5' => array('Repeat', '')), $_REQUEST['sort_column'], $_REQUEST['sort_direction'], false);
$i = 0;
$types = array('High/Low', 'Baseline Deviation', 'Time Based');
if (sizeof($template_list)) {
foreach ($template_list as $template) {
switch ($template['thold_type']) {
case 0:
# hi/lo
$value_hi = thold_format_number($template['thold_hi']);
$value_lo = thold_format_number($template['thold_low']);
$value_trig = $template['thold_fail_trigger'];
$value_duration = '';
$value_warning_hi = thold_format_number($template['thold_warning_hi']);
$value_warning_lo = thold_format_number($template['thold_warning_low']);
$value_warning_trig = $template['thold_warning_fail_trigger'];
$value_warning_duration = '';
break;
case 1:
# baseline
$value_hi = $template['bl_pct_up'] . (strlen($template['bl_pct_up']) ? '%' : '-');
$value_lo = $template['bl_pct_down'] . (strlen($template['bl_pct_down']) ? '%' : '-');
$value_trig = $template['bl_fail_trigger'];
$step = db_fetch_cell("SELECT rrd_step \r\n\t\t\t\t\t\tFROM data_template_data \r\n\t\t\t\t\t\tWHERE data_template_id=" . $template['data_template_id'] . "\r\n\t\t\t\t\t\tLIMIT 1");
$value_duration = $template['bl_ref_time_range'] / $step;
break;
case 2:
#time
$value_hi = thold_format_number($template['time_hi']);
$value_lo = thold_format_number($template['time_low']);
$value_trig = $template['time_fail_trigger'];
$value_duration = $template['time_fail_length'];
break;
}
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $template["id"]);
$i++;
form_selectable_cell('<a class="linkEditMain" href="' . htmlspecialchars('thold_templates.php?action=edit&id=' . $template['id']) . '">' . ($template['name'] == '' ? $template['data_template_name'] . ' [' . $template['data_source_name'] . ']' : $template['name']) . '</a>', $template["id"]);
form_selectable_cell($template['data_template_name'], $template["id"]);
form_selectable_cell($template['data_source_name'], $template["id"]);
form_selectable_cell($types[$template['thold_type']], $template["id"]);
form_selectable_cell($value_hi, $template["id"]);
form_selectable_cell($value_lo, $template["id"]);
$trigger = plugin_thold_duration_convert($template['data_template_id'], $value_trig, 'alert', 'data_template_id');
form_selectable_cell(strlen($trigger) ? "<i>" . $trigger . "</i>" : "-", $template["id"]);
$duration = plugin_thold_duration_convert($template['data_template_id'], $value_duration, 'time', 'data_template_id');
form_selectable_cell(strlen($duration) ? $duration : "-", $template["id"]);
form_selectable_cell(plugin_thold_duration_convert($template['data_template_id'], $template['repeat_alert'], 'repeat', 'data_template_id'), $template['id']);
form_checkbox_cell($template['data_template_name'], $template["id"]);
form_end_row();
}
print $nav;
} else {
print "<tr><td><em>No Threshold Templates</em></td></tr>\n";
}
html_end_box(false);
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($thold_actions);
print "</form>\n";
}