当前位置: 首页>>代码示例>>PHP>>正文


PHP html_nav_bar函数代码示例

本文整理汇总了PHP中html_nav_bar函数的典型用法代码示例。如果您正苦于以下问题:PHP html_nav_bar函数的具体用法?PHP html_nav_bar怎么用?PHP html_nav_bar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了html_nav_bar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mikrotik_view_graphs

function mikrotik_view_graphs()
{
    global $current_user, $colors, $config, $host_template_hashes, $graph_template_hashes;
    include './lib/timespan_settings.php';
    include './lib/html_graph.php';
    html_graph_validate_preview_request_vars();
    /* include graph view filter selector */
    html_start_box('<strong>Graph Preview Filters</strong>' . (isset($_REQUEST['style']) && strlen($_REQUEST['style']) ? ' [ Custom Graph List Applied - Filtering from List ]' : ''), '100%', '', '3', 'center', '');
    html_graph_preview_filter('mikrotik.php', 'graphs', 'ht.hash IN ("' . implode('","', $host_template_hashes) . '")', 'gt.hash IN ("' . implode('","', $graph_template_hashes) . '")');
    html_end_box();
    /* the user select a bunch of graphs of the 'list' view and wants them displayed here */
    $sql_or = '';
    if (isset($_REQUEST['style'])) {
        if (get_request_var_request('style') == 'selective') {
            /* process selected graphs */
            if (!empty($_REQUEST['graph_list'])) {
                foreach (explode(',', $_REQUEST['graph_list']) as $item) {
                    $graph_list[$item] = 1;
                }
            } else {
                $graph_list = array();
            }
            if (!empty($_REQUEST['graph_add'])) {
                foreach (explode(',', $_REQUEST['graph_add']) as $item) {
                    $graph_list[$item] = 1;
                }
            }
            /* remove items */
            if (!empty($_REQUEST['graph_remove'])) {
                foreach (explode(',', $_REQUEST['graph_remove']) as $item) {
                    unset($graph_list[$item]);
                }
            }
            $i = 0;
            foreach ($graph_list as $item => $value) {
                $graph_array[$i] = $item;
                $i++;
            }
            if (isset($graph_array) && sizeof($graph_array) > 0) {
                /* build sql string including each graph the user checked */
                $sql_or = array_to_sql_or($graph_array, 'gtg.local_graph_id');
                $set_rra_id = empty($rra_id) ? read_graph_config_option('default_rra_id') : get_request_var_request('rra_id');
            }
        }
    }
    $total_graphs = 0;
    // Filter sql_where
    $sql_where = strlen($_REQUEST['filter']) ? "gtg.title_cache LIKE '%" . get_request_var_request('filter') . "%'" : '';
    $sql_where .= (strlen($sql_or) && strlen($sql_where) ? ' AND ' : '') . $sql_or;
    // Host Id sql_where
    if ($_REQUEST['host_id'] > 0) {
        $sql_where .= (strlen($sql_where) ? ' AND' : '') . ' gl.host_id=' . $_REQUEST['host_id'];
    } else {
        $host_ids = mikrotik_host_ids_from_hashes($host_template_hashes);
        if (sizeof($host_ids)) {
            $sql_where .= (strlen($sql_where) ? ' AND' : '') . ' gl.host_id IN (' . implode(',', $host_ids) . ')';
        } else {
            $sql_where .= (strlen($sql_where) ? ' AND' : '') . ' 1=0';
        }
    }
    // Graph Template Id sql_where
    if ($_REQUEST['graph_template_id'] > 0) {
        $sql_where .= (strlen($sql_where) ? ' AND' : '') . ' gl.graph_template_id=' . $_REQUEST['graph_template_id'];
    } else {
        $graph_template_ids = mikrotik_graph_templates_from_hashes($graph_template_hashes);
        if (sizeof($graph_template_ids)) {
            $sql_where .= (strlen($sql_where) ? ' AND' : '') . ' gl.graph_template_id IN (' . implode(',', $graph_template_ids) . ')';
        } else {
            $sql_where .= (strlen($sql_where) ? ' AND' : '') . ' 1=0';
        }
    }
    $limit = $_REQUEST['graphs'] * ($_REQUEST['page'] - 1) . ',' . $_REQUEST['graphs'];
    $order = 'gtg.title_cache';
    $graphs = get_allowed_graphs($sql_where, $order, $limit, $total_graphs);
    /* do some fancy navigation url construction so we don't have to try and rebuild the url string */
    if (preg_match('/page=[0-9]+/', basename($_SERVER['QUERY_STRING']))) {
        $nav_url = str_replace('&page=' . get_request_var_request('page'), '', get_browser_query_string());
    } else {
        $nav_url = get_browser_query_string() . '&host_id=' . get_request_var_request('host_id');
    }
    $nav_url = preg_replace('/((\\?|&)host_id=[0-9]+|(\\?|&)filter=[a-zA-Z0-9]*)/', '', $nav_url);
    html_start_box('', '100%', '', '3', 'center', '');
    $nav = html_nav_bar($nav_url, MAX_DISPLAY_PAGES, get_request_var_request('page'), get_request_var_request('graphs'), $total_graphs, get_request_var_request('columns'), 'Graphs', 'page', 'main');
    print $nav;
    if (get_request_var_request('thumbnails') == 'true') {
        html_graph_thumbnail_area($graphs, '', 'graph_start=' . get_current_graph_start() . '&graph_end=' . get_current_graph_end(), '', get_request_var_request('columns'));
    } else {
        html_graph_area($graphs, '', 'graph_start=' . get_current_graph_start() . '&graph_end=' . get_current_graph_end(), '', get_request_var_request('columns'));
    }
    if ($total_graphs > 0) {
        print $nav;
    }
    html_end_box();
    bottom_footer();
}
开发者ID:TFyre,项目名称:plugin_mikrotik_new,代码行数:95,代码来源:mikrotik.php

示例2: 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";
}
开发者ID:MrWnn,项目名称:cacti,代码行数:101,代码来源:host.php

示例3: graphs


