19 declare(strict_types=1);
60 $this->rbacsystem = $DIC->rbac()->system();
62 $this->obj_definition = $DIC[
"objDefinition"];
63 $this->
access = $DIC->access();
64 $this->
ui = $DIC->ui();
65 $this->
http = $DIC->http();
67 $this->objectService = $DIC->object();
69 $this->tree = $DIC->repositoryTree();
70 $this->logging = $DIC->logger()->root();
74 $this->
lng = $DIC->language();
75 $this->
ctrl = $DIC->ctrl();
76 $this->
user = $DIC->user();
78 $this->
lng->loadLanguageModule(
'pd');
79 $this->
lng->loadLanguageModule(
'cntr');
80 $this->
lng->loadLanguageModule(
'rep');
84 $this->allow_moving =
false;
89 if ($this->viewSettings->isTilePresentation()) {
95 $params = $DIC->http()->request()->getQueryParams();
96 $this->requested_item_ref_id = (
int) (
$params[
"item_ref_id"] ?? 0);
106 $this->viewSettings->parse();
110 $this->
ctrl->setParameter($this,
'view', $this->viewSettings->getCurrentView());
121 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"rep_added_to_favourites"),
true);
127 $this->
ctrl->setParameterByClass(
'ildashboardgui',
'view', $this->viewSettings->getCurrentView());
128 $this->
ctrl->redirectByClass(
'ildashboardgui',
'show');
133 $this->
lng->loadLanguageModule(
"rep");
135 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"rep_removed_from_favourites"),
true);
141 return static::$block_type;
151 return $this->blockView->getTitle();
160 $DIC->database()->useSlave(
true);
166 $this->
ctrl->clearParameters($this);
168 $DIC->database()->useSlave(
false);
170 return parent::getHTML();
175 $next_class = $this->
ctrl->getNextClass();
176 $cmd = $this->
ctrl->getCmd(
'getHTML');
178 switch ($next_class) {
179 case 'ilcommonactiondispatchergui':
181 $this->
ctrl->forwardCommand($gui);
185 if (method_exists($this, $cmd)) {
186 return $this->$cmd();
188 return $this->{$cmd .
'Object'}();
200 $this->content = $a_content;
208 $this->tpl->setVariable(
'BLOCK_ROW', $this->
getContent());
217 $sortingCommands = [];
218 $sortings = $this->viewSettings->getSelectableSortingModes();
219 $effectiveSorting = $this->viewSettings->getEffectiveSortingMode();
220 foreach ($sortings as $sorting) {
221 $this->
ctrl->setParameter($this,
'sorting', $sorting);
222 $sortingCommands[] = [
223 'txt' => $this->
lng->txt(
'dash_sort_by_' . $sorting),
224 'url' => $this->
ctrl->getLinkTarget($this,
'changePDItemSorting'),
225 'xxxasyncUrl' => $this->
ctrl->getLinkTarget($this,
'changePDItemSorting',
'',
true),
226 'active' => $sorting === $effectiveSorting,
228 $this->
ctrl->setParameter($this,
'sorting', null);
231 if (count($sortingCommands) > 1) {
232 $commandGroups[] = $sortingCommands;
236 return $commandGroups;
239 $presentationCommands = [];
240 $presentations = $this->viewSettings->getSelectablePresentationModes();
241 $effectivePresentation = $this->viewSettings->getEffectivePresentationMode();
243 $this->
ctrl->setParameter($this,
'presentation', $presentation);
244 $presentationCommands[] = [
245 'txt' => $this->
lng->txt(
'pd_presentation_mode_' . $presentation),
246 'url' => $this->
ctrl->getLinkTarget($this,
'changePDItemPresentation'),
247 'xxxasyncUrl' => $this->
ctrl->getLinkTarget($this,
'changePDItemPresentation',
'',
true),
248 'active' => $presentation === $effectivePresentation,
250 $this->
ctrl->setParameter($this,
'presentation', null);
253 if (count($presentationCommands) > 1) {
254 $commandGroups[] = $presentationCommands;
259 'txt' => $this->viewSettings->isSelectedItemsViewActive() ?
260 $this->
lng->txt(
'pd_remove_multiple') :
261 $this->
lng->txt(
'pd_unsubscribe_multiple_memberships'),
262 'url' => $this->
ctrl->getLinkTarget($this,
'manage'),
268 return $commandGroups;
273 $this->viewSettings->storeActorPresentationMode(
281 $this->viewSettings->storeActorSortingMode(
292 if ($this->
ctrl->isAsynch()) {
302 $this->blockView->setIsInManageMode(
true);
305 $top_tb->setFormAction($this->
ctrl->getFormAction($this));
309 $grouped_items = $this->blockView->getItemGroups();
310 if ($this->viewSettings->isSelectedItemsViewActive()) {
311 $button->setCaption(
'remove');
313 $button->setCaption(
'pd_unsubscribe_memberships');
314 foreach ($grouped_items as $group) {
315 $items = $group->getItems();
316 $group->setItems([]);
317 foreach ($items as $item) {
318 if ($this->rbacsystem->checkAccess(
'leave', $item[
'ref_id'])) {
320 $item[
'type'] !==
'crs' ||
323 $group->pushItem($item);
329 $button->setCommand(
'confirmRemove');
330 $top_tb->addStickyItem($button);
332 $top_tb->setCloseFormTag(
false);
336 $bot_tb->addStickyItem($button);
337 $bot_tb->setOpenFormTag(
false);
339 return $top_tb->getHTML() . $this->
renderManageList($grouped_items) . $bot_tb->getHTML();
344 $this->
ctrl->returnToParent($this);
349 $this->
ctrl->setParameter($this,
'view', $this->viewSettings->getCurrentView());
351 $refIds = (array) ($this->
http->request()->getParsedBody()[
'id'] ?? []);
352 if (0 === count($refIds)) {
353 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
354 $this->
ctrl->redirect($this,
'manage');
357 if ($this->viewSettings->isSelectedItemsViewActive()) {
358 $question = $this->
lng->txt(
'dash_info_sure_remove_from_favs');
359 $cmd =
'confirmedRemove';
361 $question = $this->
lng->txt(
'mmbr_info_delete_sure_unsubscribe');
362 $cmd =
'confirmedUnsubscribe';
366 $cgui->setHeaderText($question);
368 $cgui->setFormAction($this->
ctrl->getFormAction($this));
369 $cgui->setCancel($this->
lng->txt(
'cancel'),
'manage');
370 $cgui->setConfirm($this->
lng->txt(
'confirm'), $cmd);
382 $this->
lng->txt(
'icon') .
' ' . $this->
lng->txt(
'obj_' .
$type)
386 return $cgui->getHTML();
391 $refIds = (array) ($this->
http->request()->getParsedBody()[
'ref_id'] ?? []);
392 if (0 === count($refIds)) {
393 $this->
ctrl->redirect($this,
'manage');
397 $this->favourites->remove($this->
user->getId(), (
int) $ref_id);
400 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'pd_remove_multi_confirm'),
true);
401 $this->
ctrl->redirect($this,
'manage');
406 $refIds = $this->
http->wrapper()->post()->retrieve(
410 if (0 === count($refIds)) {
411 $this->
ctrl->redirect($this,
'manage');
415 if ($this->
access->checkAccess(
'leave',
'', (
int) $ref_id)) {
419 $members->delete($this->
user->getId());
421 $members->sendUnsubscribeNotificationToAdmins($this->
user->getId());
422 $members->sendNotification(
430 $members->delete($this->
user->getId());
432 $members->sendNotification(
436 $members->sendNotification(
450 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'mmbr_unsubscribed_from_objs'),
true);
451 $this->
ctrl->returnToParent($this);
459 $groupedItems = $this->blockView->getItemGroups();
461 foreach ($groupedCommands as $group) {
462 foreach ($group as $command) {
463 $asynch_url = $command[
'asyncUrl'] ??
"";
465 (
string) $command[
'url'],
466 (
string) $command[
'txt'],
475 foreach ($groupedItems as $group) {
478 foreach ($group->getItems() as $item) {
480 $itemListGUI = $this->list_factory->byType($item[
'type']);
485 $this->logging->warning(
'Listing failed for item with ID ' . $item[
'obj_id'] .
': ' . $e->getMessage());
489 if (count($list_items) > 0) {
490 $item_groups[] = $this->
ui->factory()->item()->group($group->getLabel(), $list_items);
499 $itemListGui = $this->list_factory->byType($data[
'type']);
502 $list_item = $itemListGui->getAsListItem(
503 (
int) $data[
'ref_id'],
504 (
int) $data[
'obj_id'],
505 (
string) $data[
'type'],
506 (
string) $data[
'title'],
507 (
string) $data[
'description']
515 $itemListGui = $this->list_factory->byType($item[
'type']);
518 $card = $itemListGui->getAsCard(
519 (
int) $item[
'ref_id'],
520 (
int) $item[
'obj_id'],
521 (
string) $item[
'type'],
522 (
string) $item[
'title'],
523 (
string) $item[
'description']
532 foreach ($groupedCommands as $group) {
533 foreach ($group as $command) {
534 $asynch_url = $command[
'asyncUrl'] ??
"";
536 (
string) $command[
'url'],
537 (
string) $command[
'txt'],
543 $groupedItems = $this->blockView->getItemGroups();
546 foreach ($groupedItems as $group) {
549 foreach ($group->getItems() as $item) {
553 $this->logging->warning(
'Listing failed for item with ID ' . $item[
'obj_id'] .
': ' . $e->getMessage());
557 if (count($cards) > 0) {
558 $subs[] = $this->
ui->factory()->panel()->sub(
560 $this->
ui->factory()->deck($cards)->withNormalCardsSize()
565 if (count($subs) > 0) {
566 return $this->
ui->renderer()->render($subs);
576 $this->
ctrl->setParameter($this,
"manage",
"1");
578 foreach ($groupedCommands as $group) {
579 foreach ($group as $command) {
581 (
string) $command[
'url'],
582 (
string) $command[
'txt'],
583 (
string) ($command[
'asyncUrl'] ??
"")
588 if (is_array($groupedCommands[0])) {
589 $actions = array_map(
static function ($item) use (
$ui) {
590 return $ui->factory()->link()->standard($item[
"txt"], $item[
"url"]);
591 }, $groupedCommands[0]);
592 if (count($actions) > 0) {
593 $dd = $this->
ui->factory()->dropdown()->standard($actions);
594 $this->main_tpl->setHeaderActionMenu(
$ui->renderer()->render($dd));
603 $txt = $this->
lng->txt(
"rep_fav_intro1") .
"<br>";
605 $this->
lng->txt(
'rep_fav_intro2'),
608 $txt .= $this->
lng->txt(
"rep_fav_intro3");
609 $mbox = $this->
ui->factory()->messageBox()->info(
$txt);
611 return $this->
ui->renderer()->render($mbox);
616 $nd = $this->tree->getNodeData($this->tree->getRootId());
removeFromDeskObject()
Remove from desktop public.
ilPDSelectedItemsBlockListGUIFactory $list_factory
ilPDSelectedItemsBlockViewSettings $viewSettings
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TYPE_NOTIFICATION_UNSUBSCRIBE
ilPDSelectedItemsBlockViewGUI $blockView
getListItemForData(array $data)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
setDataSection(string $a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
renderManageList(array $grouped_items)
getCardForData(array $item)
setEnableNumInfo(bool $a_enablenuminfo)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static getInstance(int $a_ref_id)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static string $block_type
ilObjectService $objectService
ilObjectDefinition $obj_definition
int $requested_item_ref_id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_content)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
parses the objects.xml it handles the xml-description of all ilias objects
static http()
Fetches the global http state from ILIAS.
changePDItemPresentation()
static _lookupTitle(int $obj_id)
static bySettings(ilPDSelectedItemsBlockViewSettings $viewSettings)
Common interface to all items.
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
Get static link.
addToDeskObject()
Add desktop item public.
static _lookupObjectId(int $ref_id)
static addListGUIActivationProperty(ilObjectListGUI $list_gui, array &$item)
Get timing details for list gui.
const TYPE_UNSUBSCRIBE_MEMBER
getGroupedCommandsForView(bool $manage=false)
ilFavouritesManager $favourites
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilPDSelectedItemsBlockGUI: ilColumnGUI ilPDSelectedItemsBlockGUI: ilCommonActionDispatcherGUI ...
__construct(Container $dic, ilPlugin $plugin)
setTitle(string $a_title)
This class represents a block method of a block.
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
static _lookupType(int $id, bool $reference=false)
const VIEW_SELECTED_ITEMS
const TYPE_UNSUBSCRIBE_MEMBER
setPresentation(int $type)
static checkForumsExistsDelete(int $ref_id, int $user_id)
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...