Skip to content

Commit

Permalink
Merge pull request #4650 from iszmais/bugfix/unsubscribe_multiple7
Browse files Browse the repository at this point in the history
Filter courses and groups on "right to leave" in unsubscribe multiple view for ILIAS 7
  • Loading branch information
lscharmer authored Jun 21, 2022
2 parents acb9cdc + 2773a35 commit 89065f2
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -513,10 +513,20 @@ public function manageObject()
$top_tb->setLeadingImage(ilUtil::getImagePath('arrow_upright.svg'), $this->lng->txt('actions'));

$button = ilSubmitButton::getInstance();
$grouped_items = $this->blockView->getItemGroups();
if ($this->viewSettings->isSelectedItemsViewActive()) {
$button->setCaption('remove');
} else {
$button->setCaption('pd_unsubscribe_memberships');
foreach ($grouped_items as $group) {
$items = $group->getItems();
$group->setItems([]);
foreach ($items as $item) {
if ($this->rbacsystem->checkAccess('leave', $item['ref_id'])) {
$group->pushItem($item);
}
}
}
}
$button->setCommand('confirmRemove');
$top_tb->addStickyItem($button);
Expand All @@ -528,7 +538,7 @@ public function manageObject()
$bot_tb->addStickyItem($button);
$bot_tb->setOpenFormTag(false);

return $top_tb->getHTML() . $this->renderManageList() . $bot_tb->getHTML();
return $top_tb->getHTML() . $this->renderManageList($grouped_items) . $bot_tb->getHTML();
}

/**
Expand Down Expand Up @@ -822,7 +832,7 @@ protected function getLegacyContent() : string
return $renderer->render($subs);
}

protected function renderManageList() : string
protected function renderManageList(array $grouped_items) : string
{
$ui = $this->ui;

Expand All @@ -849,11 +859,7 @@ protected function renderManageList() : string
}
}

$grouped_items = $this->blockView->getItemGroups();

$renderer = new ilDashObjectsTableRenderer($this);

return $renderer->render($grouped_items);
return (new ilDashObjectsTableRenderer($this))->render($grouped_items);
}

/**
Expand Down

0 comments on commit 89065f2

Please sign in to comment.