//.........这里部分代码省略.........
                        } else {
                            $sql_order = '';
                        }
                        /* get the unique field values from the database */
                        $field_names = db_fetch_assoc_prepared('SELECT DISTINCT field_name
						FROM host_snmp_cache
						WHERE host_id = ?
						AND snmp_query_id = ?', array($host['id'], $snmp_query['id']));
                        /* build magic query */
                        $sql_query = 'SELECT host_id, snmp_query_id, snmp_index';
                        $num_visible_fields = sizeof($field_names);
                        $i = 0;
                        if (sizeof($field_names) > 0) {
                            foreach ($field_names as $column) {
                                $field_name = $column['field_name'];
                                $sql_query .= ", MAX(CASE WHEN field_name='{$field_name}' THEN field_value ELSE NULL END) AS '{$field_name}'";
                                $i++;
                            }
                        }
                        $sql_query .= ' FROM host_snmp_cache
						WHERE host_id=' . $host['id'] . '
						AND snmp_query_id=' . $snmp_query['id'] . "\n\t\t\t\t\t\t{$sql_where}\n\t\t\t\t\t\tGROUP BY host_id, snmp_query_id, snmp_index\n\t\t\t\t\t\t{$sql_order}\n\t\t\t\t\t\tLIMIT " . $row_limit * ($page - 1) . ',' . $row_limit;
                        $rows_query = 'SELECT host_id, snmp_query_id, snmp_index
						FROM host_snmp_cache
						WHERE host_id=' . $host['id'] . '
						AND snmp_query_id=' . $snmp_query['id'] . "\n\t\t\t\t\t\t{$sql_where}\n\t\t\t\t\t\tGROUP BY host_id, snmp_query_id, snmp_index";
                        $snmp_query_indexes = db_fetch_assoc($sql_query);
                        $total_rows = sizeof(db_fetch_assoc($rows_query));
                        if (($page - 1) * $row_limit > $total_rows) {
                            $page = 1;
                            $_REQUEST['page' . $query['id']] = $page;
                            load_current_session_value('page' . $query['id'], 'sess_graphs_new_page' . $query['id'], '1');
                        }
                        $nav = html_nav_bar('graphs_new.php', MAX_DISPLAY_PAGES, $page, $row_limit, $total_rows, 15, 'Items', 'page' . $snmp_query['id']);
                        print $nav;
                        while (list($field_name, $field_array) = each($xml_array['fields'])) {
                            if ($field_array['direction'] == 'input' && sizeof($field_names)) {
                                foreach ($field_names as $row) {
                                    if ($row['field_name'] == $field_name) {
                                        $html_dq_header .= "<td class='tableSubHeaderColumn'>" . $field_array['name'] . "</td>\n";
                                        break;
                                    }
                                }
                            }
                        }
                        if (!sizeof($snmp_query_indexes)) {
                            print "<tr class='odd'><td>This Data Query returned 0 rows, perhaps there was a problem executing this\n\t\t\t\t\t\t\tData Query. You can <a href='" . htmlspecialchars('host.php?action=query_verbose&id=' . $snmp_query['id'] . '&host_id=' . $host['id']) . "'>run this Data Query in debug mode</a> to get more information.</td></tr>\n";
                        } else {
                            print "<tr class='tableHeader'>\n\t\t\t\t\t\t\t\t{$html_dq_header}\n\t\t\t\t\t\t\t\t<td width='1%' align='center' class='tableSubHeaderCheckbox' style='" . get_checkbox_style() . "'><input type='checkbox' style='margin: 0px;' name='all_" . $snmp_query['id'] . "' title='Select All' onClick='SelectAll(\"sg_" . $snmp_query['id'] . "\",this.checked)'></td>\n\n\t\t\t\t\t\t\t</tr>\n";
                        }
                        $row_counter = 0;
                        $column_counter = 0;
                        $fields = array_rekey($field_names, 'field_name', 'field_name');
                        if (sizeof($snmp_query_indexes) > 0) {
                            foreach ($snmp_query_indexes as $row) {
                                $query_row = $snmp_query['id'] . '_' . encode_data_query_index($row['snmp_index']);
                                print "<tr id='line{$query_row}' class='selectable " . ($row_counter % 2 == 0 ? 'odd' : 'even') . "'>";
                                $i++;
                                $column_counter = 0;
                                reset($xml_array['fields']);
                                while (list($field_name, $field_array) = each($xml_array['fields'])) {
                                    if ($field_array['direction'] == 'input') {
                                        if (in_array($field_name, $fields)) {
                                            if (isset($row[$field_name])) {
                                                print "<td><span id='text{$query_row}" . '_' . $column_counter . "'>" . (strlen($_REQUEST['filter']) ? preg_replace('/(' . preg_quote($_REQUEST['filter']) . ')/i', "<span class='filteredValue'>\\1</span>", $row[$field_name]) : $row[$field_name]) . '</span></td>';
                                            } else {
开发者ID:MrWnn,项目名称:cacti,代码行数:67,代码来源:graphs_new.php

示例4: snmpagent_utilities_run_eventlog


//.........这里部分代码省略.........
" onChange='applyFilter()'>
						</td>
						<td>
							Rows:
						</td>
						<td>
							<select id='rows' name="rows" onChange="applyFilter()">
								<option value="-1"<?php 
    if (get_request_var_request("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("rows") == $key) {
                print " selected";
            }
            print ">" . htmlspecialchars($value) . "</option>\n";
        }
    }
    ?>
							</select>
						</td>
						<td>
							<input type="submit" id="refresh" name="go" value="Go" title="Set/Refresh Filters">
							<input type="submit" id="clear" name="clear_x" value="Clear" title="Clear Filters">
							<input type="submit" id="purge" name="purge_x" value="Purge" title="Purge Notification Log">
						</td>
					</tr>
				</table>
				<input type='hidden' id='page' name='page' value='<?php 
    print $_REQUEST['page'];
    ?>
'>
			</form>
		</td>
	</tr>
	<?php 
    html_end_box();
    $sql_where = " 1";
    /* filter by severity */
    if (get_request_var_request("receiver") != "-1") {
        $sql_where .= " AND snmpagent_notifications_log.manager_id='" . get_request_var_request("receiver") . "'";
    }
    /* filter by severity */
    if (get_request_var_request("severity") == "-1") {
        /* Show all items */
    } elseif (!empty($_REQUEST["severity"])) {
        $sql_where .= " AND snmpagent_notifications_log.severity='" . get_request_var_request("severity") . "'";
    }
    /* filter by search string */
    if (get_request_var_request("filter") != "") {
        $sql_where .= " AND (`varbinds` LIKE '%%" . get_request_var_request("filter") . "%%')";
    }
    $sql_where .= ' ORDER by `time` DESC';
    $sql_query = "SELECT snmpagent_notifications_log.*, snmpagent_managers.hostname, snmpagent_cache.description FROM snmpagent_notifications_log\n\t\t\t\t\t INNER JOIN snmpagent_managers ON snmpagent_managers.id = snmpagent_notifications_log.manager_id\n\t\t\t\t\t LEFT JOIN snmpagent_cache ON snmpagent_cache.name = snmpagent_notifications_log.notification\n\t\t\t\t\t WHERE {$sql_where} LIMIT " . read_config_option("num_rows_data_source") * (get_request_var_request("page") - 1) . "," . read_config_option("num_rows_data_source");
    /* print checkbox form for validation */
    print "<form name='chk' method='post' action='managers.php'>\n";
    html_start_box("", "100%", "", "3", "center", "");
    $total_rows = db_fetch_cell("SELECT COUNT(*) FROM snmpagent_notifications_log WHERE {$sql_where}");
    $logs = db_fetch_assoc($sql_query);
    /* generate page list */
    $nav = html_nav_bar("utilities.php?action=view_snmpagent_events&severity=" . get_request_var_request("severity") . "&receiver=" . get_request_var_request("receiver") . "&filter=" . get_request_var_request("filter"), MAX_DISPLAY_PAGES, get_request_var_request("page"), get_request_var_request("rows"), $total_rows, 11, '', 'page', 'main');
    print $nav;
    html_header(array(" ", "Time", "Receiver", "Notification", "Varbinds"));
    if (sizeof($logs) > 0) {
        foreach ($logs as $item) {
            $varbinds = strlen(get_request_var_request("filter")) ? preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $item["varbinds"]) : $item["varbinds"];
            form_alternate_row('line' . $item["id"], false);
            print "<td title='Severity Level: " . $severity_levels[$item["severity"]] . "' style='width:10px;background-color: " . $severity_colors[$item["severity"]] . ";border-top:1px solid white;border-bottom:1px solid white;'></td>";
            print "<td style='white-space: nowrap;'>" . date("Y/m/d H:i:s", $item["time"]) . "</td>";
            print "<td>" . $item["hostname"] . "</td>";
            if ($item["description"]) {
                print '<td><a href="#" title="<div class=\'header\'>' . $item["notification"] . '</div><div class=\'content preformatted\'>' . $item["description"] . '</div>" class="tooltip">' . $item["notification"] . '</a></td>';
            } else {
                print "<td>{$item["notification"]}</td>";
            }
            print "<td>{$varbinds}</td>";
            form_end_row();
        }
        print $nav;
    } else {
        print "<tr><td><em>No SNMP Notification Log Entries</em></td></tr>";
    }
    html_end_box();
    ?>

	<script language="javascript" type="text/javascript" >
		$('.tooltip').tooltip({
			track: true,
			position: { collision: "flipfit" },
			content: function() { return $(this).attr('title'); }
		});
	</script>
	<?php 
}
开发者ID:MrWnn,项目名称:cacti,代码行数:101,代码来源:utilities.php

示例5: mactrack_site

function mactrack_site()
{
    global $site_actions, $config, $item_rows;
    mactrack_site_validate_req_vars();
    if (get_request_var('rows') == -1) {
        $row_limit = read_config_option('num_rows_table');
    } elseif (get_request_var('rows') == -2) {
        $row_limit = 999999;
    } else {
        $row_limit = get_request_var('rows');
    }
    html_start_box(__('MacTrack Site Filters'), '100%', '', '3', 'center', 'mactrack_sites.php?action=edit');
    mactrack_site_filter();
    html_end_box();
    $sql_where = '';
    $sites = mactrack_site_get_site_records($sql_where, $row_limit);
    if (get_request_var('detail') == 'false') {
        $total_rows = db_fetch_cell("SELECT\n\t\t\tCOUNT(mac_track_sites.site_id)\n\t\t\tFROM mac_track_sites\n\t\t\t{$sql_where}");
    } else {
        $total_rows = db_fetch_cell("SELECT count(*)\n\t\t\tFROM (mac_track_device_types\n\t\t\tRIGHT JOIN mac_track_devices ON (mac_track_device_types.device_type_id = mac_track_devices.device_type_id))\n\t\t\tRIGHT JOIN mac_track_sites ON (mac_track_devices.site_id = mac_track_sites.site_id)\n\t\t\t{$sql_where}\n\t\t\tGROUP BY mac_track_sites.site_name, mac_track_device_types.device_type_id");
    }
    if (get_request_var('detail') == 'false') {
        $nav = html_nav_bar('mactrack_sites.php?filter=' . get_request_var('filter'), MAX_DISPLAY_PAGES, get_filter_request_var('page'), $row_limit, $total_rows, 9, __('Sites'));
        print $nav;
        html_start_box('', '100%', '', '3', 'center', '');
        $display_text = array('site_name' => array(__('Site Name'), 'ASC'), 'total_devices' => array(__('Devices'), 'DESC'), 'total_ips' => array(__('Total IP\'s'), 'DESC'), 'total_user_ports' => array(__('User Ports'), 'DESC'), 'total_oper_ports' => array(__('User Ports Up'), 'DESC'), 'total_macs' => array(__('MACS Found'), 'DESC'), 'total_device_errors' => array(__('Device Errors'), 'DESC'));
        html_header_sort_checkbox($display_text, get_request_var('sort_column'), get_request_var('sort_direction'));
        $i = 0;
        if (sizeof($sites)) {
            foreach ($sites as $site) {
                form_alternate_row('line' . $site['site_id'], true);
                form_selectable_cell("<a class='linkEditMain' href='mactrack_sites.php?action=edit&site_id=" . $site['site_id'] . "'>" . (get_request_var('filter') != '' ? preg_replace('/(' . preg_quote(get_request_var('filter')) . ')/i', "<span class='filteredValue'>\\1</span>", $site['site_name']) : $site['site_name']) . '</a>', $site['site_id']);
                form_selectable_cell(number_format_i18n($site['total_devices']), $site['site_id']);
                form_selectable_cell(number_format_i18n($site['total_ips']), $site['site_id']);
                form_selectable_cell(number_format_i18n($site['total_user_ports']), $site['site_id']);
                form_selectable_cell(number_format_i18n($site['total_oper_ports']), $site['site_id']);
                form_selectable_cell(number_format_i18n($site['total_macs']), $site['site_id']);
                form_selectable_cell($site['total_device_errors'], $site['site_id']);
                form_checkbox_cell($site['site_name'], $site['site_id']);
                form_end_row();
            }
        } else {
            print '<tr><td><em>' . __('No MacTrack Sites') . '</em></td></tr>';
        }
        html_end_box(false);
        if (sizeof($sites)) {
            print $nav;
        }
    } else {
        $nav = html_nav_bar('mactrack_sites.php?filter=' . get_request_var('filter'), MAX_DISPLAY_PAGES, get_filter_request_var('page'), $row_limit, $total_rows, 10, __('Sites'));
        print $nav;
        html_start_box('', '100%', '', '3', 'center', '');
        $display_text = array('site_name' => array(__('Site Name'), 'ASC'), 'vendor' => array(__('Vendor'), 'ASC'), 'description' => array(__('Device Type'), 'DESC'), 'total_devices' => array(__('Total Devices'), 'DESC'), 'sum_ips_total' => array(__('Total IP\'s'), 'DESC'), 'sum_ports_total' => array(__('Total User Ports'), 'DESC'), 'sum_ports_active' => array(__('Total Oper Ports'), 'DESC'), 'sum_ports_trunk' => array(__('Total Trunks'), 'DESC'), 'sum_macs_active' => array(__('MACS Found'), 'DESC'));
        html_header_sort($display_text, get_request_var('sort_column'), get_request_var('sort_direction'));
        if (sizeof($sites)) {
            foreach ($sites as $site) {
                form_alternate_row();
                ?>
					<td width=200>
						<a class='linkEditMain' href='mactrack_sites.php?action=edit&site_id=<?php 
                print $site['site_id'];
                ?>
'><?php 
                print get_request_var('filter') != '' ? preg_replace('/(' . preg_quote(get_request_var('filter')) . ')/i', "<span class='filteredValue'>\\1</span>", $site['site_name']) : $site['site_name'];
                ?>
</a>
					</td>
					<td><?php 
                print get_request_var('filter') != '' ? preg_replace('/(' . preg_quote(get_request_var('filter')) . ')/i', "<span class='filteredValue'>\\1</span>", $site['vendor']) : $site['vendor'];
                ?>
</td>
					<td><?php 
                print get_request_var('filter') != '' ? preg_replace('/(' . preg_quote(get_request_var('filter')) . ')/i', "<span class='filteredValue'>\\1</span>", $site['description']) : $site['description'];
                ?>
</td>
					<td><?php 
                print number_format_i18n($site['total_devices']);
                ?>
</td>
					<td><?php 
                print number_format_i18n($site['sum_ips_total']);
                ?>
</td>
					<td><?php 
                print number_format_i18n($site['sum_ports_total']);
                ?>
</td>
					<td><?php 
                print number_format_i18n($site['sum_ports_active']);
                ?>
</td>
					<td><?php 
                print number_format_i18n($site['sum_ports_trunk']);
                ?>
</td>
					<td><?php 
                print number_format_i18n($site['sum_macs_active']);
                ?>
</td>
				</tr>
//.........这里部分代码省略.........
开发者ID:Cacti,项目名称:plugin_mactrack,代码行数:101,代码来源:mactrack_sites.php

示例6: update_show_current


//.........这里部分代码省略.........
							<?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>
					<td nowrap style='white-space: nowrap;'>
						&nbsp;<input type="submit" value="Go" title="Set/Refresh Filters">
					</td>
					<td nowrap style='white-space: nowrap;'>
						&nbsp;<input type="submit" name="clear_x" value="Clear" title="Clear Filters">
					</td>
				</tr>
			</table>
			<input type='hidden' name='page' value='1'>
		</form>
		</td>
	</tr>
	<?php 
    html_end_box();
    /* print checkbox form for validation */
    print "<form name='chk' method='post' action='plugins.php'>\n";
    html_start_box("", "100%", "", "3", "center", "");
    /* form the 'where' clause for our main sql query */
    $sql_where = "WHERE ({$table}.name LIKE '%%" . get_request_var_request("filter") . "%%')";
    if (get_request_var_request("sort_column") == "version") {
        $sortc = "version+0";
    } else {
        $sortc = get_request_var_request("sort_column");
    }
    if (get_request_var_request("sort_column") == "id") {
        $sortd = "ASC";
    } else {
        $sortd = get_request_var_request("sort_direction");
    }
    if ($_REQUEST['rows'] == '-1') {
        $rows = read_config_option('num_rows_device');
    } else {
        $rows = get_request_var_request('rows');
    }
    $total_rows = db_fetch_cell("SELECT\n\t\tcount(*)\n\t\tFROM {$table}\n\t\t{$sql_where}");
    $plugins = db_fetch_assoc("SELECT *\n\t\tFROM {$table}\n\t\t{$sql_where}\n\t\tORDER BY " . $sortc . " " . $sortd . "\n\t\tLIMIT " . $rows * (get_request_var_request("page") - 1) . "," . $rows);
    db_execute("DROP TABLE {$table}");
    $nav = html_nav_bar("plugins.php?filter=" . get_request_var_request("filter"), MAX_DISPLAY_PAGES, get_request_var_request("page"), $rows, $total_rows, 8);
    print $nav;
    $display_text = array("nosort" => array("Actions", ""), "directory" => array("Name", "ASC"), "version" => array("Version", "ASC"), "id" => array("Load Order", "ASC"), "name" => array("Description", "ASC"), "nosort1" => array("Type", "ASC"), "status" => array("Status", "ASC"), "author" => array("Author", "ASC"));
    html_header_sort($display_text, get_request_var_request("sort_column"), get_request_var_request("sort_direction"), 1);
    $i = 0;
    if (sizeof($plugins)) {
        if (get_request_var_request("sort_column") == "id") {
            $inst_system_plugins = get_system_plugins($plugins);
            if (sizeof($inst_system_plugins)) {
                foreach ($inst_system_plugins as $plugin) {
                    form_alternate_row('', true);
                    print format_plugin_row($plugin, false, false, true);
                }
            }
        }
        $j = 0;
        foreach ($plugins as $plugin) {
            if (isset($plugins[$j + 1]) && $plugins[$j + 1]['status'] < 0 || !isset($plugins[$j + 1])) {
                $last_plugin = true;
            } else {
                $last_plugin = false;
            }
            if ($plugin['status'] <= 0 || is_system_plugin($plugin) || get_request_var_request('sort_column') != 'id') {
                $load_ordering = false;
            } else {
                $load_ordering = true;
            }
            if (get_request_var_request("sort_column") == "id") {
                if (!is_system_plugin($plugin)) {
                    form_alternate_row('', true);
                    print format_plugin_row($plugin, $last_plugin, $load_ordering, false);
                    $i++;
                }
            } else {
                form_alternate_row('', true);
                print format_plugin_row($plugin, $last_plugin, $load_ordering, is_system_plugin($plugin));
                $i++;
            }
            $j++;
        }
        print $nav;
    } else {
        print "<tr><td><em>No Plugins Found</em></td></tr>";
    }
    html_end_box(false);
    html_start_box("", "100%", "", "3", "center", "");
    echo "<tr><td colspan=10><strong>NOTE:</strong> Please sort by 'Load Order' to change plugin load ordering.<br><strong>NOTE:</strong> SYSTEM plugins can not be ordered.</td></tr>";
    html_end_box();
    print "</form>\n";
}
开发者ID:teddywen,项目名称:cacti,代码行数:101,代码来源:plugins.php

示例7: basename

	}else{
		$nav_url = basename($_SERVER["PHP_SELF"]) . "?" . $_SERVER["QUERY_STRING"] . "&page=<PAGE>&host_id=" . $_REQUEST["host_id"];
	}

	$nav_url = ereg_replace("((\?|&)host_id=[0-9]+|(\?|&)filter=[a-zA-Z0-9]*)", "", $nav_url);

	html_graph_start_box(1, true);
	html_nav_bar($colors["header_panel"], read_graph_config_option("num_columns"), $_REQUEST["page"], ROWS_PER_PAGE, $total_rows, $nav_url);

	if (read_graph_config_option("thumbnail_section_preview") == "on") {
		html_graph_thumbnail_area($graphs, "","graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end());
	}else{
		html_graph_area($graphs, "", "graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end());
	}

	html_nav_bar($colors["header_panel"], read_graph_config_option("num_columns"), $_REQUEST["page"], ROWS_PER_PAGE, $total_rows, $nav_url);

	html_graph_end_box();

	print "<br><br>";

	break;



case 'list':
	define("ROWS_PER_PAGE", read_graph_config_option("list_graphs_per_page"));

	if ((read_config_option("auth_method") != 0) && (empty($current_user["show_list"]))) {
		print "<strong><font size='+1' color='FF0000'>YOU DO NOT HAVE RIGHTS FOR LIST VIEW</font></strong>"; exit;
	}
开发者ID:songchin,项目名称:Cacti,代码行数:31,代码来源:graph_view.php

示例8: data_query


//.........这里部分代码省略.........
            if (get_request_var_request('rows') == $key) {
                print ' selected';
            }
            print '>' . htmlspecialchars($value) . "</option>\n";
        }
    }
    ?>
						</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>
		<script type='text/javascript'>
		function applyFilter() {
			strURL = 'data_queries.php?filter='+$('#filter').val()+'&rows='+$('#rows').val()+'&page='+$('#page').val()+'&header=false';
			$.get(strURL, function(data) {
				$('#main').html(data);
				applySkin();
			});
		}

		function clearFilter() {
			strURL = 'data_queries.php?clear_x=1&header=false';
			$.get(strURL, function(data) {
				$('#main').html(data);
				applySkin();
			});
		}

		$(function() {
			$('#refresh').click(function() {
				applyFilter();
			});

			$('#clear').click(function() {
				clearFilter();
			});
	
			$('#form_data_queries').submit(function(event) {
				event.preventDefault();
				applyFilter();
			});
		});
		</script>
		</td>
	</tr>
	<?php 
    html_end_box();
    /* print checkbox form for validation */
    print "<form name='chk' method='post' action='data_queries.php'>\n";
    html_start_box('', '100%', '', '3', 'center', '');
    /* form the 'where' clause for our main sql query */
    if (strlen(get_request_var_request('filter'))) {
        $sql_where = "WHERE (sq.name like '%%" . get_request_var_request('filter') . "%%' OR di.name like '%%" . get_request_var_request('filter') . "%%')";
    } else {
        $sql_where = '';
    }
    $total_rows = db_fetch_cell("SELECT\n\t\tCOUNT(*)\n\t\tFROM snmp_query AS sq\n\t\tINNER JOIN data_input AS di\n\t\tON (sq.data_input_id=di.id)\n\t\t{$sql_where}");
    $snmp_queries = db_fetch_assoc("SELECT sq.id, sq.name,\n\t\tdi.name AS data_input_method, \n\t\tCOUNT(DISTINCT gl.id) AS graphs,\n\t\tCOUNT(DISTINCT sqg.graph_template_id) AS templates\n\t\tFROM snmp_query AS sq\n\t\tLEFT JOIN snmp_query_graph AS sqg\n\t\tON sq.id=sqg.snmp_query_id\n\t\tLEFT JOIN data_input AS di\n\t\tON (sq.data_input_id=di.id)\n\t\tLEFT JOIN graph_local AS gl\n\t\tON gl.snmp_query_id=sq.id\n\t\t{$sql_where}\n\t\tGROUP BY sq.id\n\t\tORDER BY " . get_request_var_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('data_queries.php?filter=' . get_request_var_request('filter'), MAX_DISPLAY_PAGES, get_request_var_request('page'), get_request_var_request('rows'), $total_rows, 7, 'Data Queries', 'page', 'main');
    print $nav;
    $display_text = array('name' => array('display' => 'Data Query Name', 'align' => 'left', 'sort' => 'ASC', 'tip' => 'The name of this Data Query.'), 'nosort' => array('display' => 'Deletable', 'align' => 'right', 'tip' => 'Data Queries that are in use can not be Deleted.  In use is defined as being referenced by either a Graph or a Graph Template.'), 'graphs' => array('display' => 'Graphs Using', 'align' => 'right', 'sort' => 'DESC', 'tip' => 'The number of Graphs using this Data Query.'), 'templates' => array('display' => 'Templates Using', 'align' => 'right', 'sort' => 'DESC', 'tip' => 'The number of Graphs Templates using this Data Query.'), 'data_input_method' => array('display' => 'Data Input Method', 'align' => 'left', 'sort' => 'ASC', 'tip' => 'The Data Input Method used to collect data for Data Sources associated with this Data Query.'), 'id' => array('display' => 'ID', 'align' => 'right', 'sort' => 'ASC', 'tip' => 'The internal ID for this Graph Template.  Useful when performing automation or debugging.'));
    html_header_sort_checkbox($display_text, get_request_var_request('sort_column'), get_request_var_request('sort_direction'), false);
    $i = 0;
    if (sizeof($snmp_queries) > 0) {
        foreach ($snmp_queries as $snmp_query) {
            if ($snmp_query['graphs'] == 0 && $snmp_query['templates'] == 0) {
                $disabled = false;
            } else {
                $disabled = true;
            }
            form_alternate_row('line' . $snmp_query['id'], true, $disabled);
            form_selectable_cell("<a class='linkEditMain' href='" . htmlspecialchars('data_queries.php?action=edit&id=' . $snmp_query['id']) . "'>" . (strlen(get_request_var_request('filter')) ? preg_replace('/(' . preg_quote(get_request_var_request('filter'), '/') . ')/i', "<span class='filteredValue'>\\1</span>", htmlspecialchars($snmp_query['name'])) : htmlspecialchars($snmp_query['name'])) . '</a>', $snmp_query['id']);
            form_selectable_cell($disabled ? 'No' : 'Yes', $snmp_query['id'], '', 'text-align:right');
            form_selectable_cell(number_format($snmp_query['graphs']), $snmp_query['id'], '', 'text-align:right');
            form_selectable_cell(number_format($snmp_query['templates']), $snmp_query['id'], '', 'text-align:right');
            form_selectable_cell(strlen(get_request_var_request('filter')) ? preg_replace('/(' . preg_quote(get_request_var_request('filter'), '/') . ')/i', "<span class='filteredValue'>\\1</span>", $snmp_query['data_input_method']) : $snmp_query['data_input_method'], $snmp_query['id']);
            form_selectable_cell($snmp_query['id'], $snmp_query['id'], '', 'text-align:right;');
            form_checkbox_cell($snmp_query['name'], $snmp_query['id'], $disabled);
            form_end_row();
        }
        print $nav;
    } else {
        print "<tr class='tableRow'><td colspan='5'><em>No Data Queries</em></td></tr>";
    }
    html_end_box(false);
    /* draw the dropdown containing a list of available actions for this form */
    draw_actions_dropdown($dq_actions);
}
开发者ID:MrWnn,项目名称:cacti,代码行数:101,代码来源:data_queries.php

示例9: domains


//.........这里部分代码省略.........
            print "<option value='" . $key . "'";
            if (get_request_var_request('rows') == $key) {
                print ' selected';
            }
            print '>' . htmlspecialchars($value) . "</option>\n";
        }
    }
    ?>
						</select>
					</td>
					<td>
						<input id='refresh' type='button' value='Go' title='Set/Refresh Filters'>
					</td>
					<td>
						<input id='clear' type='button' name='clear_x' value='Clear' title='Clear Filters'>
					</td>
				</tr>
			</table>
			<input type='hidden' name='page' value='<?php 
    print $_REQUEST['page'];
    ?>
'>
		</form>
		<script type='text/javascript'>
		function applyFilter() {
			strURL = 'user_domains.php?rows=' + $('#rows').val();
			strURL = strURL + '&filter=' + $('#filter').val();
			strURL = strURL + '&page=' + $('#page').val();
			strURL = strURL + '&header=false';
			$.get(strURL, function(data) {
				$('#main').html(data);
				applySkin();
			});
		}

		function clearFilter() {
			strURL = 'user_domains.php?clear_x=1&header=false';
			$.get(strURL, function(data) {
				$('#main').html(data);
				applySkin();
			});
		}

		$(function(data) {
			$('#refresh').click(function() {
				applyFilter();
			});

			$('#clear').click(function() {
				clearFilter();
			});

			$('#form_domains').submit(function(event) {
				event.preventDefault();
				applyFilter();
			});
		});
		</script>
		</td>
	</tr>
	<?php 
    html_end_box();
    /* print checkbox form for validation */
    print "<form name='chk' method='post' action='user_domains.php'>\n";
    html_start_box('', '100%', '', '3', 'center', '');
    /* form the 'where' clause for our main sql query */
    if ($_REQUEST['filter'] != '') {
        $sql_where = "WHERE (domain_name LIKE '%%" . get_request_var_request('filter') . "%%') ||\n\t\t\t(type LIKE '%%" . get_request_var_request('filter') . "%%')";
    } else {
        $sql_where = '';
    }
    $total_rows = db_fetch_cell("SELECT\n\t\tcount(*)\n\t\tFROM user_domains\n\t\t{$sql_where}");
    $domains = db_fetch_assoc("SELECT *\n\t\tFROM user_domains\n\t\t{$sql_where}\n\t\tORDER BY " . get_request_var_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('user_user_domains.php?filter=' . get_request_var_request('filter'), MAX_DISPLAY_PAGES, get_request_var_request('page'), get_request_var_request('rows'), $total_rows, 6, 'User Domains', 'page', 'main');
    print $nav;
    $display_text = array('domain_name' => array('Domain Name', 'ASC'), 'type' => array('Domain Type', 'ASC'), 'defdomain' => array('Default', 'ASC'), 'user_id' => array('Effective User', 'ASC'), 'enabled' => array('Enabled', 'ASC'));
    html_header_sort_checkbox($display_text, get_request_var_request('sort_column'), get_request_var_request('sort_direction'), false);
    $i = 0;
    if (sizeof($domains) > 0) {
        foreach ($domains as $domain) {
            /* hide system types */
            form_alternate_row('line' . $domain['domain_id'], true);
            form_selectable_cell("<a class='linkEditMain' href='" . htmlspecialchars('user_domains.php?action=edit&domain_id=' . $domain['domain_id']) . "'>" . (strlen(get_request_var_request('filter')) ? eregi_replace('(' . preg_quote(get_request_var_request('filter')) . ')', "<span class='filteredValue>\\1</span>", $domain['domain_name']) : $domain['domain_name']) . '</a>', $domain['domain_id']);
            form_selectable_cell($domain_types[$domain['type']], $domain['domain_id']);
            form_selectable_cell($domain['defdomain'] == '0' ? '--' : 'Yes', $domain['domain_id']);
            form_selectable_cell($domain['user_id'] == '0' ? 'None Selected' : db_fetch_cell_prepared('SELECT username FROM user_auth WHERE id = ?', array($domain['user_id'])), $domain['domain_id']);
            form_selectable_cell($domain['enabled'] == 'on' ? 'Yes' : 'No', $domain['domain_id']);
            form_checkbox_cell($domain['domain_name'], $domain['domain_id']);
            form_end_row();
        }
        print $nav;
    } else {
        print '<tr><td><em>No User Domains Defined</em></td></tr>';
    }
    html_end_box(false);
    /* draw the dropdown containing a list of available actions for this form */
    draw_actions_dropdown($actions);
    print "</form>\n";
}
开发者ID:MrWnn,项目名称:cacti,代码行数:101,代码来源:user_domains.php

示例10: grow_right_pane_tree


//.........这里部分代码省略.........
        $sql_where = '';
        if (strlen(get_request_var_request('filter'))) {
            $sql_where = " (gtg.title_cache LIKE '%" . get_request_var_request('filter') . "%' OR gtg.title LIKE '%" . get_request_var_request('filter') . "%')";
        }
        $graph_list = get_allowed_tree_header_graphs($tree_id, $leaf_id, $sql_where);
    } elseif ($leaf_type == 'host') {
        /* graph template grouping */
        if ($leaf['host_grouping_type'] == HOST_GROUPING_GRAPH_TEMPLATE) {
            $sql_where = 'gl.host_id=' . $leaf['host_id'] . (empty($graph_template_id) ? '' : ' AND gt.id=' . $graph_template_id);
            $graph_templates = get_allowed_graph_templates($sql_where);
            /* for graphs without a template */
            array_push($graph_templates, array('id' => '0', 'name' => '(No Graph Template)'));
            if (sizeof($graph_templates) > 0) {
                foreach ($graph_templates as $graph_template) {
                    $sql_where = '';
                    if (strlen(get_request_var_request('filter'))) {
                        $sql_where = " (gtg.title_cache LIKE '%" . get_request_var_request('filter') . "%')";
                    }
                    $sql_where .= (strlen($sql_where) ? 'AND' : '') . ' gl.graph_template_id=' . $graph_template['id'] . ' AND gl.host_id=' . $leaf['host_id'];
                    $graphs = get_allowed_graphs($sql_where);
                    /* let's sort the graphs naturally */
                    usort($graphs, 'naturally_sort_graphs');
                    if (sizeof($graphs)) {
                        foreach ($graphs as $graph) {
                            $graph['graph_template_name'] = $graph_template['name'];
                            array_push($graph_list, $graph);
                        }
                    }
                }
            }
            /* data query index grouping */
        } elseif ($leaf['host_grouping_type'] == HOST_GROUPING_DATA_QUERY_INDEX) {
            $data_queries = db_fetch_assoc("SELECT sq.id, sq.name\n\t\t\t\tFROM graph_local AS gl\n\t\t\t\tINNER JOIN snmp_query AS sq\n\t\t\t\tON gl.snmp_query_id=sq.id\n\t\t\t\tWHERE gl.host_id=" . $leaf['host_id'] . "\n\t\t\t\t" . (!isset($data_query_id) ? '' : "AND sq.id={$data_query_id}") . "\n\t\t\t\tGROUP BY sq.id\n\t\t\t\tORDER BY sq.name");
            /* for graphs without a data query */
            if (empty($data_query_id)) {
                array_push($data_queries, array('id' => '0', 'name' => 'Non Query Based'));
            }
            if (sizeof($data_queries) > 0) {
                foreach ($data_queries as $data_query) {
                    $sql_where = '';
                    /* fetch a list of field names that are sorted by the preferred sort field */
                    $sort_field_data = get_formatted_data_query_indexes($leaf['host_id'], $data_query['id']);
                    if (strlen(get_request_var_request('filter'))) {
                        $sql_where = " (gtg.title_cache LIKE '%" . get_request_var_request('filter') . "%')";
                    }
                    /* grab a list of all graphs for this host/data query combination */
                    $sql_where .= (strlen($sql_where) ? ' AND ' : '') . ' gl.snmp_query_id=' . $data_query['id'] . ' AND gl.host_id=' . $leaf['host_id'] . "\n                                        " . (empty($data_query_index) ? '' : " AND gl.snmp_index='{$data_query_index}'");
                    $graphs = get_allowed_graphs($sql_where);
                    /* re-key the results on data query index */
                    $snmp_index_to_graph = array();
                    if (sizeof($graphs) > 0) {
                        /* let's sort the graphs naturally */
                        usort($graphs, 'naturally_sort_graphs');
                        foreach ($graphs as $graph) {
                            $snmp_index_to_graph[$graph['snmp_index']][$graph['local_graph_id']] = $graph['title_cache'];
                            $graphs_height[$graph['local_graph_id']] = $graph['height'];
                            $graphs_width[$graph['local_graph_id']] = $graph['width'];
                        }
                    }
                    /* using the sorted data as they key; grab each snmp index from the master list */
                    while (list($snmp_index, $sort_field_value) = each($sort_field_data)) {
                        /* render each graph for the current data query index */
                        if (isset($snmp_index_to_graph[$snmp_index])) {
                            while (list($local_graph_id, $graph_title) = each($snmp_index_to_graph[$snmp_index])) {
                                /* reformat the array so it's compatable with the html_graph* area functions */
                                array_push($graph_list, array('data_query_name' => $data_query['name'], 'sort_field_value' => $sort_field_value, 'local_graph_id' => $local_graph_id, 'title_cache' => $graph_title, 'height' => $graphs_height[$graph['local_graph_id']], 'width' => $graphs_width[$graph['local_graph_id']]));
                            }
                        }
                    }
                }
            }
        }
    }
    $total_rows = sizeof($graph_list);
    /* generate page list */
    $nav = html_nav_bar("graph_view.php?action=tree_content&tree_id={$tree_id}&leaf_id={$leaf_id}&nodeid=" . get_request_var_request('nodeid') . '&host_group_data=' . get_request_var_request('host_group_data'), MAX_DISPLAY_PAGES, get_request_var_request('page'), get_request_var_request('graphs'), $total_rows, 5, 'Graphs', 'page', 'main');
    print $nav;
    /* start graph display */
    print "<tr class='tableHeader'><td width='390' colspan='11' class='graphSubHeaderColumn textHeaderDark'>{$title}</td></tr>";
    $i = get_request_var_request('graphs') * (get_request_var_request('page') - 1);
    $last_graph = $i + get_request_var_request('graphs');
    $new_graph_list = array();
    while ($i < $total_rows && $i < $last_graph) {
        $new_graph_list[] = $graph_list[$i];
        $i++;
    }
    if ($_REQUEST['thumbnails'] == 'true') {
        html_graph_thumbnail_area($new_graph_list, '', 'view_type=tree&graph_start=' . get_current_graph_start() . '&graph_end=' . get_current_graph_end(), '', get_request_var_request('columns'));
    } else {
        html_graph_area($new_graph_list, '', 'view_type=tree&graph_start=' . get_current_graph_start() . '&graph_end=' . get_current_graph_end(), '', 1);
    }
    if (!empty($leaf_id)) {
        api_plugin_hook_function('tree_after', $host_name . ',' . get_request_var_request('leaf_id'));
    }
    api_plugin_hook_function('tree_view_page_end');
    if ($total_rows > 0) {
        print $nav;
    }
    html_end_box();
}
开发者ID:MrWnn,项目名称:cacti,代码行数:101,代码来源:html_tree.php

示例11: thold_show_log

function thold_show_log()
{
    global $config, $item_rows, $thold_log_states, $thold_status, $thold_types, $thold_log_retention;
    $step = read_config_option('poller_interval');
    /* ================= input validation and session storage ================= */
    $filters = array('rows' => array('filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1'), 'page' => array('filter' => FILTER_VALIDATE_INT, 'default' => '1'), 'filter' => array('filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '', 'options' => array('options' => 'sanitize_search_string')), 'sort_column' => array('filter' => FILTER_CALLBACK, 'default' => 'time', 'options' => array('options' => 'sanitize_search_string')), 'sort_direction' => array('filter' => FILTER_CALLBACK, 'default' => 'DESC', 'options' => array('options' => 'sanitize_search_string')), 'threshold_id' => array('filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1'), 'host_id' => array('filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1'), 'status' => array('filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1'));
    validate_store_request_vars($filters, 'sess_thold_log');
    /* ================= input validation ================= */
    /* if the number of rows is -1, set it to the default */
    if (get_request_var('rows') == -1) {
        $rows = read_config_option('num_rows_table');
    } else {
        $rows = get_request_var('rows');
    }
    $days = read_config_option('thold_log_storage');
    if (isset($thold_log_retention[$days])) {
        $days = $thold_log_retention[$days];
    } else {
        $days = __('%d Days', $days);
    }
    html_start_box(__('Threshold Log for [ %s ]', $days), '100%', '', '3', 'center', '');
    form_thold_log_filter();
    html_end_box();
    $sql_where = '';
    if (get_request_var('host_id') == '-1') {
        /* Show all items */
    } elseif (get_request_var('host_id') == '0') {
        $sql_where .= (strlen($sql_where) ? ' AND' : '') . ' h.id IS NULL';
    } elseif (!isempty_request_var('host_id')) {
        $sql_where .= (strlen($sql_where) ? ' AND' : '') . ' tl.host_id=' . get_request_var('host_id');
    }
    if (get_request_var('threshold_id') == '-1') {
        /* Show all items */
    } elseif (get_request_var('threshold_id') == '0') {
        $sql_where .= (strlen($sql_where) ? ' AND' : '') . ' td.id IS NULL';
    } elseif (!isempty_request_var('threshold_id')) {
        $sql_where .= (strlen($sql_where) ? ' AND' : '') . ' tl.threshold_id=' . get_request_var('threshold_id');
    }
    if (get_request_var('status') == '-1') {
        /* Show all items */
    } else {
        $sql_where .= (strlen($sql_where) ? ' AND' : '') . ' tl.status=' . get_request_var('status');
    }
    if (strlen(get_request_var('filter'))) {
        $sql_where .= (strlen($sql_where) ? ' AND' : '') . " tl.description LIKE '%" . get_request_var('filter') . "%'";
    }
    $sortby = get_request_var('sort_column') . ' ' . get_request_var('sort_direction');
    $limit = $rows * (get_request_var('page') - 1) . ',' . $rows;
    $logs = get_allowed_threshold_logs($sql_where, $sortby, $limit, $total_rows);
    $nav = html_nav_bar('thold_graph.php?action=log', MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 8, __('Log Entries'), 'page', 'main');
    print $nav;
    html_start_box('', '100%', '', '3', 'center', '');
    $display_text = array('hdescription' => array('display' => __('Device'), 'sort' => 'ASC', 'align' => 'left'), 'time' => array('display' => __('Time'), 'sort' => 'ASC', 'align' => 'left'), 'type' => array('display' => __('Type'), 'sort' => 'DESC', 'align' => 'left'), 'description' => array('display' => __('Event Description'), 'sort' => 'ASC', 'align' => 'left'), 'threshold_value' => array('display' => __('Alert Value'), 'sort' => 'ASC', 'align' => 'right'), 'current' => array('display' => __('Measured Value'), 'sort' => 'ASC', 'align' => 'right'));
    html_header_sort($display_text, get_request_var('sort_column'), get_request_var('sort_direction'), false, 'thold_graph.php?action=log');
    $i = 0;
    if (sizeof($logs)) {
        foreach ($logs as $l) {
            ?>
			<tr class='<?php 
            print $thold_log_states[$l['status']]['class'];
            ?>
'>
			<td class='left nowrap'><?php 
            print $l['hdescription'];
            ?>
</td>
			<td class='left nowrap'><?php 
            print date('Y-m-d H:i:s', $l['time']);
            ?>
</td>
			<td class='left nowrap'><?php 
            print $thold_types[$l['type']];
            ?>
</td>
			<td class='left nowrap'><?php 
            print strlen($l['description']) ? $l['description'] : __('Restoral Event');
            ?>
</td>
			<td class='right'><?php 
            print $l['threshold_value'] != '' ? thold_format_number($l['threshold_value']) : __('N/A');
            ?>
</td>
			<td class='right'><?php 
            print $l['current'] != '' ? thold_format_number($l['current']) : __('N/A');
            ?>
</td>
			<?php 
            form_end_row();
        }
    } else {
        print '<tr><td class="center" colspan="8">' . __('No Threshold Logs Found') . '</td></tr>';
    }
    html_end_box(false);
    if (sizeof($logs)) {
        print $nav;
    }
    log_legend();
}
开发者ID:Cacti,项目名称:plugin_thold,代码行数:98,代码来源:thold_graph.php

示例12: lists


//.........这里部分代码省略.........
</option>
							<?php 
    if (sizeof($item_rows) > 0) {
        foreach ($item_rows as $key => $value) {
            print "<option value='" . $key . "'";
            if (get_request_var('rows') == $key) {
                print ' selected';
            }
            print '>' . htmlspecialchars($value) . "</option>\n";
        }
    }
    ?>
						</select>
					</td>
					<td>
						<input type='button' value='<?php 
    print __('Go');
    ?>
' title='<?php 
    print __('Set/Refresh Filters');
    ?>
' onClick='applyFilter()'>
					</td>
					<td>
						<input type='button' name='clear' value='<?php 
    print __('Clear');
    ?>
' title='<?php 
    print __('Clear Filters');
    ?>
' onClick='clearFilter()'>
					</td>
				</tr>
			</table>
			<input type='hidden' id='page' value='<?php 
    print get_filter_request_var('page');
    ?>
'>
		</form>
		<script type='text/javascript'>

		function applyFilter() {
			strURL  = 'notify_lists.php?header=false';
			strURL += '&rows=' + $('#rows').val();
			strURL += '&filter=' + $('#filter').val();
			loadPageNoHeader(strURL);
		}

		function clearFilter() {
			strURL = 'notify_lists.php?header=false&clear=1';
			loadPageNoHeader(strURL);
		}

		$(function() {
			$('#lists').submit(function(event) {
				event.preventDefault();
				applyFilter();
			});
		});
	
		</script>
		</td>
	</tr>
	<?php 
    html_end_box();
    /* form the 'where' clause for our main sql query */
    if (strlen(get_request_var('filter'))) {
        $sql_where = "WHERE (name LIKE '%" . get_request_var('filter') . "%' OR\n\t\tdescription LIKE '%" . get_request_var('filter') . "%' OR\n\t\temails LIKE '%" . get_request_var('filter') . "%')";
    } else {
        $sql_where = '';
    }
    $total_rows = db_fetch_cell("SELECT\n\t\tCOUNT(*)\n\t\tFROM plugin_notification_lists\n\t\t{$sql_where}");
    $lists = db_fetch_assoc("SELECT id, name, description, emails\n\t\tFROM plugin_notification_lists\n\t\t{$sql_where}\n\t\tORDER BY " . get_request_var('sort_column') . ' ' . get_request_var('sort_direction') . ' LIMIT ' . $rows * (get_request_var('page') - 1) . ',' . $rows);
    $nav = html_nav_bar('notify_lists.php?filter=' . get_request_var('filter'), MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 10, __('Lists'), 'page', 'main');
    form_start('notify_lists.php', 'chk');
    print $nav;
    html_start_box('', '100%', '', '3', 'center', '');
    $display_text = array('name' => array(__('List Name'), 'ASC'), 'description' => array(__('Description'), 'ASC'), 'emails' => array(__('Emails'), 'ASC'));
    html_header_sort_checkbox($display_text, get_request_var('sort_column'), get_request_var('sort_direction'), false);
    if (sizeof($lists)) {
        foreach ($lists as $item) {
            form_alternate_row('line' . $item['id'], true);
            form_selectable_cell(filter_value($item['name'], get_request_var('filter'), 'notify_lists.php?action=edit&id=' . $item['id']), $item['id'], '25%');
            form_selectable_cell(filter_value($item['description'], get_request_var('filter')), $item['id'], '35%');
            form_selectable_cell(filter_value($item['emails'], get_request_var('filter')), $item['id']);
            form_checkbox_cell($item['name'], $item['id']);
            form_end_row();
        }
    } else {
        print '<tr><td><em>' . __('No Notification Lists') . '</em></td></tr>';
    }
    html_end_box(false);
    if (sizeof($lists)) {
        print $nav;
    }
    form_hidden_box('save_list', '1', '');
    /* draw the dropdown containing a list of available actions for this form */
    draw_actions_dropdown($actions);
    form_end();
}
开发者ID:Cacti,项目名称:plugin_thold,代码行数:101,代码来源:notify_lists.php

示例13: mikrotik_user


//.........这里部分代码省略.........
><?php 
    print __('All');
    ?>
</option>
							<option value='1'<?php 
    if (get_request_var('status') == '1') {
        ?>
 selected<?php 
    }
    ?>
><?php 
    print __('Active');
    ?>
</option>
							<option value='2'<?php 
    if (get_request_var('status') == '2') {
        ?>
 selected<?php 
    }
    ?>
><?php 
    print __('Inactive');
    ?>
</option>
						</select>
					<td>
						<input type='button' value='<?php 
    print __('Go');
    ?>
' title='<?php 
    print __('Set/Refresh Filters');
    ?>
' onClick='applyFilter()'>
					</td>
					<td>
						<input type='button' name='clear_x' value='<?php 
    print __('Clear');
    ?>
' title='<?php 
    print __('Clear Filters');
    ?>
' onClick='clearFilter()'>
					</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('filter'))) {
        $sql_where = "WHERE (name LIKE '%%" . get_request_var('filter') . "%%') AND name!=''";
    } else {
        $sql_where = "WHERE name!=''";
    }
    if (get_request_var('status') == 1) {
        $sql_where .= ' AND present=1';
    } elseif (get_request_var('status') == 2) {
        $sql_where .= ' AND present=0';
    }
    if (get_request_var('type') == '0') {
        $sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . ' userType=0';
    } elseif (get_request_var('type') == '1') {
        $sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . ' userType=1';
    }
    $total_rows = db_fetch_cell("SELECT \n\t\tCOUNT(DISTINCT name)\n\t\tFROM plugin_mikrotik_users\n\t\t{$sql_where}");
    $sortby = get_request_var('sort_column');
    $sql_query = "SELECT name, domain, userType, MAX(last_seen) AS last_seen, MAX(present) AS present\n\t\tFROM plugin_mikrotik_users\n\t\t{$sql_where}\n\t\tGROUP BY name, domain\n\t\tORDER BY " . $sortby . ' ' . get_request_var('sort_direction') . '
		LIMIT ' . $rows * (get_request_var('page') - 1) . ',' . $rows;
    $users = db_fetch_assoc($sql_query);
    $nav = html_nav_bar('mikrotik_users.php?filter=' . get_request_var('filter'), MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 6, __('Users'), 'page', 'main');
    form_start('mikrotik_users.php', 'chk');
    print $nav;
    html_start_box('', '100%', '', '3', 'center', '');
    $display_text = array('name' => array(__('User Name'), 'ASC'), 'domain' => array(__('Domain'), 'ASC'), 'type' => array(__('Type'), 'ASC'), 'last_seen' => array(__('Last Seen'), 'DESC'), 'present' => array(__('Active'), 'ASC'));
    html_header_sort_checkbox($display_text, get_request_var('sort_column'), get_request_var('sort_direction'), false);
    if (sizeof($users)) {
        foreach ($users as $user) {
            form_alternate_row('line' . $user['name'], true);
            form_selectable_cell("<span class='noLinkEditMain'>" . filter_value($user['name'], get_request_var('filter')) . '</span>', $user['name'], 250);
            form_selectable_cell($user['domain'] != '' ? $user['domain'] : 'Not Set', $user['name']);
            form_selectable_cell($user['userType'] == '0' ? 'Hotspot' : 'PPPoe', $user['name']);
            form_selectable_cell($user['last_seen'], $user['name']);
            form_selectable_cell($user['present'] == 0 ? '<b><i>' . __('Inactive') . '</i></b>' : '<b><i>' . __('Active') . '</i></b>', $user['name']);
            form_checkbox_cell($user['name'], $user['name']);
            form_end_row();
        }
    } else {
        print '<tr><td><em>' . __('No Users Found') . '</em></td></tr>';
    }
    html_end_box(false);
    if (sizeof($users)) {
        print $nav;
    }
    /* draw the dropdown containing a list of available actions for this form */
    draw_actions_dropdown($user_actions);
    form_end();
}
开发者ID:Cacti,项目名称:plugin_mikrotik,代码行数:101,代码来源:mikrotik_users.php

