本文整理汇总了PHP中form_alternate_row函数的典型用法代码示例。如果您正苦于以下问题:PHP form_alternate_row函数的具体用法?PHP form_alternate_row怎么用?PHP form_alternate_row使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了form_alternate_row函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: draw_edit_form
function draw_edit_form($array)
{
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") {
if (isset($field_array['collapsible']) && $field_array['collapsible'] == 'true') {
$collapsible = true;
} else {
$collapsible = false;
}
print "<tr class='spacer tableHeader" . ($collapsible ? ' collapsible' : '') . "' id='row_{$field_name}'><td colspan='2' style='cursor:pointer;' class='tableSubHeaderColumn'>" . $field_array["friendly_name"] . ($collapsible ? "<div style='float:right;padding-right:4px;'><i class='fa fa-angle-double-up'></i></div>" : "") . "</td></tr>\n";
} else {
if (isset($config_array["force_row_color"])) {
print "<tr class='even-alternate'>";
} else {
form_alternate_row('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($field_array["sub_checkbox"]["default"]) ? $field_array["sub_checkbox"]["default"] : "", isset($field_array["sub_checkbox"]["form_id"]) ? $field_array["sub_checkbox"]["form_id"] : "", isset($field_array["sub_checkbox"]["class"]) ? $field_array["sub_checkbox"]["class"] : "", isset($field_array["sub_checkbox"]["on_change"]) ? $field_array["sub_checkbox"]["on_change"] : "");
}
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++;
}
}
}
示例2: mikrotik_devices
//.........这里部分代码省略.........
$num_rows = get_request_var_request('rows');
}
$limit = ' LIMIT ' . $num_rows * (get_request_var_request('page') - 1) . ',' . $num_rows;
$sql_where = '';
if ($_REQUEST['status'] != '-1') {
$sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . ' hrs.host_status=' . $_REQUEST['status'];
}
$sql_join = '';
if ($_REQUEST['filter'] != '') {
$sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . " h.description LIKE '%" . $_REQUEST['filter'] . "%' OR\n\t\t\th.hostname LIKE '%" . $_REQUEST['filter'] . "%'";
}
$sql = "SELECT hrs.*, h.hostname, h.description, h.disabled, trees.trees, queues.queues\n\t\tFROM plugin_mikrotik_system AS hrs\n\t\tINNER JOIN host AS h \n\t\tON h.id=hrs.host_id\n\t\tLEFT JOIN (SELECT host_id AS hid, count(*) AS trees FROM plugin_mikrotik_trees GROUP BY host_id) AS trees\n\t\tON trees.hid=hrs.host_id\n\t\tLEFT JOIN (SELECT host_id AS hid, count(*) AS queues FROM plugin_mikrotik_queues GROUP BY host_id) AS queues\n\t\tON queues.hid=hrs.host_id\n\t\t{$sql_join}\n\t\t{$sql_where}\n\t\tORDER BY " . get_request_var_request("sort_column") . " " . get_request_var_request("sort_direction") . " " . $limit;
//echo $sql;
$rows = db_fetch_assoc($sql);
$total_rows = db_fetch_cell("SELECT COUNT(*)\n\t\tFROM plugin_mikrotik_system AS hrs\n\t\tINNER JOIN host AS h\n\t\tON h.id=hrs.host_id\n\t\t{$sql_join}\n\t\t{$sql_where}");
$nav = html_nav_bar('mikrotik.php?action=devices', MAX_DISPLAY_PAGES, get_request_var_request('page'), $num_rows, $total_rows, 15, 'Devices', 'page', 'main');
print $nav;
$display_text = array('nosort' => array('display' => 'Actions', 'sort' => 'ASC', 'align' => 'left'), 'description' => array('display' => 'Name', 'sort' => 'ASC', 'align' => 'left'), 'host_status' => array('display' => 'Status', 'sort' => 'DESC', 'align' => 'center'), 'firmwareVersion' => array('display' => 'FW Ver', 'sort' => 'DESC', 'align' => 'right'), 'licVersion' => array('display' => 'Lic Ver', 'sort' => 'DESC', 'align' => 'right'), 'uptime' => array('display' => 'Uptime(d:h:m)', 'sort' => 'DESC', 'align' => 'right'), 'trees' => array('display' => 'Trees', 'sort' => 'DESC', 'align' => 'right'), 'users' => array('display' => 'Users', 'sort' => 'DESC', 'align' => 'right'), 'cpuPercent' => array('display' => 'CPU %', 'sort' => 'DESC', 'align' => 'right'), 'numCpus' => array('display' => 'CPUs', 'sort' => 'DESC', 'align' => 'right'), 'processes' => array('display' => 'Processes', 'sort' => 'DESC', 'align' => 'right'), 'memSize' => array('display' => 'Total Mem', 'sort' => 'DESC', 'align' => 'right'), 'memUsed' => array('display' => 'Used Mem', 'sort' => 'DESC', 'align' => 'right'), 'diskSize' => array('display' => 'Total Disk', 'sort' => 'DESC', 'align' => 'right'), 'diskUsed' => array('display' => 'Used Disk', 'sort' => 'DESC', 'align' => 'right'));
html_header_sort($display_text, get_request_var_request('sort_column'), get_request_var_request('sort_direction'), 'false');
/* set some defaults */
$url = $config['url_path'] . 'plugins/mikrotik/mikrotik.php';
$users = $config['url_path'] . 'plugins/mikrotik/images/view_users.gif';
$usersn = $config['url_path'] . 'plugins/mikrotik/images/view_users_none.gif';
$host = $config['url_path'] . 'plugins/mikrotik/images/view_hosts.gif';
$trees = $config['url_path'] . 'plugins/mikrotik/images/view_trees.gif';
$treesn = $config['url_path'] . 'plugins/mikrotik/images/view_trees_none.gif';
$queues = $config['url_path'] . 'plugins/mikrotik/images/view_queues.gif';
$queuesn = $config['url_path'] . 'plugins/mikrotik/images/view_queues_none.gif';
$interfaces = $config['url_path'] . 'plugins/mikrotik/images/view_interfaces.gif';
$dashboard = $config['url_path'] . 'plugins/mikrotik/images/view_dashboard.gif';
$graphs = $config['url_path'] . 'plugins/mikrotik/images/view_graphs.gif';
$nographs = $config['url_path'] . 'plugins/mikrotik/images/view_graphs_disabled.gif';
$hcpudq = read_config_option('mikrotik_dq_host_cpu');
if (sizeof($rows)) {
foreach ($rows as $row) {
$days = intval($row['uptime'] / (60 * 60 * 24 * 100));
$remainder = $row['uptime'] % (60 * 60 * 24 * 100);
$hours = intval($remainder / (60 * 60 * 100));
$remainder = $remainder % (60 * 60 * 100);
$minutes = intval($remainder / (60 * 100));
$found = db_fetch_cell('SELECT COUNT(*) FROM graph_local WHERE host_id=' . $row['host_id']);
form_alternate_row();
echo "<td style='white-space:nowrap;min-width:115px;text-align:left;'>";
//echo "<a style='padding:1px;' href='" . htmlspecialchars("$url?action=dashboard&reset=1&device=" . $row["host_id"]) . "'><img src='$dashboard' title='View Dashboard' align='absmiddle' border='0'></a>";
if ($row['users'] > 0) {
echo "<a class='hyperLink' href='" . htmlspecialchars("{$url}?action=users&reset=1&device=" . $row['host_id']) . "'><img src='{$users}' title='View Users' align='absmiddle' border='0' alt=''></a>";
} else {
echo "<img style='border:0px;padding:3px;' src='{$usersn}' title='No Users Found' align='absmiddle' alt=''>";
}
if ($row['queues'] > 0) {
echo "<a class='hyperLink' href='" . htmlspecialchars("{$url}?action=queues&reset=1&device=" . $row['host_id']) . "'><img src='{$queues}' title='View Simple Queue' align='absmiddle' border='0' alt=''></a>";
} else {
echo "<img style='border:0px;padding:3px;' src='{$queuesn}' title='No Simple Queues Found' align='absmiddle' alt=''>";
}
if ($row['trees'] > 0) {
echo "<a class='hyperLink' href='" . htmlspecialchars("{$url}?action=trees&reset=1&device=" . $row['host_id']) . "'><img src='{$trees}' title='View Queue Trees' align='absmiddle' border='0' alt=''></a>";
} else {
echo "<img style='border:0px;padding:3px;' src='{$treesn}' title='No Queue Trees Found' align='absmiddle' alt=''>";
}
echo "<a class='hyperLink' href='" . htmlspecialchars("{$url}?action=interfaces&reset=1&device=" . $row['host_id']) . "'><img src='{$interfaces}' title='View Interfaces' align='absmiddle' border='0' alt=''></a>";
if ($found) {
echo "<a class='hyperLink' href='" . htmlspecialchars("{$url}?action=graphs&reset=1&host_id=" . $row['host_id'] . "&style=selective&graph_add=&graph_list=&graph_template_id=0&filter=") . "'><img src='{$graphs}' title='View Graphs' align='absmiddle' border='0' alt=''></a>";
} else {
echo "<img src='{$nographs}' title='No Graphs Defined' align='absmiddle' border='0'>";
}
$graph_cpu = mikrotik_get_graph_url($hcpudq, $row['host_id'], '', $row['numCpus'], false);
$graph_cpup = mikrotik_get_graph_template_url(mikrotik_template_by_hash('7df474393f58bae8e8d6b85f10efad71'), $row['host_id'], round($row['cpuPercent'], 2), false);
$graph_users = mikrotik_get_graph_template_url(mikrotik_template_by_hash('99e37ff13139f586d257ba9a637d7340'), $row['host_id'], empty($rows['users']) ? '-' : $row['users'], false);
$graph_aproc = mikrotik_get_graph_template_url(mikrotik_template_by_hash('e797d967db24fd86341a8aa8c60fa9e0'), $row['host_id'], $row['host_status'] < 2 ? 'N/A' : $row['processes'], false);
$graph_disk = mikrotik_get_graph_template_url(mikrotik_template_by_hash('0ece13b90785aa04d1f554a093685948'), $row['host_id'], $row['host_status'] < 2 ? 'N/A' : round($row['diskUsed'], 2), false);
$graph_mem = mikrotik_get_graph_template_url(mikrotik_template_by_hash('4396ae857c4f9bc5ed1f26b5361e42d9'), $row['host_id'], $row['host_status'] < 2 ? 'N/A' : round($row['memUsed'], 2), false);
$graph_upt = mikrotik_get_graph_template_url(mikrotik_template_by_hash('7d8dc3050621a2cb937cac3895bc5d5b'), $row['host_id'], $row['host_status'] < 2 ? 'N/A' : mikrotik_format_uptime($days, $hours, $minutes), false);
if (api_plugin_user_realm_auth('host.php')) {
$host_url = "<a class='hyperLink' href='" . htmlspecialchars($config['url_path'] . 'host.php?action=edit&id=' . $row['host_id']) . "' title='Edit Hosts'>" . $row['hostname'] . '</a>';
} else {
$host_url = $row['hostname'];
}
echo '</td>';
echo "<td style='text-align:left;white-space:nowrap;'><strong>" . (strlen($_REQUEST['filter']) ? preg_replace('/(' . preg_quote(get_request_var_request('filter'), '/') . ')/i', "<span class='filteredValue'>\\1</span>", $row['description'] . '</strong> [' . $host_url . ']') : $row['description'] . '</strong> [' . $host_url . ']') . '</td>';
echo "<td style='text-align:center;'>" . get_colored_device_status($row['disabled'] == 'on' ? true : false, $row['host_status']) . '</td>';
echo "<td style='text-align:right;'>" . $row['firmwareVersion'] . '</td>';
echo "<td style='text-align:right;'>" . $row['licVersion'] . '</td>';
echo "<td style='text-align:right;'>" . $graph_upt . '</td>';
echo "<td style='text-align:right;'>" . (!empty($row['trees']) ? $row['trees'] : '-') . '</td>';
echo "<td style='text-align:right;'>" . $graph_users . '</td>';
echo "<td style='text-align:right;'>" . ($row['host_status'] < 2 ? 'N/A' : $graph_cpup) . '</td>';
echo "<td style='text-align:right;'>" . ($row['host_status'] < 2 ? 'N/A' : $graph_cpu) . '</td>';
echo "<td style='text-align:right;'>" . $graph_aproc . '</td>';
echo "<td style='text-align:right;'>" . mikrotik_memory($row['memSize']) . '</td>';
echo "<td style='text-align:right;'>" . $graph_mem . ' %</td>';
echo "<td style='text-align:right;'>" . mikrotik_memory($row['diskSize']) . '</td>';
echo "<td style='text-align:right;'>" . $graph_disk . ' %</td>';
form_end_row();
}
print $nav;
} else {
print '<tr><td colspan="5"><em>No Devices Found</em></td></tr>';
}
html_end_box();
}
示例3: graphs
function graphs()
{
global $item_rows;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request('host_id'));
input_validate_input_number(get_request_var_request('graph_type'));
input_validate_input_number(get_request_var_request('rows'));
/* ==================================================== */
/* clean up search string */
if (isset($_REQUEST['filter'])) {
$_REQUEST['filter'] = sanitize_search_string(get_request_var_request('filter'));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST['clear_x'])) {
kill_session_var('sess_graphs_new_filter');
kill_session_var('sess_default_rows');
unset($_REQUEST['filter']);
unset($_REQUEST['rows']);
$changed = true;
} else {
/* if any of the settings changed, reset the page number */
$changed = false;
$changed += check_changed('host_id', 'sess_graphs_new_host_id');
$changed += check_changed('graph_type', 'sess_graphs_new_graph_type');
$changed += check_changed('filter', 'sess_graphs_new_filter');
$changed += check_changed('rows', 'sess_default_rows');
}
load_current_session_value('host_id', 'sess_graphs_new_host_id', db_fetch_cell('SELECT id FROM host ORDER BY description, hostname LIMIT 1'));
load_current_session_value('graph_type', 'sess_graphs_new_graph_type', read_config_option('default_graphs_new_dropdown'));
load_current_session_value('filter', 'sess_graphs_new_filter', '');
load_current_session_value('rows', 'sess_default_rows', read_config_option('num_rows_table'));
if (!empty($_REQUEST['host_id'])) {
$host = db_fetch_row_prepared('SELECT id, description, hostname, host_template_id FROM host WHERE id = ?', array($_REQUEST['host_id']));
$header = ' [ ' . htmlspecialchars($host['description']) . ' (' . htmlspecialchars($host['hostname']) . ') ' . (!empty($host['host_template_id']) ? htmlspecialchars(db_fetch_cell_prepared('SELECT name FROM host_template WHERE id = ?', array($host['host_template_id']))) : '') . ' ]';
} else {
$host = array();
$header = 'None Host Type';
}
$row_limit = get_request_var_request('rows');
html_start_box("<strong>New Graphs for</strong> {$header}", '100%', '', '3', 'center', '');
form_alternate_row();
print '<td class="even">';
?>
<script type='text/javascript'>
<!--
function applyFilter() {
strURL = '?graph_type=' + $('#graph_type').val();
strURL = strURL + '&host_id=' + $('#host_id').val();
strURL = strURL + '&filter=' + $('#filter').val();;
strURL = strURL + '&rows=' + $('#rows').val();;
document.location = strURL;
}
-->
</script>
<form name='form_graphs_new' action='graphs_new.php'>
<table width='100%' cellpadding='2' cellspacing='0' border='0' align='left'>
<tr>
<?php
print html_host_filter($_REQUEST['host_id']);
?>
<td style='white-space:nowrap;' width='1'>
Graph Types
</td>
<td width='1'>
<select id='graph_type' name='graph_type' onChange='applyFilter()'>
<option value='-2'<?php
if ($_REQUEST['graph_type'] == '-2') {
?>
selected<?php
}
?>
>All</option>
<option value='-1'<?php
if ($_REQUEST['graph_type'] == '-1') {
?>
selected<?php
}
?>
>Graph Template Based</option>
<?php
$snmp_queries = db_fetch_assoc_prepared('SELECT
snmp_query.id,
snmp_query.name,
snmp_query.xml_path
FROM (snmp_query, host_snmp_query)
WHERE host_snmp_query.snmp_query_id = snmp_query.id
AND host_snmp_query.host_id = ?
ORDER BY snmp_query.name', array($host['id']));
if (sizeof($snmp_queries) > 0) {
foreach ($snmp_queries as $query) {
print "<option value='" . $query['id'] . "'";
if ($_REQUEST['graph_type'] == $query['id']) {
print ' selected';
}
print '>' . $query['name'] . "</option>\n";
}
}
?>
//.........这里部分代码省略.........
示例4: 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";
}
示例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>
//.........这里部分代码省略.........
示例6: 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
}
示例7: ds
//.........这里部分代码省略.........
html_end_box();
/* form the 'where' clause for our main sql query */
if (strlen(get_request_var_request("filter"))) {
$sql_where1 = "AND (data_template_data.name_cache like '%%" . get_request_var_request("filter") . "%%'" . " OR data_template_data.local_data_id like '%%" . get_request_var_request("filter") . "%%'" . " OR data_template.name like '%%" . get_request_var_request("filter") . "%%'" . " OR data_input.name like '%%" . get_request_var_request("filter") . "%%')";
$sql_where2 = "AND (data_template_data.name_cache like '%%" . get_request_var_request("filter") . "%%'" . " OR data_template.name like '%%" . get_request_var_request("filter") . "%%')";
} else {
$sql_where1 = "";
$sql_where2 = "";
}
if (get_request_var_request("host_id") == "-1") {
/* Show all items */
} elseif (get_request_var_request("host_id") == "0") {
$sql_where1 .= " AND data_local.host_id=0";
$sql_where2 .= " AND data_local.host_id=0";
} elseif (!empty($_REQUEST["host_id"])) {
$sql_where1 .= " AND data_local.host_id=" . get_request_var_request("host_id");
$sql_where2 .= " AND data_local.host_id=" . get_request_var_request("host_id");
}
if (get_request_var_request("template_id") == "-1") {
/* Show all items */
} elseif (get_request_var_request("template_id") == "0") {
$sql_where1 .= " AND data_template_data.data_template_id=0";
$sql_where2 .= " AND data_template_data.data_template_id=0";
} elseif (!empty($_REQUEST["host_id"])) {
$sql_where1 .= " AND data_template_data.data_template_id=" . get_request_var_request("template_id");
$sql_where2 .= " AND data_template_data.data_template_id=" . get_request_var_request("template_id");
}
if (get_request_var_request("method_id") == "-1") {
/* Show all items */
} elseif (get_request_var_request("method_id") == "0") {
$sql_where1 .= " AND data_template_data.data_input_id=0";
$sql_where2 .= " AND data_template_data.data_input_id=0";
} elseif (!empty($_REQUEST["method_id"])) {
$sql_where1 .= " AND data_template_data.data_input_id=" . get_request_var_request("method_id");
$sql_where2 .= " AND data_template_data.data_input_id=" . get_request_var_request("method_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_where1}"));
$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_where2}\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_where1}\n\t\tORDER BY " . get_request_var_request("sort_column") . " " . get_request_var_request("sort_direction") . " LIMIT " . get_request_var_request("ds_rows") * (get_request_var_request("page") - 1) . "," . get_request_var_request("ds_rows"));
print "<form name='chk' method='post' action='data_sources.php'>\n";
html_start_box("", "100%", "", "3", "center", "");
$nav = html_nav_bar("data_sources.php?filter=" . get_request_var_request("filter") . "&host_id=" . get_request_var_request("host_id"), MAX_DISPLAY_PAGES, get_request_var_request("page"), get_request_var_request("ds_rows"), $total_rows, 7);
print $nav;
$display_text = array("name_cache" => array("Name", "ASC"), "local_data_id" => array("ID", "ASC"), "data_input_name" => array("Data Input Method", "ASC"), "nosort" => array("Poller Interval", "ASC"), "active" => array("Active", "ASC"), "data_template_name" => array("Template Name", "ASC"));
html_header_sort_checkbox($display_text, get_request_var_request("sort_column"), get_request_var_request("sort_direction"), false);
$i = 0;
if (sizeof($data_sources) > 0) {
foreach ($data_sources as $data_source) {
$data_source["data_template_name"] = htmlspecialchars($data_source["data_template_name"]);
$data_name_cache = title_trim(htmlspecialchars($data_source["name_cache"]), read_config_option("max_title_data_source"));
if (trim(get_request_var_request("filter") != "")) {
$data_name_cache = preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $data_name_cache);
}
/* keep copy of data source for comparison */
$data_source_orig = $data_source;
$data_source = api_plugin_hook_function('data_sources_table', $data_source);
/* we're escaping strings here, so no need to escape them on form_selectable_cell */
if (empty($data_source["data_template_name"])) {
$data_template_name = "<em>None</em>";
} elseif ($data_source_orig["data_template_name"] != $data_source["data_template_name"]) {
/* was changed by plugin, plugin has to take care for html-escaping */
$data_template_name = empty($data_source["data_template_name"]) ? "<em>None</em>" : $data_source["data_template_name"];
} elseif (trim(get_request_var_request("filter") != "")) {
/* we take care of html-escaping */
$data_template_name = preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", htmlspecialchars($data_source['data_template_name']));
} else {
$data_template_name = htmlspecialchars($data_source["data_template_name"]);
}
if (empty($data_source["data_input_name"])) {
$data_input_name = "<em>None</em>";
} elseif ($data_source_orig["data_input_name"] != $data_source["data_input_name"]) {
/* was changed by plugin, plugin has to take care for html-escaping */
$data_input_name = empty($data_source["data_input_name"]) ? "<em>None</em>" : $data_source["data_input_name"];
} elseif (trim(get_request_var_request("filter") != "")) {
/* we take care of html-escaping */
$data_input_name = preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", htmlspecialchars($data_source['data_input_name']));
} else {
$data_input_name = htmlspecialchars($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('line' . $data_source["local_data_id"], true);
form_selectable_cell("<a class='linkEditMain' href='" . htmlspecialchars("data_sources.php?action=ds_edit&id=" . $data_source["local_data_id"]) . "' title='" . htmlspecialchars($data_source["name_cache"], ENT_QUOTES) . "'>" . (get_request_var_request("filter") != "" ? preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", title_trim(htmlspecialchars($data_source["name_cache"]), read_config_option("max_title_data_source"))) : title_trim(htmlspecialchars($data_source["name_cache"]), read_config_option("max_title_data_source"))) . "</a>", $data_source["local_data_id"]);
form_selectable_cell($data_source['local_data_id'], $data_source['local_data_id']);
form_selectable_cell($data_input_name, $data_source["local_data_id"]);
form_selectable_cell(get_poller_interval($poller_interval), $data_source["local_data_id"]);
form_selectable_cell($data_source['active'] == "on" ? "Yes" : "No", $data_source["local_data_id"]);
form_selectable_cell($data_template_name, $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 {
print "<tr><td><em>No Data Sources</em></td></tr>";
}
html_end_box(false);
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($ds_actions);
print "</form>\n";
}
示例8: export
function export()
{
global $export_types;
/* 'graph_template' should be the default */
if (!isset($_REQUEST["export_type"])) {
$_REQUEST["export_type"] = "graph_template";
}
html_start_box("<strong>Export Templates</strong>", "100%", "", "3", "center", "");
?>
<tr>
<td>
<form name="form_graph_id" action="templates_export.php">
<table align='left' cellpadding='3' cellspacing='0'>
<tr>
<td style='font-size:1.2em;'>What would you like to export?</td>
<td>
<select name="cbo_graph_id" onChange="window.location=document.form_graph_id.cbo_graph_id.options[document.form_graph_id.cbo_graph_id.selectedIndex].value">
<?php
while (list($key, $array) = each($export_types)) {
print "<option value='templates_export.php?export_type=" . htmlspecialchars($key, ENT_QUOTES) . "'";
if ($_REQUEST["export_type"] == $key) {
print " selected";
}
print ">" . $array["name"] . "</option>\n";
}
?>
</select>
</td>
</tr>
</table>
</form>
</td>
</tr>
<?php
html_end_box();
print "<form method='post' action='templates_export.php'>\n";
html_start_box("<strong>Available Templates</strong> [" . $export_types[$_REQUEST["export_type"]]["name"] . "]", "100%", "", "3", "center", "");
form_alternate_row();
?>
<td width="50%">
<font class="textEditTitle"><?php
print $export_types[$_REQUEST["export_type"]]["name"];
?>
to Export</font><br>
Choose the exact item to export to XML.
</td>
<td>
<?php
form_dropdown("export_item_id", db_fetch_assoc($export_types[$_REQUEST["export_type"]]["dropdown_sql"]), "name", "id", "", "", "0");
?>
</td>
</tr>
<?php
form_alternate_row();
?>
<td width="50%">
<font class="textEditTitle">Include Dependencies</font><br>
Some templates rely on other items in Cacti to function properly. It is highly recommended that you select
this box or the resulting import may fail.
</td>
<td>
<?php
form_checkbox("include_deps", "on", "Include Dependencies", "on", "", true);
?>
</td>
</tr>
<?php
form_alternate_row();
?>
<td width="50%">
<font class="textEditTitle">Output Format</font><br>
Choose the format to output the resulting XML file in.
</td>
<td>
<?php
form_radio_button("output_format", "3", "1", "Output to the Browser (within Cacti)", "1", true);
print "<br>";
form_radio_button("output_format", "3", "2", "Output to the Browser (raw XML)", "1", true);
print "<br>";
form_radio_button("output_format", "3", "3", "Save File Locally", "1", true);
form_hidden_box("export_type", $_REQUEST["export_type"], "");
form_hidden_box("save_component_export", "1", "");
?>
</td>
</tr>
<?php
html_end_box();
form_save_button("", "export");
}
示例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";
}
示例10: mactrack_display_run_status
//.........这里部分代码省略.........
}
?>
</td>
<td>
<input type='button' value='<?php
print __('Refresh');
?>
' id='refresh'>
</td>
</tr>
</table>
</td>
</form>
</tr>
<?php
html_end_box(TRUE);
html_start_box('', '100%', '', '1', 'center', '');
/* get information on running processes */
$running_processes = db_fetch_assoc('SELECT
mac_track_processes.process_id,
mac_track_devices.device_name,
mac_track_processes.device_id,
mac_track_processes.start_date
FROM mac_track_devices
INNER JOIN mac_track_processes
ON mac_track_devices.device_id = mac_track_processes.device_id
WHERE mac_track_processes.device_id != 0');
$resolver_running = db_fetch_cell('SELECT COUNT(*) FROM mac_track_processes WHERE device_id=0');
$total_processes = sizeof($running_processes);
$run_status = db_fetch_assoc("SELECT last_rundate,\n\t\tCOUNT(last_rundate) AS devices\n\t\tFROM mac_track_devices\n\t\tWHERE disabled = ''\n\t\tGROUP BY last_rundate\n\t\tORDER BY last_rundate DESC");
$total_devices = db_fetch_cell('SELECT count(*) FROM mac_track_devices');
$disabled_devices = db_fetch_cell('SELECT count(*) FROM mac_track_devices');
html_header(array(__('Current Process Status')), 2);
form_alternate_row();
print '<td>' . __('The MacTrack Poller is:') . '</td><td>' . ($total_processes > 0 ? __('RUNNING') : ($seconds_offset == 'disabled' ? __('DISABLED') : __('IDLE'))) . '</td>';
if ($total_processes > 0) {
form_alternate_row();
print '<td>' . __('Running Processes:') . '</td><td>' . $total_processes . '</td>';
}
form_alternate_row();
print '<td width=200>' . __('Last Time Poller Started:') . '</td><td>' . read_config_option('mt_scan_date', TRUE) . '</td>';
form_alternate_row();
print '<td width=200>' . __('Poller Frequency:') . '</td><td>' . ($seconds_offset == 'disabled' ? __('N/A') : $mactrack_poller_frequencies[$seconds_offset / 60]) . '</td>';
form_alternate_row();
print '<td width=200>' . __('Approx. Next Runtime:') . '</td><td>' . (empty($next_run_time) ? __('N/A') : date('Y-m-d G:i:s', $next_run_time)) . '</td>';
form_alternate_row();
print '<td width=200>' . __('Approx. Next DB Maintenance:') . '</td><td>' . (empty($next_db_maint_time) ? __('N/A') : date('Y-m-d G:i:s', $next_db_maint_time)) . '</td>';
html_header(array(__('Run Time Details')), 2);
form_alternate_row();
print '<td width=200>' . __('Last Poller Runtime:') . '</td><td>' . read_config_option('stats_mactrack', TRUE) . '</td>';
form_alternate_row();
print '<td width=200>' . __('Last Poller Maintenence Runtime:') . '</td><td>' . read_config_option('stats_mactrack_maint', TRUE) . '</td>';
form_alternate_row();
print '<td width=200>' . __('Maximum Concurrent Processes:') . '</td><td> ' . read_config_option('mt_processes', TRUE) . __('processes') . '</td>';
form_alternate_row();
print '<td width=200>' . __('Maximum Per Device Scan Time:') . '</td><td> ' . read_config_option('mt_script_runtime', TRUE) . __('minutes') . '</td>';
html_header(array(__('DNS Configuration Information')), 2);
form_alternate_row();
print '<td width=200>' . __('Reverse DNS Resolution is') . '</td><td>' . (read_config_option('mt_reverse_dns', TRUE) == 'on' ? __('ENABLED') : __('DISABLED')) . '</td>';
form_alternate_row();
print '<td width=200>' . __('Primary DNS Server:') . '</td><td>' . read_config_option('mt_dns_primary', TRUE) . '</td>';
form_alternate_row();
print '<td width=200>' . __('Secondary DNS Server:') . '</td><td>' . read_config_option('mt_dns_secondary', TRUE) . '</td>';
form_alternate_row();
print '<td width=200>' . __('DNS Resoution Timeout:') . '</td><td> ' . read_config_option('mt_dns_timeout', TRUE) . __('milliseconds') . '</td>';
html_end_box(TRUE);
示例11: 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);
}
示例12: color
function color()
{
html_start_box('<strong>Colors</strong>', '100%', '', '3', 'center', 'color.php?action=edit');
print "<tr class='tableHeader'>";
DrawMatrixHeaderItem('Hex Value', '', 1);
DrawMatrixHeaderItem('Color', '', 1);
DrawMatrixHeaderItem(' ', '', 1);
DrawMatrixHeaderItem(' ', '', 1);
DrawMatrixHeaderItem('Hex Value', '', 1);
DrawMatrixHeaderItem('Color', '', 1);
DrawMatrixHeaderItem(' ', '', 1);
DrawMatrixHeaderItem(' ', '', 1);
DrawMatrixHeaderItem('Hex Value', '', 1);
DrawMatrixHeaderItem('Color', '', 1);
DrawMatrixHeaderItem(' ', '', 1);
DrawMatrixHeaderItem(' ', '', 1);
DrawMatrixHeaderItem('Hex Value', '', 1);
DrawMatrixHeaderItem('Color', '', 1);
DrawMatrixHeaderItem(' ', '', 1);
print '</tr>';
$color_list = db_fetch_assoc('SELECT * FROM colors ORDER BY hex');
$i = 0;
if (sizeof($color_list) > 0) {
$j = 0;
## even/odd counter
foreach ($color_list as $color) {
$j++;
if ($j % 4 == 1) {
form_alternate_row('', true);
?>
<td width='1'>
<a class="linkEditMain" style='display:block;' href="<?php
print htmlspecialchars('color.php?action=edit&id=' . $color['id']);
?>
"><?php
print $color['hex'];
?>
</a>
</td>
<td bgcolor="#<?php
print $color['hex'];
?>
" width="10%"> </td>
<td align="right">
<a href="<?php
print htmlspecialchars('color.php?action=remove&id=' . $color['id']);
?>
"><img src="images/delete_icon.gif" style="height:10px;width:10px;" border="0" alt="Delete"></a>
</td>
<?php
$j = 1;
} elseif ($j % 4 == 2 || $j % 4 == 3) {
?>
<td></td>
<td width='1'>
<a class="linkEditMain" style='display:block;' href="<?php
print htmlspecialchars('color.php?action=edit&id=' . $color['id']);
?>
"><?php
print $color['hex'];
?>
</a>
</td>
<td bgcolor="#<?php
print $color['hex'];
?>
" width="10%"> </td>
<td align="right">
<a href="<?php
print htmlspecialchars('color.php?action=remove&id=' . $color['id']);
?>
"><img src="images/delete_icon.gif" style="height:10px;width:10px;" border="0" alt="Delete"></a>
</td>
<?php
$j = $j++;
} else {
?>
<td></td>
<td width='1'>
<a class="linkEditMain" style='display:block;' href="<?php
print htmlspecialchars('color.php?action=edit&id=' . $color['id']);
?>
"><?php
print $color['hex'];
?>
</a>
</td>
<td bgcolor="#<?php
print $color['hex'];
?>
" width="10%"> </td>
<td align="right">
<a href="<?php
print htmlspecialchars('color.php?action=remove&id=' . $color['id']);
?>
"><img src="images/delete_icon.gif" style="height:10px;width:10px;" border="0" alt="Delete"></a>
</td>
</tr>
<?php
}
//.........这里部分代码省略.........
示例13: 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();
}
示例14: 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();
}
示例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";
}