19declare(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());
120 $this->favourites->add($this->
user->getId(), $this->requested_item_ref_id);
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");
134 $this->favourites->remove($this->
user->getId(), $this->requested_item_ref_id);
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();
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),
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(
276 $this->initAndShow();
281 $this->viewSettings->storeActorSortingMode(
285 $this->initAndShow();
290 $this->initViewSettings();
292 if ($this->
ctrl->isAsynch()) {
293 echo $this->getHTML();
297 $this->returnToContext();
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(
408 $this->
refinery->to()->listOf($this->refinery->kindlyTo()->int())
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();
460 $groupedCommands = $this->getGroupedCommandsForView();
461 foreach ($groupedCommands as $group) {
462 foreach ($group as $command) {
463 $asynch_url = $command[
'asyncUrl'] ??
"";
464 $this->addBlockCommand(
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']);
483 $list_items[] = $this->getListItemForData($item);
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']
531 $groupedCommands = $this->getGroupedCommandsForView();
532 foreach ($groupedCommands as $group) {
533 foreach ($group as $command) {
534 $asynch_url = $command[
'asyncUrl'] ??
"";
535 $this->addBlockCommand(
536 (
string) $command[
'url'],
537 (
string) $command[
'txt'],
543 $groupedItems = $this->blockView->getItemGroups();
546 foreach ($groupedItems as $group) {
549 foreach ($group->getItems() as $item) {
551 $cards[] = $this->getCardForData($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);
569 return $this->getNoItemFoundContent();
576 $this->
ctrl->setParameter($this,
"manage",
"1");
577 $groupedCommands = $this->getGroupedCommandsForView(
true);
578 foreach ($groupedCommands as $group) {
579 foreach ($group as $command) {
580 $this->addBlockCommand(
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'),
606 $this->getRepositoryTitle()
608 $txt .= $this->
lng->txt(
"rep_fav_intro3");
609 $mbox = $this->
ui->factory()->messageBox()->info(
$txt);
610 $mbox = $mbox->withLinks([$this->
ui->factory()->link()->standard($this->getRepositoryTitle(),
ilLink::_getStaticLink(1,
'root',
true))]);
611 return $this->
ui->renderer()->render($mbox);
616 $nd = $this->tree->getNodeData($this->tree->getRootId());
617 $title =
$nd[
'title'];
619 if ($title ===
'ILIAS') {
620 $title = $this->
lng->txt(
'repository');
Customizing of pimple-DIC for ILIAS.
This class represents a block method of a block.
setDataSection(string $a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
setTitle(string $a_title)
setPresentation(int $type)
setEnableNumInfo(bool $a_enablenuminfo)
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...
const TYPE_UNSUBSCRIBE_MEMBER
Class ilCtrl provides processing control methods.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static checkForumsExistsDelete(int $ref_id, int $user_id)
const TYPE_UNSUBSCRIBE_MEMBER
const TYPE_NOTIFICATION_UNSUBSCRIBE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
Get static link.
Component logger with individual log levels by component id.
static addListGUIActivationProperty(ilObjectListGUI $list_gui, array &$item)
Get timing details for list gui.
parses the objects.xml it handles the xml-description of all ilias objects
static _lookupObjectId(int $ref_id)
static _lookupType(int $id, bool $reference=false)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
@ilCtrl_IsCalledBy ilPDSelectedItemsBlockGUI: ilColumnGUI @ilCtrl_Calls ilPDSelectedItemsBlockGUI: il...
int $requested_item_ref_id
removeFromDeskObject()
Remove from desktop @access public.
ilPDSelectedItemsBlockViewGUI $blockView
getListItemForData(array $data)
Get list item for data array.
ilObjectService $objectService
getGroupedCommandsForView(bool $manage=false)
getCardForData(array $item)
fillDataSection()
Standard implementation for row based data.
ilPDSelectedItemsBlockViewSettings $viewSettings
isRepositoryObject()
Returns whether block has a corresponding repository object.
static string $block_type
getLegacyContent()
Get legacy content.
setContent(string $a_content)
ilObjectDefinition $obj_definition
ilPDSelectedItemsBlockListGUIFactory $list_factory
addToDeskObject()
Add desktop item @access public.
changePDItemPresentation()
ilFavouritesManager $favourites
renderManageList(array $grouped_items)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static bySettings(ilPDSelectedItemsBlockViewSettings $viewSettings)
static getInstance(int $a_ref_id)
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
Common interface to all items.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const VIEW_SELECTED_ITEMS
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
standard()
This is an example, of how the Notification Slate is generated by assigning Notification Items to it.