19 declare(strict_types=1);
91 $this->rbacsystem = $DIC->rbac()->system();
93 $this->obj_definition = $DIC[
"objDefinition"];
94 $this->access = $DIC->access();
95 $this->
ui = $DIC->ui();
96 $this->
http = $DIC->http();
97 $this->objectService = $DIC->object();
99 $this->tree = $DIC->repositoryTree();
103 $this->lng = $DIC->language();
104 $this->ctrl = $DIC->ctrl();
105 $this->
user = $DIC->user();
107 $this->lng->loadLanguageModule(
'pd');
108 $this->lng->loadLanguageModule(
'cntr');
109 $this->lng->loadLanguageModule(
'rep');
113 $this->allow_moving =
false;
117 if ($this->viewSettings->isTilePresentation()) {
122 $this->main_content =
true;
135 $this->viewSettings->parse();
139 $this->ctrl->setParameter($this,
'view', $this->viewSettings->getCurrentView());
164 $this->favourites->add($this->
user->getId(), (int)
$_GET[
"item_ref_id"]);
165 ilUtil::sendSuccess($this->lng->txt(
"rep_added_to_favourites"),
true);
176 $this->ctrl->setParameterByClass(
'ildashboardgui',
'view', $this->viewSettings->getCurrentView());
177 $this->ctrl->redirectByClass(
'ildashboardgui',
'show');
185 $this->lng->loadLanguageModule(
"rep");
186 $this->favourites->remove($this->
user->getId(), (int)
$_GET[
"item_ref_id"]);
187 ilUtil::sendSuccess($this->lng->txt(
"rep_removed_from_favourites"),
true);
196 return static::$block_type;
205 if ($cmd ==
'post') {
207 $cmd = array_shift(array_keys($cmd));
211 case 'confirmRemove':
234 return $this->blockView->getTitle();
246 $DIC->database()->useSlave(
true);
265 $this->ctrl->clearParameters($this);
267 $DIC->database()->useSlave(
false);
269 return parent::getHTML();
277 $next_class = $this->ctrl->getNextClass();
278 $cmd = $this->ctrl->getCmd(
'getHTML');
280 switch ($next_class) {
281 case 'ilcommonactiondispatchergui':
282 include_once(
'Services/Object/classes/class.ilCommonActionDispatcherGUI.php');
284 $this->ctrl->forwardCommand($gui);
288 if (method_exists($this, $cmd)) {
289 return $this->$cmd();
291 return $this->{$cmd .
'Object'}();
320 $this->tpl->setVariable(
'BLOCK_ROW', $this->
getContent());
346 $sortingCommands = [];
347 $sortings = $this->viewSettings->getSelectableSortingModes();
348 $effectiveSorting = $this->viewSettings->getEffectiveSortingMode();
350 foreach ($sortings as $sorting) {
351 $this->ctrl->setParameter($this,
'sorting', $sorting);
352 $sortingCommands[] = [
353 'txt' => $this->lng->txt(
'dash_sort_by_' . $sorting),
354 'url' => $this->ctrl->getLinkTarget($this,
'changePDItemSorting'),
355 'xxxasyncUrl' => $this->ctrl->getLinkTarget($this,
'changePDItemSorting',
'',
true),
356 'active' => $sorting === $effectiveSorting,
358 $this->ctrl->setParameter($this,
'sorting', null);
361 if (count($sortingCommands) > 1) {
362 $commandGroups[] = $sortingCommands;
366 return $commandGroups;
369 $presentationCommands = [];
370 $presentations = $this->viewSettings->getSelectablePresentationModes();
371 $effectivePresentation = $this->viewSettings->getEffectivePresentationMode();
374 $this->ctrl->setParameter($this,
'presentation', $presentation);
375 $presentationCommands[] = [
376 'txt' => $this->lng->txt(
'pd_presentation_mode_' . $presentation),
377 'url' => $this->ctrl->getLinkTarget($this,
'changePDItemPresentation'),
378 'xxxasyncUrl' => $this->ctrl->getLinkTarget($this,
'changePDItemPresentation',
'',
true),
379 'active' => $presentation === $effectivePresentation,
381 $this->ctrl->setParameter($this,
'presentation', null);
384 if (count($presentationCommands) > 1) {
385 $commandGroups[] = $presentationCommands;
390 'txt' => $this->viewSettings->isSelectedItemsViewActive() ?
391 $this->lng->txt(
'pd_remove_multiple') :
392 $this->lng->txt(
'pd_unsubscribe_multiple_memberships'),
393 'url' => $this->ctrl->getLinkTarget($this,
'manage'),
399 return $commandGroups;
413 if ($this->blockView->isInManageMode()) {
419 foreach ($groupedCommands as $group) {
420 foreach ($group as $command) {
437 if (0 === count($grouped_items)) {
443 if ($this->viewSettings->isTilePresentation()) {
446 $this->
ui->factory(),
447 $this->
ui->renderer(),
455 return $renderer->
render($grouped_items, $showHeader);
460 $this->
ui->factory(),
461 $this->
ui->renderer(),
469 return $renderer->
render($grouped_items, $showHeader);
478 $this->blockView->getItemGroups()
487 $this->viewSettings->storeActorPresentationMode(
498 $this->viewSettings->storeActorSortingMode(
512 if ($this->ctrl->isAsynch()) {
517 if (
$_GET[
"manage"]) {
518 $this->ctrl->redirect($this,
'manage');
526 $this->blockView->setIsInManageMode(
true);
529 $top_tb->setFormAction($this->ctrl->getFormAction($this));
530 $top_tb->setLeadingImage(
ilUtil::getImagePath(
'arrow_upright.svg'), $this->lng->txt(
'actions'));
533 $grouped_items = $this->blockView->getItemGroups();
534 if ($this->viewSettings->isSelectedItemsViewActive()) {
535 $button->setCaption(
'remove');
537 $button->setCaption(
'pd_unsubscribe_memberships');
538 foreach ($grouped_items as $group) {
539 $items = $group->getItems();
540 $group->setItems([]);
541 foreach ($items as $item) {
542 if ($this->rbacsystem->checkAccess(
'leave', $item[
'ref_id'])) {
544 $item[
'type'] !==
'crs' ||
547 $group->pushItem($item);
553 $button->setCommand(
'confirmRemove');
554 $top_tb->addStickyItem($button);
556 $top_tb->setCloseFormTag(
false);
559 $bot_tb->setLeadingImage(
ilUtil::getImagePath(
'arrow_downright.svg'), $this->lng->txt(
'actions'));
560 $bot_tb->addStickyItem($button);
561 $bot_tb->setOpenFormTag(
false);
563 return $top_tb->getHTML() . $this->
renderManageList($grouped_items) . $bot_tb->getHTML();
574 $this->ctrl->returnToParent($this);
580 $this->ctrl->setParameter($this,
'view', $this->viewSettings->getCurrentView());
582 $refIds = (array) ($this->
http->request()->getParsedBody()[
'id'] ?? []);
583 if (0 === count($refIds)) {
585 $this->ctrl->redirect($this,
'manage');
588 if ($this->viewSettings->isSelectedItemsViewActive()) {
589 $question = $this->lng->txt(
'dash_info_sure_remove_from_favs');
590 $cmd =
'confirmedRemove';
592 $question = $this->lng->txt(
'mmbr_info_delete_sure_unsubscribe');
593 $cmd =
'confirmedUnsubscribe';
596 include_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
598 $cgui->setHeaderText($question);
600 $cgui->setFormAction($this->ctrl->getFormAction($this));
601 $cgui->setCancel($this->lng->txt(
'cancel'),
'manage');
602 $cgui->setConfirm($this->lng->txt(
'confirm'), $cmd);
604 foreach ($refIds as $ref_id) {
613 ilObject::_getIcon($obj_id,
'small',
$type),
614 $this->lng->txt(
'icon') .
' ' . $this->lng->txt(
'obj_' .
$type)
618 return $cgui->getHTML();
623 $refIds = (array) ($this->
http->request()->getParsedBody()[
'ref_id'] ?? []);
624 if (0 === count($refIds)) {
625 $this->ctrl->redirect($this,
'manage');
628 foreach ($refIds as $ref_id) {
629 $this->favourites->remove($this->
user->getId(), $ref_id);
633 ilUtil::sendSuccess($this->lng->txt(
'pd_remove_multi_confirm'),
true);
634 $this->ctrl->redirect($this,
'manage');
639 $refIds = (array) ($this->
http->request()->getParsedBody()[
'ref_id'] ?? []);
640 if (0 === count($refIds)) {
641 $this->ctrl->redirect($this,
'manage');
644 foreach ($refIds as $ref_id) {
645 if ($this->access->checkAccess(
'leave',
'', (
int) $ref_id)) {
650 $members->delete($this->
user->getId());
652 $members->sendUnsubscribeNotificationToAdmins($this->
user->getId());
653 $members->sendNotification(
654 $members->NOTIFY_UNSUBSCRIBE,
662 $members->delete($this->
user->getId());
664 $members->sendNotification(
668 $members->sendNotification(
679 include_once
'./Modules/Forum/classes/class.ilForumNotification.php';
684 ilUtil::sendSuccess($this->lng->txt(
'mmbr_unsubscribed_from_objs'),
true);
685 $this->ctrl->returnToParent($this);
709 $groupedItems = $this->blockView->getItemGroups();
711 foreach ($groupedCommands as $group) {
712 foreach ($group as $command) {
714 (
string) $command[
'url'],
715 (
string) $command[
'txt'],
716 (
string) $command[
'asyncUrl']
728 foreach ($groupedItems as $group) {
731 foreach ($group->getItems() as $item) {
733 $itemListGUI = $this->list_factory->byType($item[
'type']);
741 if (count($list_items) > 0) {
742 $item_groups[] =
$factory->item()->group((
string) $group->getLabel(), $list_items);
769 $listFactory = $this->list_factory;
772 $itemListGui = $listFactory->byType($item[
'type']);
775 $list_item = $itemListGui->getAsListItem(
776 (
int) $item[
'ref_id'],
777 (
int) $item[
'obj_id'],
778 (
string) $item[
'type'],
779 (
string) $item[
'title'],
780 (
string) $item[
'description']
791 $listFactory = $this->list_factory;
794 $itemListGui = $listFactory->byType($item[
'type']);
797 $card = $itemListGui->getAsCard(
798 (
int) $item[
'ref_id'],
799 (
int) $item[
'obj_id'],
800 (
string) $item[
'type'],
801 (
string) $item[
'title'],
802 (
string) $item[
'description']
813 $renderer = $this->
ui->renderer();
819 foreach ($groupedCommands as $group) {
820 foreach ($group as $command) {
822 (
string) $command[
'url'],
823 (
string) $command[
'txt'],
824 (
string) $command[
'asyncUrl']
829 $groupedItems = $this->blockView->getItemGroups();
832 foreach ($groupedItems as $group) {
835 foreach ($group->getItems() as $item) {
837 $itemListGUI = $this->list_factory->byType($item[
'type']);
840 $cards[] = $this->getCardForData($item);
845 if (count($cards) > 0) {
848 $factory->deck($cards)->withNormalCardsSize()
854 return $renderer->render($subs);
861 $this->ctrl->setParameter($this,
"manage",
"1");
863 foreach ($groupedCommands as $group) {
864 foreach ($group as $command) {
866 (
string) $command[
'url'],
867 (
string) $command[
'txt'],
868 (
string) $command[
'asyncUrl']
874 if (is_array($groupedCommands[0])) {
875 $actions = array_map(
function ($item) use (
$ui) {
876 return $ui->factory()->link()->standard($item[
"txt"], $item[
"url"]);
877 }, $groupedCommands[0]);
878 if (count($actions) > 0) {
879 $dd = $this->
ui->factory()->dropdown()->standard($actions);
880 $this->main_tpl->setHeaderActionMenu(
$ui->renderer()->render($dd));
895 $txt = $this->lng->txt(
"rep_fav_intro1") .
"<br>";
897 $this->lng->txt(
'rep_fav_intro2'),
900 $txt .= $this->lng->txt(
"rep_fav_intro3");
901 $mbox = $this->
ui->factory()->messageBox()->info(
$txt);
903 return $this->
ui->renderer()->render($mbox);
911 $nd = $this->tree->getNodeData($this->tree->getRootId());
915 $title = $this->lng->txt(
'repository');
removeFromDeskObject()
Remove from desktop public.
Dashboard objects table renderer.
returnToContext()
Return to context.
const TYPE_NOTIFICATION_UNSUBSCRIBE
__construct()
ilPDSelectedItemsBlockGUI constructor.
Class ilPDSelectedItemsListRenderer.
changePDItemSorting()
Called if the user interacted with the provided presentation options.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
renderManageList(array $grouped_items)
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
getViewTitle()
Get view title.
static _lookupTitle($a_id)
lookup object title
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
Class ilPDSelectedItemsBlockListGUIFactory.
Manages favourites, currently the interface for other components, needs discussion.
getNoItemFoundContent()
No item entry.
setContent(string $a_content)
static _lookupObjectId($a_ref_id)
lookup object id
static getInstance($a_ref_id)
Get instance by ref_id.
static http()
Fetches the global http state from ILIAS.
changePDItemPresentation()
Called if the user interacted with the provided sorting options.
setTitle($a_title)
Set Title.
getListItemForData(array $data)
Get list item for data array.
static bySettings(ilPDSelectedItemsBlockViewSettings $viewSettings)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getListItemGroups()
Get items.
setData($a_data)
Set Data.
static _lookupObjId($a_id)
Common interface to all items.
addToDeskObject()
Add desktop item public.
Class ilPDObjectsTileRenderer.
const TYPE_UNSUBSCRIBE_MEMBER
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
render(array $groupedItems, bool $showHeader)
static addListGUIActivationProperty(ilObjectListGUI $a_list_gui, array &$a_item)
Get timing details for list gui.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static checkForumsExistsDelete($ref_id, $user_id=0)
render(array $groupedItems, bool $showHeader)
setLimit($a_limit)
Set Limit.
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
BlockGUI class for Selected Items on Personal Desktop.
__construct(Container $dic, ilPlugin $plugin)
This class represents a block method of a block.
getGroupedCommandsForView($manage=false)
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
Add Block Command.
renderGroupedItems(array $grouped_items, $showHeader=true)
const VIEW_SELECTED_ITEMS
setPresentation(int $type)
Set presentation.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Confirmation screen class.
initViewSettings()
Evaluates the view settings of this block.