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