ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilColumnGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23use ILIAS\Tracking\View\Factory as TrackingView;
24
25define("IL_COL_LEFT", "left");
26define("IL_COL_RIGHT", "right");
27define("IL_COL_CENTER", "center");
28
29define("IL_SCREEN_SIDE", "");
30define("IL_SCREEN_CENTER", "center");
31define("IL_SCREEN_FULL", "full");
32
43{
44 protected array $repositoryitems;
45 protected string $coltype;
48 protected \ILIAS\Container\Block\StandardGUIRequest $request;
49 protected ilCtrl $ctrl;
50 protected ilLanguage $lng;
51 protected ilObjUser $user;
52 protected ilTemplate $tpl;
55
56 protected string $side = IL_COL_RIGHT;
57 protected string $type;
58 protected bool $enableedit = false;
59 protected bool $repositorymode = false;
60 protected array $blocks = [];
61 // all blocks that are repository objects
63 protected array $rep_block_types = array("feed","poll");
65 protected array $block_property = array();
66 protected bool $admincommands = false;
68
69 //
70 // This two arrays may be replaced by some
71 // xml or other magic in the future...
72 //
73
74 protected static array $locations = array(
75 "ilNewsForContextBlockGUI" => "components/ILIAS/News/",
76 "ilCalendarBlockGUI" => "components/ILIAS/Calendar/",
77 "ilTutorialSupportBlockGUI" => "components/ILIAS/Course/",
78 "ilPDCalendarBlockGUI" => "components/ILIAS/Calendar/",
79 "ilConsultationHoursCalendarBlockGUI" => "components/ILIAS/Calendar/",
80 "ilPDTasksBlockGUI" => "components/ILIAS/Tasks/",
81 "ilPDMailBlockGUI" => "components/ILIAS/Mail/",
82 "ilSelectedItemsBlockGUI" => "components/ILIAS/Dashboard/Block/",
83 "ilPDNewsBlockGUI" => "components/ILIAS/News/",
84 'ilPollBlockGUI' => 'components/ILIAS/Poll/',
85 'ilClassificationBlockGUI' => 'components/ILIAS/Classification/',
86 "ilPDStudyProgrammeSimpleListGUI" => "components/ILIAS/StudyProgramme/",
87 "ilPDStudyProgrammeExpandableListGUI" => "components/ILIAS/StudyProgramme/",
88 "ilLPProgressBlockGUI" => "components/ILIAS/Tracking/"
89 );
90
91 protected static array $block_types = array(
92 "ilPDMailBlockGUI" => 'pd' . ilDashboardSidePanelSettingsRepository::MAIL,
93 "ilPDTasksBlockGUI" => 'pd' . ilDashboardSidePanelSettingsRepository::TASKS,
94 "ilPDNewsBlockGUI" => 'pd' . ilDashboardSidePanelSettingsRepository::NEWS,
95 "ilNewsForContextBlockGUI" => "news",
96 "ilCalendarBlockGUI" => "cal",
97 "ilTutorialSupportBlockGUI" => "tusu",
98 "ilPDCalendarBlockGUI" => 'pd' . ilDashboardSidePanelSettingsRepository::CALENDAR,
99 "ilConsultationHoursCalendarBlockGUI" => "chcal",
100 "ilSelectedItemsBlockGUI" => "pditems",
101 'ilPollBlockGUI' => 'poll',
102 'ilClassificationBlockGUI' => 'clsfct',
103 "ilPDStudyProgrammeSimpleListGUI" => "prgsimplelist",
104 "ilPDStudyProgrammeExpandableListGUI" => "prgexpandablelist",
105 "ilLPProgressBlockGUI" => "lpprogress"
106 );
107
108
109 protected array $default_blocks = array(
110 "cat" => array(
111 "ilNewsForContextBlockGUI" => IL_COL_RIGHT,
112 "ilClassificationBlockGUI" => IL_COL_RIGHT
113 ),
114 "crs" => array(
115 "ilNewsForContextBlockGUI" => IL_COL_RIGHT,
116 "ilCalendarBlockGUI" => IL_COL_RIGHT,
117 "ilTutorialSupportBlockGUI" => IL_COL_RIGHT,
118 "ilConsultationHoursCalendarBlockGUI" => IL_COL_RIGHT,
119 "ilClassificationBlockGUI" => IL_COL_RIGHT,
120 "ilLPProgressBlockGUI" => IL_COL_RIGHT
121 ),
122 "grp" => array(
123 "ilNewsForContextBlockGUI" => IL_COL_RIGHT,
124 "ilCalendarBlockGUI" => IL_COL_RIGHT,
125 "ilConsultationHoursCalendarBlockGUI" => IL_COL_RIGHT,
126 "ilClassificationBlockGUI" => IL_COL_RIGHT,
127 "ilLPProgressBlockGUI" => IL_COL_RIGHT
128 ),
129 "fold" => array(
130 "ilLPProgressBlockGUI" => IL_COL_RIGHT
131 ),
132 "frm" => array("ilNewsForContextBlockGUI" => IL_COL_RIGHT),
133 "root" => array(),
134 "info" => array(
135 "ilNewsForContextBlockGUI" => IL_COL_RIGHT),
136 "pd" => array(
137 "ilPDTasksBlockGUI" => IL_COL_RIGHT,
138 "ilPDCalendarBlockGUI" => IL_COL_RIGHT,
139 "ilPDNewsBlockGUI" => IL_COL_RIGHT,
140 "ilPDStudyProgrammeSimpleListGUI" => IL_COL_CENTER,
141 "ilPDStudyProgrammeExpandableListGUI" => IL_COL_CENTER,
142 "ilSelectedItemsBlockGUI" => IL_COL_CENTER,
143 "ilPDMailBlockGUI" => IL_COL_RIGHT
144 )
145 );
146
147 // these are only for pd blocks
148 // other blocks are rep objects now
149 protected array $custom_blocks = array(
150 "cat" => array(),
151 "crs" => array(),
152 "grp" => array(),
153 "frm" => array(),
154 "root" => array(),
155 "info" => array(),
156 "fold" => array(),
157 "pd" => array()
158 );
159
160 // check global activation for these block types
161 // @todo: add calendar
162 protected array $check_global_activation =
163 array("news" => true,
164 "cal" => true,
165 "chcal" => true,
166 "tusu" => true,
169 "pdtag" => true,
172 "tagcld" => true,
173 "clsfct" => true,
174 "lpprogress" => true);
175
176 protected array $check_nr_limit =
177 array("pdfeed" => true);
178
179 public function __construct(
180 string $a_col_type = "",
181 string $a_side = "",
182 bool $use_std_context = false
183 ) {
184 global $DIC;
185
186 $this->ctrl = $DIC->ctrl();
187 $this->lng = $DIC->language();
188 $this->user = $DIC->user();
189 $this->browser = $DIC->http()->agent();
190 $this->settings = $DIC->settings();
191 $this->setColType($a_col_type);
192 $this->setSide($a_side);
193
194 $block_service = new ILIAS\Container\Block\Service($DIC);
195 $this->request = $block_service->internal()
196 ->gui()
197 ->standardRequest();
198
199 $this->dash_side_panel_settings = new ilDashboardSidePanelSettingsRepository();
200 }
201
205 public static function addCustomBlockLocation(
206 string $className,
207 string $path
208 ): void {
209 self::$locations[$className] = $path;
210 }
211
217 public static function addCustomBlockType(
218 string $className,
219 string $identifier
220 ): void {
221 self::$block_types[$className] = $identifier;
222 }
223
227 public static function getCmdSide(): ?string
228 {
229 global $DIC;
230
231 $block_service = new ILIAS\Container\Block\Service($DIC);
232 $request = $block_service->internal()
233 ->gui()
234 ->standardRequest();
235 return $request->getColSide();
236 }
237
241 public function setColType(string $a_coltype): void
242 {
243 $this->coltype = $a_coltype;
244 }
245
246 public function getColType(): string
247 {
248 return $this->coltype;
249 }
250
254 public function setSide(string $a_side): void
255 {
256 $this->side = $a_side;
257 }
258
259 public function getSide(): string
260 {
261 return $this->side;
262 }
263
264 public function setEnableEdit(bool $a_enableedit): void
265 {
266 $this->enableedit = $a_enableedit;
267 }
268
269 public function getEnableEdit(): bool
270 {
271 return $this->enableedit;
272 }
273
274 public function setRepositoryMode(
275 bool $a_repositorymode
276 ): void {
277 $this->repositorymode = $a_repositorymode;
278 }
279
280 public function getRepositoryMode(): bool
281 {
282 return $this->repositorymode;
283 }
284
285 public function setAdminCommands(bool $a_admincommands): void
286 {
287 $this->admincommands = $a_admincommands;
288 }
289
290 public function getAdminCommands(): bool
291 {
292 return $this->admincommands;
293 }
294
295 public static function getScreenMode(): string
296 {
297 global $DIC;
298
299 $ilCtrl = $DIC->ctrl();
300
301 $block_service = new ILIAS\Container\Block\Service($DIC);
302 $request = $block_service->internal()
303 ->gui()
304 ->standardRequest();
305
306 if ($ilCtrl->getCmdClass() == "ilcolumngui") {
307 switch ($ilCtrl->getCmd()) {
308 case "addBlock":
309 return IL_SCREEN_CENTER;
310 }
311 }
312
313 $cur_block_type = $request->getBlockType();
314
315 if ($class = array_search($cur_block_type, self::$block_types)) {
316 return call_user_func(array($class, 'getScreenMode'));
317 }
318
319 return IL_SCREEN_SIDE;
320 }
321
326 public function setBlockProperty(
327 string $a_block_type,
328 string $a_property,
329 string $a_value
330 ): void {
331 $this->block_property[$a_block_type][$a_property] = $a_value;
332 }
333
334 public function getBlockProperties(
335 string $a_block_type
336 ): array {
337 return $this->block_property[$a_block_type];
338 }
339
340 public function setAllBlockProperties(
341 array $a_block_properties
342 ): void {
343 $this->block_property = $a_block_properties;
344 }
345
346 public function setRepositoryItems(
347 array $a_repositoryitems
348 ): void {
349 $this->repositoryitems = $a_repositoryitems;
350 }
351
352 public function getRepositoryItems(): array
353 {
354 return $this->repositoryitems;
355 }
356
358 ItemPresentationManager $item_presentation
359 ): void {
360 $this->item_presentation = $item_presentation;
361 }
362
364 {
365 return $this->item_presentation;
366 }
367
368 public function hasItemPresentationManager(): bool
369 {
370 return isset($this->item_presentation);
371 }
372
373 public function executeCommand(): string
374 {
375 $ilCtrl = $this->ctrl;
376
377 $ilCtrl->setParameter($this, "col_side", $this->getSide());
378
379 $next_class = $ilCtrl->getNextClass();
380 $cmd = $ilCtrl->getCmd("getHTML");
381
382 $cur_block_type = $this->request->getBlockType();
383
384 if ($next_class != "") {
385 // forward to block
386 if ($gui_class = array_search($cur_block_type, self::$block_types)) {
387 $ilCtrl->setParameter($this, "block_type", $cur_block_type);
388 $block_gui = new $gui_class();
389 $block_gui->setProperties($this->block_property[$cur_block_type] ?? []);
390 $block_gui->setRepositoryMode($this->getRepositoryMode());
391 $block_gui->setEnableEdit($this->getEnableEdit());
392 $block_gui->setAdminCommands($this->getAdminCommands());
393
394 if (in_array($gui_class, $this->custom_blocks[$this->getColType()]) ||
395 in_array($cur_block_type, $this->rep_block_types)) {
396 $block_class = substr($gui_class, 0, strlen($gui_class) - 3);
397 $app_block = new $block_class($this->request->getBlockId());
398 $block_gui->setBlock($app_block);
399 }
400 $html = $ilCtrl->forwardCommand($block_gui);
401 $ilCtrl->setParameter($this, "block_type", "");
402
403 return $html;
404 }
405 } else {
406 return (string) $this->$cmd();
407 }
408 return "";
409 }
410
411 public function getHTML(): string
412 {
413 $ilCtrl = $this->ctrl;
414
415 $ilCtrl->setParameter($this, "col_side", $this->getSide());
416
417 $this->tpl = new ilTemplate("tpl.column.html", true, true, "components/ILIAS/Container");
418 $this->determineBlocks();
419 $this->showBlocks();
420 return $this->tpl->get();
421 }
422
423 public function showBlocks(): void
424 {
425 $ilCtrl = $this->ctrl;
426 $ilUser = $this->user;
427
428 $i = 1;
429 $sum_moveable = count($this->blocks[$this->getSide()]);
430
431 foreach ($this->blocks[$this->getSide()] as $block) {
432 $gui_class = $block["class"] ?? null;
433 if (!is_string($gui_class)) {
434 continue;
435 }
436 $block_class = substr($gui_class, 0, strlen($gui_class) - 3);
437
438 // get block gui class
439 $block_gui = new $gui_class();
440 if (isset($this->block_property[$block["type"]])) {
441 $block_gui->setProperties($this->block_property[$block["type"]]);
442 }
443 $block_gui->setRepositoryMode($this->getRepositoryMode());
444 $block_gui->setEnableEdit($this->getEnableEdit());
445 $block_gui->setAdminCommands($this->getAdminCommands());
446
447 // get block for custom blocks
448 if ($block["custom"]) {
449 $path = "./../" . self::$locations[$gui_class] . "classes/" .
450 "class." . $block_class . ".php";
451 if (file_exists($path)) {
452 $app_block = new $block_class((int) $block["id"]);
453 } else {
454 // we only need generic block
455 $app_block = new ilCustomBlock((int) $block["id"]);
456 }
457 $block_gui->setBlock($app_block);
458 if (isset($block["ref_id"])) {
459 $block_gui->setRefId((int) $block["ref_id"]);
460 }
461 }
462
463 $ilCtrl->setParameter($this, "block_type", $block_gui->getBlockType());
464 $this->tpl->setCurrentBlock("col_block");
465
466 $html = $ilCtrl->getHTML($block_gui);
467
468 // don't render a block if it's empty
469 if ($html != "") {
470 $this->tpl->setVariable("BLOCK", $html);
471 $this->tpl->parseCurrentBlock();
472 $ilCtrl->setParameter($this, "block_type", "");
473 }
474 }
475 }
476
477
481 public function updateBlock(): void
482 {
483 $ilCtrl = $this->ctrl;
484
485 $this->determineBlocks();
486 $i = 1;
487 $sum_moveable = count($this->blocks[$this->getSide()]);
488
489 foreach ($this->blocks[$this->getSide()] as $block) {
490 // set block id to context obj id,
491 // if block is not a custom block and context is not personal desktop
492 if (!$block["custom"] && $ilCtrl->getContextObjType() != "" && $ilCtrl->getContextObjType() != "user") {
493 $block["id"] = $ilCtrl->getContextObjId();
494 }
495
496 if ($this->request->getBlockId() == "block_" . $block["type"] . "_" . $block["id"]) {
497 $gui_class = $block["class"];
498 $block_class = substr($block["class"], 0, strlen($block["class"]) - 3);
499
500 $block_gui = new $gui_class();
501 $block_gui->setProperties($this->block_property[$block["type"]]);
502 $block_gui->setRepositoryMode($this->getRepositoryMode());
503 $block_gui->setEnableEdit($this->getEnableEdit());
504 $block_gui->setAdminCommands($this->getAdminCommands());
505
506 // get block for custom blocks
507 if ($block["custom"]) {
508 $app_block = new $block_class($block["id"]);
509 $block_gui->setBlock($app_block);
510 $block_gui->setRefId($block["ref_id"]);
511 }
512
513 $ilCtrl->setParameter($this, "block_type", $block["type"]);
514 echo $ilCtrl->getHTML($block_gui);
515 exit;
516 }
517
518 // count (moveable) blocks
519 if ($block["type"] != "pdfeedb"
520 && $block["type"] != "news") {
521 $i++;
522 } else {
523 $sum_moveable--;
524 }
525 }
526 echo "Error: ilColumnGUI::updateBlock: Block '" .
527 $this->request->getBlockId() . "' unknown.";
528 exit;
529 }
530
534 public function activateBlock(): void
535 {
536 $ilUser = $this->user;
537 $ilCtrl = $this->ctrl;
538
539 if ($this->request->getBlock() != "") {
540 $block = explode("_", $this->request->getBlock());
541 ilBlockSetting::_writeDetailLevel($block[0], "2", $ilUser->getId(), (int) $block[1]);
542 }
543
544 $ilCtrl->returnToParent($this);
545 }
546
550 public function addBlock(): string
551 {
552 $ilCtrl = $this->ctrl;
553
554 $class = array_search($this->request->getBlockType(), self::$block_types);
555
556 // @todo: removed deprecated ilCtrl methods, this needs inspection by a maintainer.
557 // $ilCtrl->setCmdClass($class);
558 // $ilCtrl->setCmd("create");
559 $block_gui = new $class();
560 $block_gui->setProperties($this->block_property[$this->request->getBlockType()]);
561 $block_gui->setRepositoryMode($this->getRepositoryMode());
562 $block_gui->setEnableEdit($this->getEnableEdit());
563 $block_gui->setAdminCommands($this->getAdminCommands());
564
565 $ilCtrl->setParameter($this, "block_type", $this->request->getBlockType());
566 $html = $ilCtrl->forwardCommand($block_gui);
567 $ilCtrl->setParameter($this, "block_type", "");
568 return $html;
569 }
570
574 public function determineBlocks(): void
575 {
576 $ilUser = $this->user;
577 $ilCtrl = $this->ctrl;
578
579 $this->blocks[IL_COL_LEFT] = array();
580 $this->blocks[IL_COL_RIGHT] = array();
581 $this->blocks[IL_COL_CENTER] = array();
582
583 $user_id = 0;
584 if ($this->getColType() === 'pd') {
585 $user_id = $ilUser->getId();
586 $positions = array_flip($this->dash_side_panel_settings->getPositions());
587 }
588
589 $def_nr = 1000;
590 if (isset($this->default_blocks[$this->getColType()])) {
591 foreach ($this->default_blocks[$this->getColType()] as $class => $def_side) {
592 $type = self::$block_types[$class];
593 if ($this->isGloballyActivated($type)) {
594 $nr = $def_nr++;
595
596 // extra handling for system messages, feedback block and news
597 if ($type == "news") { // always show news first
598 $nr = -15;
599 }
600 if ($type == "cal") {
601 $nr = -8;
602 }
603 if ($type == "chcal") { // consultation hours always directly below calendar
604 $nr = -7;
605 }
606 if ($type == "tusu") { // tutorial support below calendar
607 $nr = -6;
608 }
609 if ($type == "pdfeedb") { // always show feedback request second
610 $nr = -10;
611 }
612 if ($type == "clsfct") { // mkunkel wants to have this on top
613 $nr = -16;
614 }
615 if ($type == "lpprogress") { // learning progress above news
616 $nr = -17;
617 }
619 if (is_null($side) || $side === "") {
620 $side = $def_side;
621 }
622 if ($side == IL_COL_LEFT) {
623 $side = IL_COL_RIGHT;
624 }
625
626 if ($this->getColType() === 'pd' && in_array(substr($type, 2), $this->dash_side_panel_settings->getValidModules(), true)) {
627 $nr = $positions[substr($type, 2)] ?? $nr;
628 }
629
630 $this->blocks[$side][] = array(
631 "nr" => $nr,
632 "class" => $class,
633 "type" => $type,
634 "id" => 0,
635 "custom" => false);
636 }
637 }
638 }
639
640 if (!$this->getRepositoryMode()) {
641 $custom_block = new ilCustomBlock();
642 $custom_block->setContextObjId($ilCtrl->getContextObjId());
643 $custom_block->setContextObjType($ilCtrl->getContextObjType());
644 $c_blocks = $custom_block->queryBlocksForContext();
645
646 foreach ($c_blocks as $c_block) {
647 $type = $c_block["type"];
648
649 if ($this->isGloballyActivated($type)) {
650 $class = array_search($type, self::$block_types);
651 $nr = $def_nr++;
652 $side = ilBlockSetting::_lookupSide($type, $user_id, $c_block["id"]);
653 if (is_null($side)) {
654 $side = IL_COL_RIGHT;
655 }
656
657 $this->blocks[$side][] = array(
658 "nr" => $nr,
659 "class" => $class,
660 "type" => $type,
661 "id" => $c_block["id"],
662 "custom" => true);
663 }
664 }
665 } else { // get all subitems
666 foreach ($this->rep_block_types as $block_type) {
667 if ($this->isGloballyActivated($block_type) && $this->hasItemPresentationManager()) {
668 $item_ref_ids = $this->getItemPresentationManager()->getRefIdsOfType($block_type);
669 foreach ($item_ref_ids as $item_ref_id) {
670 $item = $this->getItemPresentationManager()->getRawDataByRefId($item_ref_id);
671 $costum_block = new ilCustomBlock();
672 $costum_block->setContextObjId((int) $item["obj_id"]);
673 $costum_block->setContextObjType($block_type);
674 $c_blocks = $costum_block->queryBlocksForContext();
675 $c_block = $c_blocks[0];
676
677 $type = $block_type;
678 $class = array_search($type, self::$block_types);
679 $nr = $def_nr++;
680 $side = ilBlockSetting::_lookupSide($type, $user_id, (int) $c_block["id"]);
681 if ($side == false) {
682 $side = IL_COL_RIGHT;
683 }
684
685 $this->blocks[$side][] = array(
686 "nr" => $nr,
687 "class" => $class,
688 "type" => $type,
689 "id" => $c_block["id"],
690 "custom" => true,
691 "ref_id" => $item["ref_id"]);
692 }
693 }
694 }
695
696 // repository object custom blocks
697 $custom_block = new ilCustomBlock();
698 $custom_block->setContextObjId($ilCtrl->getContextObjId());
699 $custom_block->setContextObjType($ilCtrl->getContextObjType());
700 $c_blocks = $custom_block->queryBlocksForContext(false); // get all sub-object types
701 foreach ($c_blocks as $c_block) {
702 $type = $c_block["type"];
703 $class = array_search($type, self::$block_types);
704
705 if ($class) {
706 $nr = $def_nr++;
707 $side = IL_COL_RIGHT;
708
709 $this->blocks[$side][] = array(
710 "nr" => $nr,
711 "class" => $class,
712 "type" => $type,
713 "id" => $c_block["id"],
714 "custom" => true);
715 }
716 }
717 }
718
719 $this->blocks[IL_COL_LEFT] =
720 ilArrayUtil::sortArray($this->blocks[IL_COL_LEFT], "nr", "asc", true);
721 $this->blocks[IL_COL_RIGHT] =
722 ilArrayUtil::sortArray($this->blocks[IL_COL_RIGHT], "nr", "asc", true);
723 $this->blocks[IL_COL_CENTER] =
724 ilArrayUtil::sortArray($this->blocks[IL_COL_CENTER], "nr", "asc", true);
725 }
726
730 protected function isGloballyActivated(
731 string $a_type
732 ): bool {
733 $ilSetting = $this->settings;
734 $ilCtrl = $this->ctrl;
735
736 if ($a_type == 'pdfeed') {
737 return false;
738 }
739
740 if (isset($this->check_global_activation[$a_type]) && $this->check_global_activation[$a_type]) {
741 if ($a_type === 'pd' . ilDashboardSidePanelSettingsRepository::NEWS) {
742 return ($this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::NEWS) &&
743 $ilSetting->get('block_activated_news'));
744 } elseif ($a_type === 'pd' . ilDashboardSidePanelSettingsRepository::MAIL) {
745 return $this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::MAIL);
746 } elseif ($a_type === 'pd' . ilDashboardSidePanelSettingsRepository::TASKS) {
747 return $this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::TASKS);
748 } elseif ($a_type == 'news') {
749 return
750 $ilSetting->get('block_activated_news') &&
751
752 (!in_array($ilCtrl->getContextObjType(), ["grp", "crs"]) ||
754 $GLOBALS['ilCtrl']->getContextObjId(),
756 "1"
757 )) &&
759 $GLOBALS['ilCtrl']->getContextObjId(),
760 'cont_show_news',
761 "1"
762 );
763 } elseif ($ilSetting->get("block_activated_" . $a_type)) {
764 return true;
765 } elseif ($a_type == 'cal' || $a_type == 'chcal') {
766 return ilCalendarSettings::lookupCalendarContentPresentationEnabled($ilCtrl->getContextObjId());
767 } elseif ($a_type === 'pd' . ilDashboardSidePanelSettingsRepository::CALENDAR) {
768 if (!$this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::CALENDAR)) {
769 return false;
770 }
771 return ilCalendarSettings::_getInstance()->isEnabled();
772 } elseif ($a_type == "tagcld") {
773 $tags_active = new ilSetting("tags");
774 return (bool) $tags_active->get("enable", "0");
775 } elseif ($a_type == "clsfct") {
776 if ($ilCtrl->getContextObjType() == "cat") { // taxonomy presentation in classification block
777 return true;
778 }
779 $tags_active = new ilSetting("tags"); // tags presentation in classification block
780 return (bool) $tags_active->get("enable", "0");
781 } elseif (
782 $a_type === "tusu" &&
783 ilObjCourse::lookupTutorialBlockSettingEabled($ilCtrl->getContextObjId())
784 ) {
785 return true;
786 } elseif ($a_type === "lpprogress") {
787 $obj_lp = ilObjectLP::getInstance($ilCtrl->getContextObjId());
788 $progress_block_settings = (new TrackingView())->progressBlock()->settings()->repository();
789 return $obj_lp->getCurrentMode() === ilLPObjSettings::LP_MODE_COLLECTION &&
790 $progress_block_settings->isBlockShownForObject($ilCtrl->getContextObjId());
791 }
792 return false;
793 }
794 return true;
795 }
796
800 protected function exceededLimit(
801 string $a_type
802 ): bool {
803 $ilSetting = $this->settings;
804 $ilCtrl = $this->ctrl;
805
806 if ($this->check_nr_limit[$a_type]) {
807 if (!$this->getRepositoryMode()) {
808 $costum_block = new ilCustomBlock();
809 $costum_block->setContextObjId($ilCtrl->getContextObjId());
810 $costum_block->setContextObjType($ilCtrl->getContextObjType());
811 $costum_block->setType($a_type);
812 $res = $costum_block->queryCntBlockForContext();
813 $cnt = (int) $res[0]["cnt"];
814 } else {
815 return false; // not implemented for repository yet
816 }
817
818
819 if ($ilSetting->get("block_limit_" . $a_type) > $cnt) {
820 return false;
821 } else {
822 return true;
823 }
824 }
825 return false;
826 }
827
828 public function setActionMenu(
829 ilAdvancedSelectionListGUI $action_menu
830 ): void {
831 $this->action_menu = $action_menu;
832 }
833
835 {
836 return $this->action_menu;
837 }
838}
This library is borrowed from the phpGroupWare API http://www.phpgroupware.org/api Modifications made...
const IL_SCREEN_SIDE
const IL_SCREEN_CENTER
const IL_COL_RIGHT
const IL_COL_CENTER
const IL_COL_LEFT
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static _lookupSide(string $a_type, int $a_user=0, int $a_block_id=0)
Lookup side.
static _writeDetailLevel(string $a_type, string $a_value, int $a_user=0, int $a_block_id=0)
static lookupCalendarContentPresentationEnabled(int $obj_id)
Column user interface class.
updateBlock()
Update Block (asynchronous)
ilLanguage $lng
static addCustomBlockLocation(string $className, string $path)
Adds location information of the custom block gui.
AgentDetermination $browser
static array $locations
setColType(string $a_coltype)
static array $block_types
setAdminCommands(bool $a_admincommands)
setRepositoryItems(array $a_repositoryitems)
addBlock()
Add a block.
ilSetting $settings
setSide(string $a_side)
static getScreenMode()
determineBlocks()
Determine which blocks to show.
setItemPresentationManager(ItemPresentationManager $item_presentation)
setAllBlockProperties(array $a_block_properties)
setEnableEdit(bool $a_enableedit)
isGloballyActivated(string $a_type)
Check whether a block type is globally activated.
exceededLimit(string $a_type)
Check whether limit is not exceeded.
static addCustomBlockType(string $className, string $identifier)
Adds the block type of the custom block gui.
getBlockProperties(string $a_block_type)
ILIAS Container Block StandardGUIRequest $request
setActionMenu(ilAdvancedSelectionListGUI $action_menu)
array $check_global_activation
ilTemplate $tpl
ilDashboardSidePanelSettingsRepository $dash_side_panel_settings
setRepositoryMode(bool $a_repositorymode)
activateBlock()
Activate hidden block.
__construct(string $a_col_type="", string $a_side="", bool $use_std_context=false)
ItemPresentationManager $item_presentation
static getCmdSide()
Get Column Side of Current Command.
ilAdvancedSelectionListGUI $action_menu
setBlockProperty(string $a_block_type, string $a_property, string $a_value)
This function is supposed to be used for block type specific properties, that should be passed to ilB...
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
Class ilCtrl provides processing control methods.
This is the super class of all custom blocks.
language handling
static lookupTutorialBlockSettingEabled(int $a_obj_id)
User class.
static getInstance(int $obj_id)
ILIAS Setting Class.
special template class to simplify handling of ITX/PEAR
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
exit
$path
Definition: ltiservices.php:30
$res
Definition: ltiservices.php:69
global $ilSetting
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54