mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 17:25:26 +02:00
Refactorize and add two new fields to api_get_groups api function
Former-commit-id: 2d59091279c284d549c09744ee61c8fee1e33564
This commit is contained in:
parent
24260cea34
commit
e316977d4b
@ -283,30 +283,28 @@ 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')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($other['type'] == 'string') {
|
$returnAllGroup = true;
|
||||||
if ($other['data'] != '') {
|
$returnAllColumns = false;
|
||||||
returnError('error_parameter', 'Error in the parameters.');
|
|
||||||
return;
|
if (isset($other['data'][1]))
|
||||||
}
|
$returnAllGroup = ( $other['data'][1] == '1' ? true : false);
|
||||||
else {//Default values
|
|
||||||
$separator = ';';
|
if (isset($other['data'][2]))
|
||||||
}
|
$returnAllColumns = ( $other['data'][2] == '1' ? true : false);
|
||||||
}
|
|
||||||
else if ($other['type'] == 'array') {
|
$groups = users_get_groups ($user_in_db, "IR", $returnAllGroup, $returnAllColumns);
|
||||||
$separator = $other['data'][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
$groups = users_get_groups ($user_in_db, "IR");
|
|
||||||
|
|
||||||
$data_groups = array();
|
$data_groups = array();
|
||||||
foreach ($groups as $id => $group) {
|
foreach ($groups as $id => $group) {
|
||||||
$data_groups[] = array($id, $group);
|
$data_groups[] = array($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;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user