From 354f1d9b2f5466e516caac5f8e688ef15c60f57d Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 26 Sep 2011 14:29:55 +0000 Subject: [PATCH] 2011-09-26 Miguel de Dios * include/functions_api.php: added the call "get_events" the filters for the free text in event description and status of event. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5007 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 +++ pandora_console/include/functions_api.php | 40 ++++++++++++++++++----- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b500582c5a..cf593d036d 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2011-09-26 Miguel de Dios + + * include/functions_api.php: added the call "get_events" the filters for the + free text in event description and status of event. + 2011-09-26 Sancho Lerena * pandora_console/index.php: Developer mode disabled. diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 319cb4ede6..7b2bb46f91 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -922,34 +922,52 @@ function otherParameter2Filter($other, $array = false) { } } - if ($other['data'][8] != null) { + if (($other['data'][8] != null) && ($other['data'][8] != -1)) { if ($array) { - $filter['limit'] = $other['data'][8]; + $filter['estado'] = $other['data'][8]; } else { - $filterString .= ' LIMIT ' . $other['data'][8]; + $filterString .= ' AND estado = ' . $other[8]; } } - if ($other['data'][9] != null) { + if (($other['data'][9] != null) && ($other['data'][9] != "")) { if ($array) { - $filter['offset'] = $other['data'][9]; + $filter['evento'] = $other['data'][9]; } else { - $filterString .= ' OFFSET ' . $other['data'][9]; + $filterString .= ' AND evento like "%' . $other[9] . '%"'; } } - if (isset($other['data'][10]) && ($other['data'][10] != null)) { + if ($other['data'][10] != null) { + if ($array) { + $filter['limit'] = $other['data'][10]; + } + else { + $filterString .= ' LIMIT ' . $other['data'][10]; + } + } + + if ($other['data'][11] != null) { + if ($array) { + $filter['offset'] = $other['data'][11]; + } + else { + $filterString .= ' OFFSET ' . $other['data'][11]; + } + } + + if (isset($other['data'][12]) && ($other['data'][12] != null)) { if ($array) { $filter['total'] = false; $filter['more_criticity'] = false; - if ($other['data'][10] == 'total') { + if ($other['data'][12] == 'total') { $filter['total'] = true; } - if ($other['data'][10] == 'more_criticity') { + if ($other['data'][12] == 'more_criticity') { $filter['more_criticity'] = true; } } @@ -1563,6 +1581,10 @@ function get_events__with_user($trash1, $trash2, $other, $returnType, $user_in_d $id_alert_am = $filter['id_alert_am']; if (isset($filter['id_usuario'])) $id_user_ack = $filter['id_usuario']; + if (isset($filter['estado'])) + $status = $filter['estado']; + if (isset($filter['evento'])) + $search = $filter['evento']; if (isset($filter['limit'])) $pagination = $filter['limit']; if (isset($filter['offset']))