示例14: list_tholds


//.........这里部分代码省略.........
			<input type='hidden' name='search' value='search'>
			<input type='hidden' id='page' value='<?php 
    print get_filter_request_var('page');
    ?>
'>
		</form>
		<script type='text/javascript'>

		function applyFilter() {
			strURL  = 'thold.php?header=false&host_id=' + $('#host_id').val();
			strURL += '&state=' + $('#state').val();
			strURL += '&data_template_id=' + $('#data_template_id').val();
			strURL += '&filter=' + $('#filter').val();
			loadPageNoHeader(strURL);
		}

		function clearFilter() {
			strURL  = 'thold.php?header=false&clear=1';
			loadPageNoHeader(strURL);
		}

		$(function() {
			$('#listthold').submit(function(event) {
				event.preventDefault();
				applyFilter();
			});
		});
	
		</script>
		</td>
	</tr>
	<?php 
    html_end_box();
    $nav = html_nav_bar('thold.php?filter=' . get_request_var('filter'), MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 14, __('Thresholds'), 'page', 'main');
    form_start('thold.php', 'chk');
    print $nav;
    html_start_box('', '100%', '', '4', 'center', '');
    $display_text = array('name' => array('display' => __('Name'), 'sort' => 'ASC', 'align' => 'left'), 'id' => array('display' => __('ID'), 'sort' => 'ASC', 'align' => 'right'), 'thold_type' => array('display' => __('Type'), 'sort' => 'ASC', 'align' => 'right'), 'data_source' => array('display' => __('DSName'), 'sort' => 'ASC', 'align' => 'right'), 'lastread' => array('display' => __('Current'), 'sort' => 'ASC', 'align' => 'right', 'tip' => __('The last measured value for the Data Source')), 'thold_hi' => array('display' => __('High'), 'sort' => 'ASC', 'align' => 'right', 'tip' => __('High Threshold values for Warning/Alert')), 'thold_low' => array('display' => __('Low'), 'sort' => 'ASC', 'align' => 'right', 'tip' => __('Low Threshold values for Warning/Alert')), 'nosort3' => array('display' => __('Trigger'), 'sort' => '', 'align' => 'right'), 'nosort4' => array('display' => __('Duration'), 'sort' => '', 'align' => 'right'), 'repeat_alert' => array('display' => __('Repeat'), 'sort' => 'ASC', 'align' => 'right'), 'thold_alert' => array('display' => __('Triggered'), 'sort' => 'ASC', 'align' => 'right'), 'template_enabled' => array('display' => __('Templated'), 'sort' => 'ASC', 'align' => 'right'));
    html_header_sort_checkbox($display_text, get_request_var('sort_column'), get_request_var('sort_direction'), false);
    $c = 0;
    $i = 0;
    if (sizeof($tholds)) {
        foreach ($tholds as $thold_data) {
            $c++;
            $grapharr = db_fetch_row('SELECT DISTINCT graph_templates_item.local_graph_id
				FROM graph_templates_item, data_template_rrd
				WHERE (data_template_rrd.local_data_id=' . $thold_data['local_data_id'] . ' 
				AND data_template_rrd.id=graph_templates_item.task_item_id)');
            $local_graph_id = $grapharr['local_graph_id'];
            $alertstat = __('No');
            $bgcolor = 'green';
            if ($thold_data['thold_type'] == 0) {
                if ($thold_data['thold_alert'] != 0) {
                    $alertstat = __('Yes');
                    if ($thold_data['thold_fail_count'] >= $thold_data['thold_fail_trigger']) {
                        $bgcolor = 'red';
                    } elseif ($thold_data['thold_warning_fail_count'] >= $thold_data['thold_warning_fail_trigger']) {
                        $bgcolor = 'warning';
                    } else {
                        $bgcolor = 'yellow';
                    }
                }
            } elseif ($thold_data['thold_type'] == 2) {
                if ($thold_data['thold_alert'] != 0) {
                    $alertstat = __('Yes');
                    if ($thold_data['thold_fail_count'] >= $thold_data['time_fail_trigger']) {
开发者ID:Cacti,项目名称:plugin_thold,代码行数:67,代码来源:thold.php

示例15: data


//.........这里部分代码省略.........
            }
            print '>' . htmlspecialchars($value) . "</option>\n";
        }
    }
    ?>
						</select>
					</td>
					<td>
						<input type="submit" 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>
		<script type='text/javascript'>
		function applyFilter() {
			strURL = 'data_input.php?filter='+$('#filter').val()+'&rows='+$('#rows').val()+'&page='+$('#page').val()+'&header=false';
			$.get(strURL, function(data) {
				$('#main').html(data);
				applySkin();
			});
		}

		function clearFilter() {
			strURL = 'data_input.php?clear_x=1&header=false';
			$.get(strURL, function(data) {
				$('#main').html(data);
				applySkin();
			});
		}

		$(function() {
			$('#refresh').click(function() {
				applyFilter();
			});

			$('#clear').click(function() {
				clearFilter();
			});
	
			$('#form_data_input').submit(function(event) {
				event.preventDefault();
				applyFilter();
			});
		});
		</script>
		</td>
	</tr>
	<?php 
    html_end_box();
    /* print checkbox form for validation */
    print "<form name='chk' method='post' action='data_input.php'>\n";
    html_start_box('', '100%', '', '3', 'center', '');
    /* form the 'where' clause for our main sql query */
    if ($_REQUEST['filter'] != '') {
        $sql_where = "WHERE (di.name like '%" . get_request_var_request('filter') . "%')";
    } else {
        $sql_where = '';
    }
    $sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . " (di.name!='Get Script Data (Indexed)'\n\t\tAND di.name!='Get Script Server Data (Indexed)'\n\t\tAND di.name!='Get SNMP Data'\n\t\tAND di.name!='Get SNMP Data (Indexed)')";
    $total_rows = db_fetch_cell("SELECT\n\t\tcount(*)\n\t\tFROM data_input AS di\n\t\t{$sql_where}");
    $data_inputs = db_fetch_assoc("SELECT di.*,\n\t\tSUM(CASE WHEN dtd.local_data_id=0 THEN 1 ELSE 0 END) AS templates,\n\t\tSUM(CASE WHEN dtd.local_data_id>0 THEN 1 ELSE 0 END) AS data_sources\n\t\tFROM data_input AS di\n\t\tLEFT JOIN data_template_data AS dtd\n\t\tON di.id=dtd.data_template_id\n\t\t{$sql_where}\n\t\tGROUP BY di.id\n\t\tORDER BY " . get_request_var_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('data_input.php?filter=' . get_request_var_request('filter'), MAX_DISPLAY_PAGES, get_request_var_request('page'), get_request_var_request('rows'), $total_rows, 6, 'Input Methods', 'page', 'main');
    print $nav;
    $display_text = array('name' => array('display' => 'Data Input Name', 'align' => 'left', 'sort' => 'ASC', 'tip' => 'The name of this Data Input Method.'), 'nosort' => array('display' => 'Deletable', 'align' => 'right', 'tip' => 'Data Inputs that are in use can not be Deleted.  In use is defined as being referenced either by a Data Source or a Data Template.'), 'data_sources' => array('display' => 'Data Sources Using', 'align' => 'right', 'sort' => 'DESC', 'tip' => 'The number of Data Sources that use this Data Input Method.'), 'templates' => array('display' => 'Templates Using', 'align' => 'right', 'sort' => 'DESC', 'tip' => 'The number of Data Templates that use this Data Input Method.'), 'type_id' => array('display' => 'Data Input Method', 'align' => 'left', 'sort' => 'ASC', 'tip' => 'The method used to gather information for this Data Input Method.'));
    html_header_sort_checkbox($display_text, get_request_var_request('sort_column'), get_request_var_request('sort_direction'), false);
    $i = 0;
    if (sizeof($data_inputs) > 0) {
        foreach ($data_inputs as $data_input) {
            /* hide system types */
            if ($data_input['templates'] > 0 || $data_input['data_sources'] > 0) {
                $disabled = true;
            } else {
                $disabled = false;
            }
            form_alternate_row('line' . $data_input['id'], true, $disabled);
            form_selectable_cell("<a class='linkEditMain' href='" . htmlspecialchars('data_input.php?action=edit&id=' . $data_input['id']) . "'>" . (strlen(get_request_var_request('filter')) ? preg_replace('/(' . preg_quote(get_request_var_request('filter'), '/') . ')/i', "<span class='filteredValue'>\\1</span>", htmlspecialchars($data_input['name'])) : htmlspecialchars($data_input['name'])) . '</a>', $data_input['id']);
            form_selectable_cell($disabled ? 'No' : 'Yes', $data_input['id'], '', 'text-align:right');
            form_selectable_cell(number_format($data_input['data_sources']), $data_input['id'], '', 'text-align:right');
            form_selectable_cell(number_format($data_input['templates']), $data_input['id'], '', 'text-align:right');
            form_selectable_cell($input_types[$data_input['type_id']], $data_input['id']);
            form_checkbox_cell($data_input['name'], $data_input['id'], $disabled);
            form_end_row();
        }
        print $nav;
    } else {
        print "<tr><td colspan='5'><em>No Data Input Methods</em></td></tr>";
    }
    html_end_box(false);
    /* draw the dropdown containing a list of available actions for this form */
    draw_actions_dropdown($di_actions);
    print "</form>\n";
}
开发者ID:MrWnn,项目名称:cacti,代码行数:101,代码来源:data_input.php


注:本文中的html_nav_bar函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。