Skip to content

Commit

Permalink
OrgU: 44453, get _all_ orgus for getOrgUnitsByUserAndPosition
Browse files Browse the repository at this point in the history
  • Loading branch information
nhaagen committed Mar 4, 2025
1 parent 110d007 commit 668a856
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -15,6 +16,7 @@
*
********************************************************************
*/

declare(strict_types=1);

use ILIAS\UI\Component\Table;
Expand Down Expand Up @@ -346,9 +348,8 @@ public function getOrgUnitsByUserAndPosition(int $user_id, int $position_id, boo
$recursive_orgu_ids = [];
$tree = ilObjOrgUnitTree::_getInstance();
foreach ($orgu_ids as $orgu_id) {
$recursive_orgu_ids = $recursive_orgu_ids + $tree->getAllChildren($orgu_id);
$recursive_orgu_ids = array_merge($recursive_orgu_ids, $tree->getAllChildren($orgu_id));
}

return $recursive_orgu_ids;
}

Expand Down Expand Up @@ -425,13 +426,13 @@ protected function getUserDataByOrgUnitsAndPosition(
;
$res = $this->db->query($query);

if($count_only) {
if ($count_only) {
return $this->db->numRows($res);
}

$users = [];
while ($rec = $this->db->fetchAssoc($res)) {
$rec['active'] = (bool)$rec['active'];
$rec['active'] = (bool) $rec['active'];
$users[] = $rec;
}
return $users;
Expand Down Expand Up @@ -459,7 +460,7 @@ public function getRows(
$lp_visible = $additional_parameters['lp_visible_ref_ids'];

foreach ($this->getUserDataByOrgUnitsAndPosition($orgu_ids, $position_id, false, $range, $order) as $record) {
$row_id = implode('_', [(string)$position_id, (string)$record['usr_id']]);
$row_id = implode('_', [(string) $position_id, (string) $record['usr_id']]);
yield $row_builder->buildDataRow($row_id, $record)
->withDisabledAction(
'show_learning_progress',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -15,6 +16,7 @@
*
********************************************************************
*/

declare(strict_types=1);

use ILIAS\UI\Component\Table;
Expand Down Expand Up @@ -336,10 +338,10 @@ public function getRows(
?array $additional_parameters
): \Generator {
foreach ($this->getAllPositions($range, $order) as $pos) {
$row_id = (string)$pos->getId();
$row_id = (string) $pos->getId();
$record = [
'title' => $pos->getTitle(),
'description' => $pos->getDescription() . 'dd',
'description' => $pos->getDescription(),
'authorities' => implode("<br>", $this->getAuthorityDescription($pos->getAuthorities())),
'is_core_position' => $pos->isCorePosition(),
];
Expand Down

0 comments on commit 668a856

Please sign in to comment.