2011-09-23 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_api.php: added the code for the return the more
	criticity event in the API call "get_events".



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4995 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-09-23 20:46:33 +00:00
parent ed5c6c7ed4
commit d15f65d04c
2 changed files with 23 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2011-09-23 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php: added the code for the return the more
criticity event in the API call "get_events".
2011-09-23 Sancho Lerena <slerena@artica.es> 2011-09-23 Sancho Lerena <slerena@artica.es>
* pandoradb_data.sql: Update version and DB Build. * pandoradb_data.sql: Update version and DB Build.

View File

@ -942,7 +942,16 @@ function otherParameter2Filter($other, $array = false) {
if (isset($other['data'][10]) && ($other['data'][10] != null)) { if (isset($other['data'][10]) && ($other['data'][10] != null)) {
if ($array) { if ($array) {
$filter['total'] = true; $filter['total'] = false;
$filter['more_criticity'] = false;
if ($other['data'][10] == 'total') {
$filter['total'] = true;
}
if ($other['data'][10] == 'more_criticity') {
$filter['more_criticity'] = true;
}
} }
else { else {
@ -951,6 +960,7 @@ function otherParameter2Filter($other, $array = false) {
else { else {
if ($array) { if ($array) {
$filter['total'] = false; $filter['total'] = false;
$filter['more_criticity'] = false;
} }
else { else {
@ -1634,6 +1644,11 @@ function get_events__with_user($trash1, $trash2, $other, $returnType, $user_in_d
FROM tevento FROM tevento
WHERE 1=1 ".$sql_post; WHERE 1=1 ".$sql_post;
} }
else if ($filter['more_criticity']) {
$sql = "SELECT criticity
FROM tevento
WHERE 1=1 ".$sql_post." ORDER BY criticity DESC LIMIT 1";
}
else { else {
$sql = "SELECT *, $sql = "SELECT *,
(SELECT t1.nombre FROM tagente AS t1 WHERE t1.id_agente = tevento.id_agente) AS agent_name, (SELECT t1.nombre FROM tagente AS t1 WHERE t1.id_agente = tevento.id_agente) AS agent_name,
@ -1722,11 +1737,11 @@ function get_events__with_user($trash1, $trash2, $other, $returnType, $user_in_d
else if ($other['type'] == 'array') { else if ($other['type'] == 'array') {
$separator = $other['data'][0]; $separator = $other['data'][0];
} }
//html_debug_print($filter, true);
$result = db_get_all_rows_sql ($sql); $result = db_get_all_rows_sql ($sql);
//html_debug_print($sql); //html_debug_print($sql);
if (($result !== false) && (!$filter['total'])) { if (($result !== false) && (!$filter['total']) && (!$filter['more_criticity'])) {
//Add the description and image //Add the description and image
foreach ($result as $key => $row) { foreach ($result as $key => $row) {
//FOR THE TEST THE API IN THE ANDROID //FOR THE TEST THE API IN THE ANDROID