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