2011-01-25 Miguel de Dios <miguel.dedios@artica.es>
* operation/search_results.php: added the tab to show search list for modules. And cleaned source code style. * operation/search_modules.php: added the page to list the searched modules. * operation/search_agents.php: cleaned source code style. Pending task: #3141623 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3772 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
8dadb482c8
commit
efd59e2718
pandora_console
|
@ -1,3 +1,14 @@
|
|||
2011-01-25 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* operation/search_results.php: added the tab to show search list for
|
||||
modules. And cleaned source code style.
|
||||
|
||||
* operation/search_modules.php: added the page to list the searched modules.
|
||||
|
||||
* operation/search_agents.php: cleaned source code style.
|
||||
|
||||
Pending task: #3141623
|
||||
|
||||
2011-01-24 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/pChart/pChart.class: fixed in the function "drawTextBox" when
|
||||
|
|
|
@ -147,89 +147,99 @@ if ($searchAgents) {
|
|||
|
||||
|
||||
if (!$agents) {
|
||||
echo "<br><div class='nf'>" . __("Zero results found") . "</div>\n";
|
||||
echo "<br><div class='nf'>" . __("Zero results found") . "</div>\n";
|
||||
}
|
||||
else {
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->width = "98%";
|
||||
$table->class = "databox";
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->width = "98%";
|
||||
$table->class = "databox";
|
||||
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('Agent') . ' ' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=name&sort=up"><img src="images/sort_up.png" style="' . $selectNameUp . '" /></a>' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=name&sort=down"><img src="images/sort_down.png" style="' . $selectNameDown . '" /></a>';
|
||||
$table->head[1] = __('OS'). ' ' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=os&sort=up"><img src="images/sort_up.png" style="' . $selectOsUp . '" /></a>' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=os&sort=down"><img src="images/sort_down.png" style="' . $selectOsDown . '" /></a>';
|
||||
$table->head[2] = __('Interval'). ' ' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=interval&sort=up"><img src="images/sort_up.png" style="' . $selectIntervalUp . '" /></a>' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=interval&sort=down"><img src="images/sort_down.png" style="' . $selectIntervalDown . '" /></a>';
|
||||
$table->head[3] = __('Group'). ' ' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=group&sort=up"><img src="images/sort_up.png" style="' . $selectGroupUp . '" /></a>' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=group&sort=down"><img src="images/sort_down.png" style="' . $selectGroupDown . '" /></a>';
|
||||
$table->head[4] = __('Modules');
|
||||
$table->head[5] = __('Status');
|
||||
$table->head[6] = __('Alerts');
|
||||
$table->head[7] = __('Last contact'). ' ' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=last_contact&sort=up"><img src="images/sort_up.png" style="' . $selectLastContactUp . '" /></a>' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=last_contact&sort=down"><img src="images/sort_down.png" style="' . $selectLastContactDown . '" /></a>';
|
||||
$table->head[8] = '';
|
||||
|
||||
$table->align = array ();
|
||||
$table->align[0] = "left";
|
||||
$table->align[1] = "center";
|
||||
$table->align[2] = "center";
|
||||
$table->align[3] = "center";
|
||||
$table->align[4] = "center";
|
||||
$table->align[5] = "center";
|
||||
$table->align[6] = "center";
|
||||
$table->align[7] = "right";
|
||||
$table->align[8] = "center";
|
||||
|
||||
$table->data = array ();
|
||||
|
||||
foreach ($agents as $agent) {
|
||||
$agent_info = get_agent_module_info ($agent["id_agente"]);
|
||||
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('Agent') . ' ' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=name&sort=up"><img src="images/sort_up.png" style="' . $selectNameUp . '" /></a>' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=name&sort=down"><img src="images/sort_down.png" style="' . $selectNameDown . '" /></a>';
|
||||
$table->head[1] = __('OS'). ' ' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=os&sort=up"><img src="images/sort_up.png" style="' . $selectOsUp . '" /></a>' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=os&sort=down"><img src="images/sort_down.png" style="' . $selectOsDown . '" /></a>';
|
||||
$table->head[2] = __('Interval'). ' ' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=interval&sort=up"><img src="images/sort_up.png" style="' . $selectIntervalUp . '" /></a>' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=interval&sort=down"><img src="images/sort_down.png" style="' . $selectIntervalDown . '" /></a>';
|
||||
$table->head[3] = __('Group'). ' ' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=group&sort=up"><img src="images/sort_up.png" style="' . $selectGroupUp . '" /></a>' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=group&sort=down"><img src="images/sort_down.png" style="' . $selectGroupDown . '" /></a>';
|
||||
$table->head[4] = __('Modules');
|
||||
$table->head[5] = __('Status');
|
||||
$table->head[6] = __('Alerts');
|
||||
$table->head[7] = __('Last contact'). ' ' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=last_contact&sort=up"><img src="images/sort_up.png" style="' . $selectLastContactUp . '" /></a>' .
|
||||
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=last_contact&sort=down"><img src="images/sort_down.png" style="' . $selectLastContactDown . '" /></a>';
|
||||
$modulesCell = '<b>'. $agent_info["modules"] . '</b>';
|
||||
if ($agent_info["monitor_alertsfired"] > 0)
|
||||
$modulesCell .= ' : <span class="orange">'.$agent_info["monitor_alertsfired"].'</span>';
|
||||
if ($agent_info["monitor_normal"] > 0)
|
||||
$modulesCell .= '</b> : <span class="green">'.$agent_info["monitor_normal"].'</span>';
|
||||
if ($agent_info["monitor_warning"] > 0)
|
||||
$modulesCell .= ' : <span class="yellow">'.$agent_info["monitor_warning"].'</span>';
|
||||
if ($agent_info["monitor_critical"] > 0)
|
||||
$modulesCell .= ' : <span class="red">'.$agent_info["monitor_critical"].'</span>';
|
||||
if ($agent_info["monitor_unknown"] > 0)
|
||||
$modulesCell .= ' : <span class="grey">'.$agent_info["monitor_unknown"].'</span>';
|
||||
|
||||
$table->align = array ();
|
||||
$table->align[0] = "left";
|
||||
$table->align[1] = "center";
|
||||
$table->align[2] = "center";
|
||||
$table->align[3] = "center";
|
||||
$table->align[4] = "center";
|
||||
$table->align[5] = "center";
|
||||
$table->align[6] = "center";
|
||||
$table->align[7] = "right";
|
||||
|
||||
$table->data = array ();
|
||||
|
||||
foreach ($agents as $agent) {
|
||||
$agent_info = get_agent_module_info ($agent["id_agente"]);
|
||||
|
||||
$modulesCell = '<b>'. $agent_info["modules"] . '</b>';
|
||||
if ($agent_info["monitor_alertsfired"] > 0)
|
||||
$modulesCell .= ' : <span class="orange">'.$agent_info["monitor_alertsfired"].'</span>';
|
||||
if ($agent_info["monitor_normal"] > 0)
|
||||
$modulesCell .= '</b> : <span class="green">'.$agent_info["monitor_normal"].'</span>';
|
||||
if ($agent_info["monitor_warning"] > 0)
|
||||
$modulesCell .= ' : <span class="yellow">'.$agent_info["monitor_warning"].'</span>';
|
||||
if ($agent_info["monitor_critical"] > 0)
|
||||
$modulesCell .= ' : <span class="red">'.$agent_info["monitor_critical"].'</span>';
|
||||
if ($agent_info["monitor_unknown"] > 0)
|
||||
$modulesCell .= ' : <span class="grey">'.$agent_info["monitor_unknown"].'</span>';
|
||||
|
||||
if ($agent['disabled']) {
|
||||
$cellName = "<em>" . print_agent_name ($agent["id_agente"], true, "upper") .print_help_tip(__('Disabled'), true) . "</em>";
|
||||
}
|
||||
else {
|
||||
$cellName = print_agent_name ($agent["id_agente"], true, "upper");
|
||||
}
|
||||
|
||||
$last_time = strtotime ($agent["ultimo_contacto"]);
|
||||
$now = time ();
|
||||
$diferencia = $now - $last_time;
|
||||
$time = print_timestamp ($last_time, true);
|
||||
$time_style = $time;
|
||||
if ($diferencia > ($agent["intervalo"] * 2))
|
||||
$time_style = '<b><span style="color: #ff0000">'.$time.'</span></b>';
|
||||
|
||||
array_push($table->data, array(
|
||||
$cellName,
|
||||
print_os_icon ($agent["id_os"], false, true),
|
||||
$agent['intervalo'],
|
||||
print_group_icon ($agent["id_grupo"], true),
|
||||
$modulesCell,
|
||||
$agent_info["status_img"],
|
||||
$agent_info["alert_img"],
|
||||
$time_style));
|
||||
if ($agent['disabled']) {
|
||||
$cellName = "<em>" . print_agent_name ($agent["id_agente"], true, "upper") .print_help_tip(__('Disabled'), true) . "</em>";
|
||||
}
|
||||
else {
|
||||
$cellName = print_agent_name ($agent["id_agente"], true, "upper");
|
||||
}
|
||||
|
||||
echo "<br />";pagination ($totalAgents);
|
||||
print_table ($table); unset($table);
|
||||
pagination ($totalAgents);
|
||||
$last_time = strtotime ($agent["ultimo_contacto"]);
|
||||
$now = time ();
|
||||
$diferencia = $now - $last_time;
|
||||
$time = print_timestamp ($last_time, true);
|
||||
$time_style = $time;
|
||||
if ($diferencia > ($agent["intervalo"] * 2))
|
||||
$time_style = '<b><span style="color: #ff0000">'.$time.'</span></b>';
|
||||
|
||||
$manage_agent = '';
|
||||
if (check_acl ($config['id_user'], $agent['id_grupo'], "AW")) {
|
||||
$manage_agent = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='. $agent["id_agente"] . '">' .
|
||||
'<img title="' . __('Manage') . '" alt="' . __('Manage') . '" src="images/setup.png" /></a>';
|
||||
}
|
||||
|
||||
array_push($table->data, array(
|
||||
$cellName,
|
||||
print_os_icon ($agent["id_os"], false, true),
|
||||
$agent['intervalo'],
|
||||
print_group_icon ($agent["id_grupo"], true),
|
||||
$modulesCell,
|
||||
$agent_info["status_img"],
|
||||
$agent_info["alert_img"],
|
||||
$time_style, $manage_agent));
|
||||
}
|
||||
|
||||
echo "<br />";
|
||||
pagination ($totalAgents);
|
||||
print_table ($table);
|
||||
unset($table);
|
||||
pagination ($totalAgents);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,224 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
global $config;
|
||||
|
||||
$searchModules = check_acl($config['id_user'], 0, "AR");
|
||||
|
||||
$selectModuleNameUp = '';
|
||||
$selectModuleNameDown = '';
|
||||
$selectAgentNameUp = '';
|
||||
$selectAgentNameDown = '';
|
||||
|
||||
switch ($sortField) {
|
||||
case 'module_name':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectModuleNameUp = $selected;
|
||||
$order = array('field' => 'module_name', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectModuleNameDown = $selected;
|
||||
$order = array('field' => 'module_name', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'agent_name':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectAgentNameUp = $selected;
|
||||
$order = array('field' => 'agent_name', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectAgentNameDown = $selected;
|
||||
$order = array('field' => 'agent_name', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$selectModuleNameUp = $selected;
|
||||
$order = array('field' => 'module_name', 'order' => 'ASC');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$modules = false;
|
||||
if ($searchModules) {
|
||||
$chunk_sql = '
|
||||
FROM tagente_modulo AS t1
|
||||
INNER JOIN tagente AS t2
|
||||
ON t2.id_agente = t1.id_agente
|
||||
INNER JOIN tgrupo AS t3
|
||||
ON t3.id_grupo = t2.id_grupo
|
||||
INNER JOIN tagente_estado AS t4
|
||||
ON t4.id_agente_modulo = t1.id_agente_modulo
|
||||
WHERE (t2.id_grupo IN (
|
||||
SELECT id_grupo
|
||||
FROM tusuario_perfil
|
||||
WHERE id_usuario = "' . $config['id_user'] . '"
|
||||
AND id_perfil IN (
|
||||
SELECT id_perfil
|
||||
FROM tperfil WHERE agent_view = 1
|
||||
)
|
||||
)
|
||||
OR 0 IN (
|
||||
SELECT id_grupo
|
||||
FROM tusuario_perfil
|
||||
WHERE id_usuario = "' . $config['id_user'] . '"
|
||||
AND id_perfil IN (
|
||||
SELECT id_perfil
|
||||
FROM tperfil WHERE agent_view = 1
|
||||
)
|
||||
)
|
||||
) AND
|
||||
t1.nombre COLLATE utf8_general_ci LIKE "%' . $stringSearchSQL . '%" OR
|
||||
t3.nombre LIKE "%' . $stringSearchSQL . '%"';
|
||||
|
||||
$select = "SELECT *, t1.nombre AS module_name, t2.nombre AS agent_name ";
|
||||
$limit = " ORDER BY " . $order['field'] . " " . $order['order'] .
|
||||
" LIMIT " . $config['block_size'] . " OFFSET " . get_parameter ('offset',0);
|
||||
|
||||
$modules = get_db_all_rows_sql($select . $chunk_sql . $limit);
|
||||
}
|
||||
|
||||
if (!$modules) {
|
||||
echo "<br><div class='nf'>" . __("Zero results found") . "</div>\n";
|
||||
}
|
||||
else {
|
||||
$totalModules = get_db_all_rows_sql("SELECT COUNT(t1.id_agente_modulo) AS count_modules " . $chunk_sql);
|
||||
$totalModules = $totalModules[0]['count_modules'];
|
||||
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->width = "98%";
|
||||
$table->class = "databox";
|
||||
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('Module') . ' ' .
|
||||
'<a href="index.php?search_category=modules&keywords=' .
|
||||
$config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset .
|
||||
'&sort_field=module_name&sort=up"><img src="images/sort_up.png" style="' . $selectModuleNameUp . '" /></a>' .
|
||||
'<a href="index.php?search_category=modules&keywords=' .
|
||||
$config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset .
|
||||
'&sort_field=module_name&sort=down"><img src="images/sort_down.png" style="' . $selectModuleNameDown . '" /></a>';
|
||||
$table->head[1] = __('Agent') . ' ' .
|
||||
'<a href="index.php?search_category=modules&keywords=' .
|
||||
$config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset .
|
||||
'&sort_field=agent_name&sort=up"><img src="images/sort_up.png" style="' . $selectAgentNameUp . '" /></a>' .
|
||||
'<a href="index.php?search_category=modules&keywords=' .
|
||||
$config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset .
|
||||
'&sort_field=agent_name&sort=down"><img src="images/sort_down.png" style="' . $selectAgentNameDown . '" /></a>';
|
||||
$table->head[2] = __('Type');
|
||||
$table->head[3] = __('Interval');
|
||||
$table->head[4] = __('Status');
|
||||
$table->head[5] = __('Graph');
|
||||
$table->head[6] = __('Data');
|
||||
$table->head[7] = __('Timestamp');
|
||||
|
||||
|
||||
|
||||
$table->align = array ();
|
||||
$table->align[0] = "left";
|
||||
$table->align[1] = "left";
|
||||
$table->align[2] = "center";
|
||||
$table->align[3] = "center";
|
||||
$table->align[4] = "center";
|
||||
$table->align[5] = "center";
|
||||
$table->align[6] = "right";
|
||||
$table->align[7] = "right";
|
||||
|
||||
$table->data = array ();
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$agentCell = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $module['id_agente'] . '">' .
|
||||
$module['agent_name'] . '</a>';
|
||||
|
||||
$typeCell = print_moduletype_icon($module["id_tipo_modulo"], true);
|
||||
|
||||
$intervalCell = ($module['module_interval'] == 0) ? $module['agent_interval'] : $module['intervalo'];
|
||||
|
||||
if($module['utimestamp'] == 0 && (($module['module_type'] < 21 || $module['module_type'] > 23) && $module['module_type'] != 100)){
|
||||
$statusCell = print_status_image(STATUS_MODULE_NO_DATA, __('NOT INIT'), true);
|
||||
}
|
||||
elseif ($module["estado"] == 0) {
|
||||
$statusCell = print_status_image(STATUS_MODULE_OK, __('NORMAL').": ".$module["datos"], true);
|
||||
}
|
||||
elseif ($module["estado"] == 1) {
|
||||
$statusCell = print_status_image(STATUS_MODULE_CRITICAL, __('CRITICAL').": ".$module["datos"], true);
|
||||
}
|
||||
elseif ($module["estado"] == 2) {
|
||||
$statusCell = print_status_image(STATUS_MODULE_WARNING, __('WARNING').": ".$module["datos"], true);
|
||||
}
|
||||
else {
|
||||
$last_status = get_agentmodule_last_status($module['id_agente_modulo']);
|
||||
switch($last_status) {
|
||||
case 0:
|
||||
$statusCell = print_status_image(STATUS_MODULE_OK, __('UNKNOWN')." - ".__('Last status')." ".__('NORMAL').": ".$module["datos"], true);
|
||||
break;
|
||||
case 1:
|
||||
$statusCell = print_status_image(STATUS_MODULE_CRITICAL, __('UNKNOWN')." - ".__('Last status')." ".__('CRITICAL').": ".$module["datos"], true);
|
||||
break;
|
||||
case 2:
|
||||
$statusCell = print_status_image(STATUS_MODULE_WARNING, __('UNKNOWN')." - ".__('Last status')." ".__('WARNING').": ".$module["datos"], true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$graphCell = "";
|
||||
if ($module['history_data'] == 1){
|
||||
|
||||
$graph_type = return_graphtype ($module["id_tipo_modulo"]);
|
||||
|
||||
$name_module_type = get_moduletype_name ($module["id_tipo_modulo"]);
|
||||
$handle = "stat" . $name_module_type . "_" . $module["id_agente_modulo"];
|
||||
$url = 'include/procesos.php?agente=' . $module["id_agente_modulo"];
|
||||
$win_handle = dechex(crc32($module["id_agente_modulo"] . $module["module_name"]));
|
||||
|
||||
$link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$module["id_agente_modulo"]."&label=".$module["module_name"]."&refresh=600','day_".$win_handle."')";
|
||||
|
||||
$graphCell = '<a href="javascript:'.$link.'"><img src="images/chart_curve.png" border="0" alt="" /></a>';
|
||||
$graphCell .= " <a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$module["id_agente"]."&tab=data_view&period=86400&id=".$module["id_agente_modulo"]."'><img src='images/binary.png' border='0' alt='' /></a>";
|
||||
}
|
||||
|
||||
if (is_numeric($module["datos"]))
|
||||
$dataCell = format_numeric($module["datos"]);
|
||||
else
|
||||
$dataCell = "<span title='".$module['datos']."' style='white-space: nowrap;'>".substr(safe_output($module["datos"]),0,12)."</span>";
|
||||
|
||||
if ($module['estado'] == 3){
|
||||
$option = array ("html_attr" => 'class="redb"');
|
||||
} else {
|
||||
$option = array ();
|
||||
}
|
||||
$timestampCell = print_timestamp ($module["utimestamp"], true, $option);
|
||||
|
||||
|
||||
array_push($table->data, array(
|
||||
$module['module_name'],
|
||||
$agentCell,
|
||||
$typeCell,
|
||||
$intervalCell,
|
||||
$statusCell,
|
||||
$graphCell,
|
||||
$dataCell,
|
||||
$timestampCell));
|
||||
}
|
||||
|
||||
echo "<br />";
|
||||
pagination ($totalModules);
|
||||
print_table ($table);
|
||||
unset($table);
|
||||
pagination ($totalModules);
|
||||
}
|
||||
?>
|
|
@ -18,13 +18,13 @@ require_once ("include/functions_reporting.php");
|
|||
// Load enterprise extensions
|
||||
enterprise_include ('operation/reporting/custom_reporting.php');
|
||||
|
||||
$searchAgents = $searchAlerts = check_acl($config['id_user'], 0, "AR");
|
||||
$searchAgents = $searchAlerts = $searchModules = check_acl($config['id_user'], 0, "AR");
|
||||
$searchUsers = check_acl($config['id_user'], 0, "UM");
|
||||
$searchMaps = $searchReports = $searchGraphs = check_acl($config["id_user"], 0, "IR");
|
||||
|
||||
$arrayKeywords = explode(' ', $config['search_keywords']);
|
||||
$temp = array();
|
||||
foreach($arrayKeywords as $keyword)
|
||||
foreach ($arrayKeywords as $keyword)
|
||||
array_push($temp, "%" . safe_input($keyword) . "%");
|
||||
$stringSearchSQL = implode(" ",$temp);
|
||||
|
||||
|
@ -34,10 +34,10 @@ else
|
|||
$searchTab = $config['search_category'];
|
||||
|
||||
//INI SECURITY ACL
|
||||
if((!$searchAgents && !$searchUsers && !$searchMaps) ||
|
||||
if ((!$searchAgents && !$searchUsers && !$searchMaps) ||
|
||||
(!$searchUsers && $searchTab == 'users') ||
|
||||
(!$searchAgents && ($searchTab == 'agents' || $searchTab == 'alerts')) ||
|
||||
(!$searchGraphs && ($searchTab == 'graphs' || $searchTab == 'maps' || $searchTab == 'reports'))){
|
||||
(!$searchGraphs && ($searchTab == 'graphs' || $searchTab == 'maps' || $searchTab == 'reports'))) {
|
||||
|
||||
$searchTab = "";
|
||||
}
|
||||
|
@ -50,51 +50,66 @@ $sortField = get_parameter('sort_field');
|
|||
$sort = get_parameter('sort', 'none');
|
||||
$selected = 'border: 1px solid black;';
|
||||
|
||||
if($searchAgents) {
|
||||
if ($searchAgents) {
|
||||
$agents_tab = array('text' => "<a href='index.php?search_category=agents&keywords=".$config['search_keywords']."&head_search_keywords=Search'>"
|
||||
. print_image ("images/bricks.png", true, array ("title" => __('Agents'))) . "</a>", 'active' => $searchTab == "agents");
|
||||
}else {
|
||||
}
|
||||
else {
|
||||
$agents_tab = '';
|
||||
}
|
||||
|
||||
if($searchUsers) {
|
||||
if ($searchUsers) {
|
||||
$users_tab = array('text' => "<a href='index.php?search_category=users&keywords=".$config['search_keywords']."&head_search_keywords=Search'>"
|
||||
. print_image ("images/group.png", true, array ("title" => __('Users'))) . "</a>", 'active' => $searchTab == "users");
|
||||
}else {
|
||||
}
|
||||
else {
|
||||
$users_tab = '';
|
||||
}
|
||||
|
||||
if($searchAlerts) {
|
||||
if ($searchAlerts) {
|
||||
$alerts_tab = array('text' => "<a href='index.php?search_category=alerts&keywords=".$config['search_keywords']."&head_search_keywords=Search'>"
|
||||
. print_image ("images/god2.png", true, array ("title" => __('Alerts'))) . "</a>", 'active' => $searchTab == "alerts");
|
||||
}else {
|
||||
}
|
||||
else {
|
||||
$alerts_tab = '';
|
||||
}
|
||||
|
||||
if($searchGraphs) {
|
||||
if ($searchGraphs) {
|
||||
$graphs_tab = array('text' => "<a href='index.php?search_category=graphs&keywords=".$config['search_keywords']."&head_search_keywords=Search'>"
|
||||
. print_image ("images/chart_curve.png", true, array ("title" => __('Graphs'))) . "</a>", 'active' => $searchTab == "graphs");
|
||||
}else {
|
||||
}
|
||||
else {
|
||||
$graphs_tab = '';
|
||||
}
|
||||
|
||||
if($searchReports) {
|
||||
if ($searchReports) {
|
||||
$reports_tab = array('text' => "<a href='index.php?search_category=reports&keywords=".$config['search_keywords']."&head_search_keywords=Search'>"
|
||||
. print_image ("images/reporting.png", true, array ("title" => __('Reports'))) . "</a>", 'active' => $searchTab == "reports");
|
||||
}else {
|
||||
}
|
||||
else {
|
||||
$reports_tab = '';
|
||||
}
|
||||
|
||||
if($searchMaps) {
|
||||
if ($searchMaps) {
|
||||
$maps_tab = array('text' => "<a href='index.php?search_category=maps&keywords=".$config['search_keywords']."&head_search_keywords=Search'>"
|
||||
. print_image ("images/camera.png", true, array ("title" => __('Maps'))) . "</a>", 'active' => $searchTab == "maps");
|
||||
}else {
|
||||
}
|
||||
else {
|
||||
$maps_tab = '';
|
||||
}
|
||||
|
||||
if ($searchModules) {
|
||||
$modules_tab = array('text' => "<a href='index.php?search_category=modules&keywords=".$config['search_keywords']."&head_search_keywords=Search'>"
|
||||
. print_image ("images/lightbulb.png", true, array ("title" => __('Modules'))) . "</a>", 'active' => $searchTab == "modules");
|
||||
}
|
||||
else {
|
||||
$modules_tab = '';
|
||||
}
|
||||
|
||||
$onheader = array('agents' => $agents_tab, 'users' => $users_tab,
|
||||
'alerts' => $alerts_tab, 'graphs' => $graphs_tab,
|
||||
'reports' => $reports_tab, 'maps' => $maps_tab);
|
||||
'reports' => $reports_tab, 'maps' => $maps_tab,
|
||||
'modules' => $modules_tab);
|
||||
|
||||
print_page_header (__("Search").": \"".$config['search_keywords']."\"", "images/zoom.png", false, "", false, $onheader);
|
||||
|
||||
|
@ -117,5 +132,8 @@ switch ($searchTab) {
|
|||
case 'maps':
|
||||
require_once('search_maps.php');
|
||||
break;
|
||||
case 'modules':
|
||||
require_once('search_modules.php');
|
||||
break;
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue