ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilContainerContentGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5
17{
21 protected $tpl;
22
26 protected $ctrl;
27
31 protected $user;
32
36 protected $lng;
37
41 protected $access;
42
46 protected $plugin_admin;
47
51 protected $db;
52
56 protected $rbacsystem;
57
61 protected $settings;
62
66 protected $obj_definition;
67
69 const DETAILS_TITLE = 1;
70 const DETAILS_ALL = 2;
71
72 const VIEW_MODE_LIST = 0;
73 const VIEW_MODE_TILE = 1;
74
76
80 protected $renderer;
81
84
88 protected $log;
89
93 protected $view_mode;
94
99 public function __construct(&$container_gui_obj)
100 {
101 global $DIC;
102
103 $this->tpl = $DIC["tpl"];
104 $this->ctrl = $DIC->ctrl();
105 $this->user = $DIC->user();
106 $this->lng = $DIC->language();
107 $this->access = $DIC->access();
108 $this->plugin_admin = $DIC["ilPluginAdmin"];
109 $this->db = $DIC->database();
110 $this->rbacsystem = $DIC->rbac()->system();
111 $this->settings = $DIC->settings();
112 $this->obj_definition = $DIC["objDefinition"];
113 $tpl = $DIC["tpl"];
114
115 $this->container_gui = $container_gui_obj;
116 $this->container_obj = $this->container_gui->object;
117
118 $tpl->addJavaScript("./Services/Container/js/Container.js");
119
120 $this->log = ilLoggerFactory::getLogger('cont');
121
122 $this->view_mode = (ilContainer::_lookupContainerSetting($this->container_obj->getId(), "list_presentation") == "tile" && !$this->container_gui->isActiveAdministrationPanel() && !$this->container_gui->isActiveOrdering())
123 ? self::VIEW_MODE_TILE
124 : self::VIEW_MODE_LIST;
125 }
126
130 protected function getViewMode()
131 {
132 return $this->view_mode;
133 }
134
135
143 protected function getDetailsLevel($a_item_id)
144 {
146 }
147
153 public function getContainerObject()
154 {
156 }
157
163 public function getContainerGUI()
164 {
166 }
167
174 public function setOutput()
175 {
178
179 // note: we do not want to get the center html in case of
180 // asynchronous calls to blocks in the right column (e.g. news)
181 // see #13012
182 if ($ilCtrl->getNextClass() == "ilcolumngui" &&
183 $ilCtrl->isAsynch()) {
184 $tpl->setRightContent($this->getRightColumnHTML());
185 }
186
187 // BEGIN ChangeEvent: record read event.
188 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
190
191 $obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
193 $this->getContainerObject()->getType(),
194 $this->getContainerObject()->getRefId(),
195 $obj_id,
196 $ilUser->getId()
197 );
198 // END ChangeEvent: record read event.
199
200 $html = $this->getCenterColumnHTML();
201 if (strlen($html)) {
202 $tpl->setContent($html);
203 }
204
205 // see above, all other cases (this was the old position of setRightContent,
206 // maybe the position above is ok and all ifs can be removed)
207 if ($ilCtrl->getNextClass() != "ilcolumngui" ||
208 !$ilCtrl->isAsynch()) {
209 $tpl->setRightContent($this->getRightColumnHTML());
210 }
211 }
212
216 protected function getRightColumnHTML()
217 {
221 $ilAccess = $this->access;
222 $ilPluginAdmin = $this->plugin_admin;
223
224 $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
225
226 $obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
227 $obj_type = ilObject::_lookupType($obj_id);
228
229 include_once("Services/Block/classes/class.ilColumnGUI.php");
230 $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
231
232 if ($column_gui->getScreenMode() == IL_SCREEN_FULL) {
233 return "";
234 }
235
236 $this->getContainerGUI()->setColumnSettings($column_gui);
237
238 if ($ilCtrl->getNextClass() == "ilcolumngui" &&
239 $column_gui->getCmdSide() == IL_COL_RIGHT &&
240 $column_gui->getScreenMode() == IL_SCREEN_SIDE) {
241 $html = $ilCtrl->forwardCommand($column_gui);
242 } else {
243 $render_content = ($ilCtrl->getNextClass() == "" &&
244 in_array($ilCtrl->getCmd(), ["view", "render"]));
245 $render_content = false;
246 if (!$ilCtrl->isAsynch() || $render_content) {
247 $html = "";
248
249 // user interface plugin slot + default rendering
250 include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
251 $uip = new ilUIHookProcessor(
252 "Services/Container",
253 "right_column",
254 array("container_content_gui" => $this)
255 );
256 if (!$uip->replaced()) {
257 $html = $ilCtrl->getHTML($column_gui);
258 }
259 $html = $uip->getHTML($html);
260 }
261 }
262
263 return $html;
264 }
265
269 protected function getCenterColumnHTML()
270 {
274
275 $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
276
277 $tpl->addOnLoadCode("il.Object.setRedrawListItemUrl('" .
278 $ilCtrl->getLinkTarget($this->container_gui, "redrawListItem", "", true) . "');");
279
280 $tpl->addOnLoadCode("il.Object.setRatingUrl('" .
281 $ilCtrl->getLinkTargetByClass(
282 array(get_class($this->container_gui), "ilcommonactiondispatchergui", "ilratinggui"),
283 "saveRating",
284 "",
285 true,
286 false
287 ) . "');");
288
289 switch ($ilCtrl->getNextClass()) {
290 case "ilcolumngui":
291 $this->container_gui->setSideColumnReturn();
292 $html = $this->__forwardToColumnGUI();
293 break;
294
295 default:
296 $ilDB->useSlave(true);
297 $html = $this->getMainContent();
298 $ilDB->useSlave(false);
299 break;
300 }
301
302 return $html;
303 }
304
309 abstract public function getMainContent();
310
314 protected function initRenderer()
315 {
316 include_once('./Services/Container/classes/class.ilContainerSorting.php');
317 $sorting = ilContainerSorting::_getInstance($this->getContainerObject()->getId());
318
319 include_once "Services/Container/classes/class.ilContainerRenderer.php";
320 $this->renderer = new ilContainerRenderer(
321 ($this->getContainerGUI()->isActiveAdministrationPanel() && !$_SESSION["clipboard"]),
322 $this->getContainerGUI()->isMultiDownloadEnabled(),
323 $this->getContainerGUI()->isActiveOrdering() && (get_class($this) != "ilContainerObjectiveGUI") // no block sorting in objective view
324 ,
325 $sorting->getBlockPositions(),
326 $this->container_gui,
327 $this->getViewMode()
328 );
329 }
330
334 private function __forwardToColumnGUI()
335 {
337 $ilAccess = $this->access;
338
339 include_once("Services/Block/classes/class.ilColumnGUI.php");
340
341 // this gets us the subitems we need in setColumnSettings()
342 // todo: this should be done in ilCourseGUI->getSubItems
343
344 $obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
345 $obj_type = ilObject::_lookupType($obj_id);
346
347 if (!$ilCtrl->isAsynch()) {
348 //if ($column_gui->getScreenMode() != IL_SCREEN_SIDE)
350 // right column wants center
352 $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
353 $this->getContainerGUI()->setColumnSettings($column_gui);
354 $html = $ilCtrl->forwardCommand($column_gui);
355 }
356 // left column wants center
358 $column_gui = new ilColumnGUI($obj_type, IL_COL_LEFT);
359 $this->getContainerGUI()->setColumnSettings($column_gui);
360 $html = $ilCtrl->forwardCommand($column_gui);
361 }
362 } else {
363 $html = $this->getMainContent();
364 }
365 }
366
367 return $html;
368 }
369
374 {
375 $this->adminCommands = false;
376 }
377
381 protected function determineAdminCommands($a_ref_id, $a_admin_com_included_in_list = false)
382 {
384
385 //echo "-".$a_admin_com_included_in_list."-";
386
387 if (!$this->adminCommands) {
388 if (!$this->getContainerGUI()->isActiveAdministrationPanel()) {
389 if ($rbacsystem->checkAccess("delete", $a_ref_id)) {
390 $this->adminCommands = true;
391 }
392 } else {
393 $this->adminCommands = $a_admin_com_included_in_list;
394 }
395 }
396 }
397
401 protected function getItemGUI($item_data, $a_show_path = false)
402 {
403 include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
404
405 // get item list gui object
406 if (!is_object($this->list_gui[$item_data["type"]])) {
407 $item_list_gui = &ilObjectListGUIFactory::_getListGUIByType($item_data["type"]);
408 $item_list_gui->setContainerObject($this->getContainerGUI());
409 $this->list_gui[$item_data["type"]] = &$item_list_gui;
410 } else {
411 $item_list_gui = &$this->list_gui[$item_data["type"]];
412 }
413
414 // unique js-ids
415 $item_list_gui->setParentRefId($item_data["parent"]);
416
417 $item_list_gui->setDefaultCommandParameters(array());
418 $item_list_gui->disableTitleLink(false);
419 $item_list_gui->resetConditionTarget();
420
421 if ($this->container_obj->isClassificationFilterActive()) {
422 $item_list_gui->enablePath(
423 true,
424 $this->container_obj->getRefId(),
426 );
427 }
428
429 // show administration command buttons (or not)
430 if (!$this->getContainerGUI()->isActiveAdministrationPanel()) {
431 // $item_list_gui->enableDelete(false);
432// $item_list_gui->enableLink(false);
433// $item_list_gui->enableCut(false);
434 }
435
436 // activate common social commands
437 $item_list_gui->enableComments(true);
438 $item_list_gui->enableNotes(true);
439 $item_list_gui->enableTags(true);
440 $item_list_gui->enableRating(true);
441
442 // reset
443 $item_list_gui->forceVisibleOnly(false);
444
445 // container specific modifications
446 $this->getContainerGUI()->modifyItemGUI($item_list_gui, $item_data, $a_show_path);
447
448 return $item_list_gui;
449 }
450
454 public function determinePageEmbeddedBlocks($a_container_page_html)
455 {
456 $type_grps = $this->getGroupedObjTypes();
457
458 // iterate all types
459 foreach ($type_grps as $type => $v) {
460 // set template (overall or type specific)
461 if (is_int(strpos($a_container_page_html, "[list-" . $type . "]"))) {
462 $this->addEmbeddedBlock("type", $type);
463 }
464 }
465
466 // determine item groups
467 while (preg_match('~\[(item-group-([0-9]*))\]~i', $a_container_page_html, $found)) {
468 $this->addEmbeddedBlock("itgr", (int) $found[2]);
469
470 $a_container_page_html = preg_replace('~\[' . $found[1] . '\]~i', $html, $a_container_page_html);
471 }
472 }
473
479 public function addEmbeddedBlock($block_type, $block_parameter)
480 {
481 $this->embedded_block[$block_type][] = $block_parameter;
482 }
483
487 public function getEmbeddedBlocks()
488 {
489 return $this->embedded_block;
490 }
491
495 public function renderPageEmbeddedBlocks()
496 {
498
499 // item groups
500 if (is_array($this->embedded_block["itgr"])) {
501 $item_groups = array();
502 if (is_array($this->items["itgr"])) {
503 foreach ($this->items["itgr"] as $ig) {
504 $item_groups[$ig["ref_id"]] = $ig;
505 }
506 }
507
508 foreach ($this->embedded_block["itgr"] as $ref_id) {
509 if (isset($item_groups[$ref_id])) {
510 $this->renderItemGroup($item_groups[$ref_id]);
511 }
512 }
513 }
514
515 // type specific blocks
516 if (is_array($this->embedded_block["type"])) {
517 foreach ($this->embedded_block["type"] as $k => $type) {
518 if (is_array($this->items[$type]) &&
519 $this->renderer->addTypeBlock($type)) {
520 // :TODO: obsolete?
521 if ($type == 'sess') {
522 $this->items['sess'] = ilUtil::sortArray($this->items['sess'], 'start', 'ASC', true, true);
523 }
524
525 $position = 1;
526
527 foreach ($this->items[$type] as $k => $item_data) {
528 if (!$this->renderer->hasItem($item_data["child"])) {
529 $html = $this->renderItem($item_data, $position++);
530 if ($html != "") {
531 $this->renderer->addItemToBlock($type, $item_data["type"], $item_data["child"], $html);
532 }
533 }
534 }
535 }
536 }
537 }
538 }
539
548 public function renderItem($a_item_data, $a_position = 0, $a_force_icon = false, $a_pos_prefix = "")
549 {
551 $ilAccess = $this->access;
553
554 // Pass type, obj_id and tree to checkAccess method to improve performance
555 if (!$ilAccess->checkAccess('visible', '', $a_item_data['ref_id'], $a_item_data['type'], $a_item_data['obj_id'], $a_item_data['tree'])) {
556 return '';
557 }
558
559 if ($this->getViewMode() == self::VIEW_MODE_TILE) {
560 return $this->renderCard($a_item_data, $a_position, $a_force_icon, $a_pos_prefix);
561 }
562
563 $item_list_gui = $this->getItemGUI($a_item_data);
564 if ($ilSetting->get("icon_position_in_lists") == "item_rows" ||
565 $a_item_data["type"] == "sess" || $a_force_icon) {
566 $item_list_gui->enableIcon(true);
567 }
568
569 if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$_SESSION["clipboard"]) {
570 $item_list_gui->enableCheckbox(true);
571 } elseif ($this->getContainerGUI()->isMultiDownloadEnabled()) {
572 // display multi download checkboxes
573 $item_list_gui->enableDownloadCheckbox($a_item_data["ref_id"], true);
574 }
575
576 if ($this->getContainerGUI()->isActiveItemOrdering() && ($a_item_data['type'] != 'sess' || get_class($this) != 'ilContainerSessionsContentGUI')) {
577 $item_list_gui->setPositionInputField(
578 $a_pos_prefix . "[" . $a_item_data["ref_id"] . "]",
579 sprintf('%d', (int) $a_position * 10)
580 );
581 }
582
583 if ($a_item_data['type'] == 'sess' and get_class($this) != 'ilContainerObjectiveGUI') {
584 switch ($this->getDetailsLevel($a_item_data['obj_id'])) {
586 $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_MINIMAL);
587 $item_list_gui->enableExpand(true);
588 $item_list_gui->setExpanded(false);
589 $item_list_gui->enableDescription(false);
590 $item_list_gui->enableProperties(true);
591 break;
592
594 $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_ALL);
595 $item_list_gui->enableExpand(true);
596 $item_list_gui->setExpanded(true);
597 $item_list_gui->enableDescription(true);
598 $item_list_gui->enableProperties(true);
599 break;
600
601 default:
602 $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_ALL);
603 $item_list_gui->enableExpand(true);
604 $item_list_gui->enableDescription(true);
605 $item_list_gui->enableProperties(true);
606 break;
607 }
608 }
609
610 if (method_exists($this, "addItemDetails")) {
611 $this->addItemDetails($item_list_gui, $a_item_data);
612 }
613
614 // show subitems
615 if ($a_item_data['type'] == 'sess' and (
616 $this->getDetailsLevel($a_item_data['obj_id']) != self::DETAILS_TITLE or
617 $this->getContainerGUI()->isActiveAdministrationPanel() or
618 $this->getContainerGUI()->isActiveItemOrdering()
619 )
620 ) {
621 $pos = 1;
622
623 include_once('./Services/Container/classes/class.ilContainerSorting.php');
624 include_once('./Services/Object/classes/class.ilObjectActivation.php');
625 $items = ilObjectActivation::getItemsByEvent($a_item_data['obj_id']);
626 $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('sess', $a_item_data['obj_id'], $items);
628
629 $item_readable = $ilAccess->checkAccess('read', '', $a_item_data['ref_id']);
630
631 foreach ($items as $item) {
632 // TODO: this should be removed and be handled by if(strlen($sub_item_html))
633 // see mantis: 0003944
634 if (!$ilAccess->checkAccess('visible', '', $item['ref_id'])) {
635 continue;
636 }
637
638 $item_list_gui2 = $this->getItemGUI($item);
639 $item_list_gui2->enableIcon(true);
640 $item_list_gui2->enableItemDetailLinks(false);
641
642 // unique js-ids
643 $item_list_gui2->setParentRefId($a_item_data['ref_id']);
644
645 // @see mantis 10488
646 if (!$item_readable and !$ilAccess->checkAccess('write', '', $item['ref_id'])) {
647 $item_list_gui2->forceVisibleOnly(true);
648 }
649
650 if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$_SESSION["clipboard"]) {
651 $item_list_gui2->enableCheckbox(true);
652 } elseif ($this->getContainerGUI()->isMultiDownloadEnabled()) {
653 // display multi download checkbox
654 $item_list_gui2->enableDownloadCheckbox($item['ref_id'], true);
655 }
656
657 if ($this->getContainerGUI()->isActiveItemOrdering()) {
658 $item_list_gui2->setPositionInputField(
659 "[sess][" . $a_item_data['obj_id'] . "][" . $item["ref_id"] . "]",
660 sprintf('%d', (int) $pos * 10)
661 );
662 $pos++;
663 }
664
665 // #10611
667
668 $sub_item_html = $item_list_gui2->getListItemHTML(
669 $item['ref_id'],
670 $item['obj_id'],
671 $item['title'],
672 $item['description']
673 );
674
675 $this->determineAdminCommands($item["ref_id"], $item_list_gui2->adminCommandsIncluded());
676 if (strlen($sub_item_html)) {
677 $item_list_gui->addSubItemHTML($sub_item_html);
678 }
679 }
680 }
681
682
683 if ($ilSetting->get("item_cmd_asynch")) {
684 $asynch = true;
685 $ilCtrl->setParameter($this->container_gui, "cmdrefid", $a_item_data['ref_id']);
686 $asynch_url = $ilCtrl->getLinkTarget(
687 $this->container_gui,
688 "getAsynchItemList",
689 "",
690 true,
691 false
692 );
693 $ilCtrl->setParameter($this->container_gui, "cmdrefid", "");
694 }
695
696 include_once "Services/Object/classes/class.ilObjectActivation.php";
697 ilObjectActivation::addListGUIActivationProperty($item_list_gui, $a_item_data);
698
699 $html = $item_list_gui->getListItemHTML(
700 $a_item_data['ref_id'],
701 $a_item_data['obj_id'],
702 $a_item_data['title'],
703 $a_item_data['description'],
704 $asynch,
705 false,
706 $asynch_url
707 );
709 $a_item_data["ref_id"],
710 $item_list_gui->adminCommandsIncluded()
711 );
712
713
714 return $html;
715 }
716
725 public function renderCard($a_item_data, $a_position = 0, $a_force_icon = false, $a_pos_prefix = "")
726 {
727 global $DIC;
728 $f = $DIC->ui()->factory();
729 $user = $DIC->user();
730
731 $item_list_gui = $this->getItemGUI($a_item_data);
732 $item_list_gui->setAjaxHash(ilCommonActionDispatcherGUI::buildAjaxHash(
734 $a_item_data['ref_id'],
735 $a_item_data['type'],
736 $a_item_data['obj_id']
737 ));
738 $item_list_gui->initItem(
739 $a_item_data['ref_id'],
740 $a_item_data['obj_id'],
741 $a_item_data['type'],
742 $a_item_data['title'],
743 $a_item_data['description']
744 );
745
746 // actions
747 $item_list_gui->insertCommands();
748 return $item_list_gui->getAsCard(
749 $a_item_data['ref_id'],
750 (int) $a_item_data['obj_id'],
751 (string) $a_item_data['type'],
752 (string) $a_item_data['title'],
753 (string) $a_item_data['description']
754 );
755 }
756
760 public function insertPageEmbeddedBlocks($a_output_html)
761 {
762 $this->determinePageEmbeddedBlocks($a_output_html);
763 $this->renderPageEmbeddedBlocks($this->items);
764
765 // iterate all types
766 foreach ($this->getGroupedObjTypes() as $type => $v) {
767 // set template (overall or type specific)
768 if (is_int(strpos($a_output_html, "[list-" . $type . "]"))) {
769 $a_output_html = preg_replace(
770 '~\[list-' . $type . '\]~i',
771 $this->renderer->renderSingleTypeBlock($type),
772 $a_output_html
773 );
774 }
775 }
776
777 // insert all item groups
778 while (preg_match('~\[(item-group-([0-9]*))\]~i', $a_output_html, $found)) {
779 $itgr_ref_id = (int) $found[2];
780
781 $a_output_html = preg_replace(
782 '~\[' . $found[1] . '\]~i',
783 $this->renderer->renderSingleCustomBlock($itgr_ref_id),
784 $a_output_html
785 );
786 }
787
788 return $a_output_html;
789 }
790
798 {
799 $this->initRenderer();
800 // get all sub items
801 $this->items = $this->getContainerObject()->getSubItems(
802 $this->getContainerGUI()->isActiveAdministrationPanel()
803 );
804
805
806 $ref_ids = array_map(function ($i) {
807 $parts = explode("_", $i);
808 return $parts[2];
809 }, $_POST["ids"]);
810
811 // iterate all types
812 if (is_array($this->items[$type]) &&
813 $this->renderer->addTypeBlock($type)) {
814 //$this->renderer->setBlockPosition($type, ++$pos);
815
816 $position = 1;
817 foreach ($this->items[$type] as $item_data) {
818 $item_ref_id = $item_data["child"];
819
820 if (in_array($item_ref_id, $ref_ids)) {
821 continue;
822 }
823
824 if ($this->block_limit > 0 && $position == $this->block_limit + 1) {
825 if ($position == $this->block_limit + 1) {
826 // render more button
827 $this->renderer->addShowMoreButton($type);
828 }
829 continue;
830 }
831
832 if (!$this->renderer->hasItem($item_ref_id)) {
833 $html = $this->renderItem($item_data, $position++);
834 if ($html != "") {
835 $this->renderer->addItemToBlock($type, $item_data["type"], $item_ref_id, $html);
836 }
837 }
838 }
839 }
840
841 return $this->renderer->renderSingleTypeBlock($type);
842 }
843
849 public function getGroupedObjTypes()
850 {
851 $objDefinition = $this->obj_definition;
852
853 if (empty($this->type_grps)) {
854 $this->type_grps =
855 $objDefinition->getGroupedRepositoryObjectTypes($this->getContainerObject()->getType());
856 }
857 return $this->type_grps;
858 }
859
863 public function getIntroduction()
864 {
868
869 $lng->loadLanguageModule("rep");
870
871 $tpl = new ilTemplate("tpl.rep_intro.html", true, true, "Services/Repository");
872 $tpl->setVariable("IMG_REP_LARGE", ilObject::_getIcon("", "big", "root"));
873 $tpl->setVariable("TXT_WELCOME", $lng->txt("rep_intro"));
874 $tpl->setVariable("TXT_INTRO_1", $lng->txt("rep_intro1"));
875 $tpl->setVariable("TXT_INTRO_2", $lng->txt("rep_intro2"));
876 $tpl->setVariable("TXT_INTRO_3", sprintf($lng->txt("rep_intro3"), $lng->txt("add")));
877 $tpl->setVariable("TXT_INTRO_4", sprintf($lng->txt("rep_intro4"), $lng->txt("cat_add")));
878 $tpl->setVariable("TXT_INTRO_5", $lng->txt("rep_intro5"));
879 $tpl->setVariable("TXT_INTRO_6", $lng->txt("rep_intro6"));
880
881 return $tpl->get();
882 }
883
890 public function getItemGroupsHTML($a_pos = 0)
891 {
892 if (is_array($this->items["itgr"])) {
893 foreach ($this->items["itgr"] as $itgr) {
894 if (!$this->renderer->hasCustomBlock($itgr["child"])) {
895 $this->renderItemGroup($itgr);
896
897 $this->renderer->setBlockPosition($itgr["ref_id"], ++$a_pos);
898 }
899 }
900 }
901 return $a_pos;
902 }
903
910 public function renderItemGroup($a_itgr)
911 {
912 $ilAccess = $this->access;
914
915 // #16493
916 $perm_ok = ($ilAccess->checkAccess("visible", "", $a_itgr['ref_id']) &&
917 $ilAccess->checkAccess("read", "", $a_itgr['ref_id']));
918
919 include_once('./Services/Container/classes/class.ilContainerSorting.php');
920 include_once('./Services/Object/classes/class.ilObjectActivation.php');
921 $items = ilObjectActivation::getItemsByItemGroup($a_itgr['ref_id']);
922
923 // get all valid ids (this is filtered)
924 $all_ids = array_map(function($i) {
925 return $i["child"];
926 }, $this->items["_all"]);
927
928 // remove filtered items
929 $items = array_filter($items, function ($i) use ($all_ids) {
930 return in_array($i["ref_id"], $all_ids);
931 });
932
933 // if no permission is given, set the items to "rendered" but
934 // do not display the whole block
935 if (!$perm_ok) {
936 foreach ($items as $item) {
937 $this->renderer->hideItem($item["child"]);
938 }
939 return;
940 }
941
942 $item_list_gui = $this->getItemGUI($a_itgr);
943 $item_list_gui->enableNotes(false);
944 $item_list_gui->enableTags(false);
945 $item_list_gui->enableComments(false);
946 $item_list_gui->enableTimings(false);
947 $item_list_gui->getListItemHTML(
948 $a_itgr["ref_id"],
949 $a_itgr["obj_id"],
950 $a_itgr["title"],
951 $a_itgr["description"]
952 );
953 $commands_html = $item_list_gui->getCommandsHTML();
954
955 // determine behaviour
956 include_once("./Modules/ItemGroup/classes/class.ilObjItemGroup.php");
957 include_once("./Modules/ItemGroup/classes/class.ilItemGroupBehaviour.php");
958 $beh = ilObjItemGroup::lookupBehaviour($a_itgr["obj_id"]);
959 include_once("./Services/Container/classes/class.ilContainerBlockPropertiesStorage.php");
960 $stored_val = ilContainerBlockPropertiesStorage::getProperty("itgr_" . $a_itgr["ref_id"], $ilUser->getId(), "opened");
961 if ($stored_val !== false && $beh != ilItemGroupBehaviour::ALWAYS_OPEN) {
962 $beh = ($stored_val == "1")
965 }
966
967 $data = array(
968 "behaviour" => $beh,
969 "store-url" => "./ilias.php?baseClass=ilcontainerblockpropertiesstorage&cmd=store" .
970 "&cont_block_id=itgr_" . $a_itgr['ref_id']
971 );
972 if (ilObjItemGroup::lookupHideTitle($a_itgr["obj_id"]) &&
973 !$this->getContainerGUI()->isActiveAdministrationPanel()) {
974 $this->renderer->addCustomBlock($a_itgr["ref_id"], "", $commands_html, $data);
975 } else {
976 $this->renderer->addCustomBlock($a_itgr["ref_id"], $a_itgr["title"], $commands_html, $data);
977 }
978
979
980 // render item group sub items
981
983 $this->getContainerObject()->getId()
984 )->sortSubItems('itgr', $a_itgr['obj_id'], $items);
985
986 // #18285
988
989 $position = 1;
990 foreach ($items as $item) {
991 // we are NOT using hasItem() here, because item might be in multiple item groups
992 $html2 = $this->renderItem($item, $position++, false, "[itgr][" . $a_itgr['obj_id'] . "]");
993 if ($html2 != "") {
994 // :TODO: show it multiple times?
995 $this->renderer->addItemToBlock($a_itgr["ref_id"], $item["type"], $item["child"], $html2, true);
996 }
997 }
998 }
999}
user()
Definition: user.php:4
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
const IL_SCREEN_SIDE
const IL_COL_RIGHT
const IL_SCREEN_FULL
const IL_COL_LEFT
static _recordReadEvent( $a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
Column user interface class.
static getScreenMode()
Get Screen Mode for current command.
static getCmdSide()
Get Column Side of Current Command.
static buildAjaxHash( $a_node_type, $a_node_id, $a_obj_type, $a_obj_id, $a_sub_type=null, $a_sub_id=null, $a_news_id=0)
Build ajax hash.
static getProperty($a_block_id, $a_user_id, $a_property)
Get property in session or db.
Parent class of all container content GUIs.
initRenderer()
Init container renderer.
getEmbeddedBlocks()
Get page embedded blocks.
getContainerObject()
Get container object.
getSingleTypeBlockAsynch($type)
Render single block.
getContainerGUI()
Get container GUI object.
getCenterColumnHTML()
Get HTML for center column.
renderItem($a_item_data, $a_position=0, $a_force_icon=false, $a_pos_prefix="")
Render an item.
setOutput()
Sets view output into column layout.
__forwardToColumnGUI()
Get columngui output.
getRightColumnHTML()
Get HTML for right column.
getGroupedObjTypes()
Get grouped repository object types.
addEmbeddedBlock($block_type, $block_parameter)
Add embedded block.
insertPageEmbeddedBlocks($a_output_html)
Insert blocks into container page.
getMainContent()
Get content HTML for main column, this one must be overwritten in derived classes.
getDetailsLevel($a_item_id)
get details level
getItemGroupsHTML($a_pos=0)
Get item groups HTML.
renderPageEmbeddedBlocks()
Render Page Embedded Blocks.
renderItemGroup($a_itgr)
Render item group.
getItemGUI($item_data, $a_show_path=false)
Get ListGUI object for item.
__construct(&$container_gui_obj)
Constructor.
renderCard($a_item_data, $a_position=0, $a_force_icon=false, $a_pos_prefix="")
Render card.
determineAdminCommands($a_ref_id, $a_admin_com_included_in_list=false)
determin admin commands
determinePageEmbeddedBlocks($a_container_page_html)
Determine all blocks that are embedded in the container page.
clearAdminCommandsDetermination()
cleaer administration commands determination
Class ilContainerRenderer.
static _getInstance($a_obj_id)
get instance by obj_id
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
static getCompleteDescriptions(array $objects)
overwrites description fields to long or short description in an assoc array keys needed (obj_id and ...
static getLogger($a_component_id)
Get component logger.
static lookupBehaviour($a_id)
Lookup behaviour.
static lookupHideTitle($a_id)
Lookup hide title.
static addListGUIActivationProperty(ilObjectListGUI $a_list_gui, array &$a_item)
Get timing details for list gui.
static getItemsByEvent($a_event_id)
Get session material / event items.
static getItemsByItemGroup($a_item_group_ref_id)
Get materials of item group.
static _getListGUIByType($a_type, $a_context=ilObjectListGUI::CONTEXT_REPOSITORY)
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
PathGUI which handles materials assigned to sessions.
special template class to simplify handling of ITX/PEAR
Class ilUIHookProcessor.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
global $ilCtrl
Definition: ilias.php:18
$i
Definition: metadata.php:24
global $ilSetting
Definition: privfeed.php:17
$type
settings()
Definition: settings.php:2
global $ilDB
$data
Definition: storeScorm.php:23
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46