Return IDs set from "get_operator_group_ids" function

This commit is contained in:
Dmitriy Simushev 2014-10-30 13:49:16 +00:00
parent 146c4b7ac1
commit 38bc096444
2 changed files with 9 additions and 6 deletions

View File

@ -68,9 +68,7 @@ class GroupsController extends AbstractController
// Get IDs of groups the operator belongs to.
$checked_groups = array();
if ($op) {
foreach (get_operator_group_ids($op_id) as $rel) {
$checked_groups[] = $rel['groupid'];
}
$checked_groups = get_operator_group_ids($op_id);
}
// Get all available groups

View File

@ -635,13 +635,18 @@ function get_sorted_groups($order)
function get_operator_group_ids($operator_id)
{
$db = Database::getInstance();
return $db->query(
$rows = Database::getInstance()->query(
"SELECT groupid FROM {operatortoopgroup} WHERE operatorid = ?",
array($operator_id),
array('return_rows' => Database::RETURN_ALL_ROWS)
);
$groups = array();
foreach ($rows as $row) {
$groups[] = $row['groupid'];
}
return $groups;
}
function get_operators_from_adjacent_groups($operator)