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