Merge branch '3373-Añadir-opcion-a-mas-parametros-en-api_get_groups' into 'develop'

ent-3373-Añadir-opcion-a-mas-parametros-en-api_get_groups

See merge request artica/pandorafms!2127

Former-commit-id: a614183a0f077c8fb88c5b3eb5e52aa3c31e8e23
This commit is contained in:
Daniel Rodriguez 2019-02-15 14:38:27 +01:00
commit 28472ddc7d

View File

@ -363,31 +363,26 @@ function api_get_test_event_replication_db()
// -------------------------DEFINED OPERATIONS FUNCTIONS----------------- // -------------------------DEFINED OPERATIONS FUNCTIONS-----------------
function api_get_groups($thrash1, $thrash2, $other, $returnType, $user_in_db) function api_get_groups($thrash1, $thrash2, $other, $returnType, $user_in_db)
{ {
if (defined('METACONSOLE')) { $returnAllGroup = true;
return; $returnAllColumns = false;
}
if ($other['type'] == 'string') { if (isset($other['data'][1]))
if ($other['data'] != '') { $returnAllGroup = ( $other['data'][1] == '1' ? true : false);
returnError('error_parameter', 'Error in the parameters.');
return; if (isset($other['data'][2]))
} else { $returnAllColumns = ( $other['data'][2] == '1' ? true : false);
// Default values
$separator = ';';
}
} else if ($other['type'] == 'array') {
$separator = $other['data'][0];
}
$groups = users_get_groups($user_in_db, 'IR'); $groups = users_get_groups ($user_in_db, "IR", $returnAllGroup, $returnAllColumns);
$data_groups = []; $data_groups = array();
foreach ($groups as $id => $group) { foreach ($groups as $id => $group) {
$data_groups[] = [ $data_groups[] = array($id, $group);
$id, }
$group,
]; if (!isset($other['data'][0]))
} $separator = ';'; // by default
else
$separator = $other['data'][0];
$data['type'] = 'array'; $data['type'] = 'array';
$data['data'] = $data_groups; $data['data'] = $data_groups;