19declare(strict_types=1);
25define(
"IL_COL_LEFT",
"left");
26define(
"IL_COL_RIGHT",
"right");
27define(
"IL_COL_CENTER",
"center");
29define(
"IL_SCREEN_SIDE",
"");
30define(
"IL_SCREEN_CENTER",
"center");
31define(
"IL_SCREEN_FULL",
"full");
48 protected \ILIAS\Container\Block\StandardGUIRequest
$request;
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/"
94 "ilNewsForContextBlockGUI" =>
"news",
95 "ilCalendarBlockGUI" =>
"cal",
96 "ilTutorialSupportBlockGUI" =>
"tusu",
98 "ilConsultationHoursCalendarBlockGUI" =>
"chcal",
99 "ilSelectedItemsBlockGUI" =>
"pditems",
100 'ilPollBlockGUI' =>
'poll',
101 'ilClassificationBlockGUI' =>
'clsfct',
102 "ilPDStudyProgrammeSimpleListGUI" =>
"prgsimplelist",
103 "ilPDStudyProgrammeExpandableListGUI" =>
"prgexpandablelist",
104 "ilLPProgressBlockGUI" =>
"lpprogress"
131 "frm" => array(
"ilNewsForContextBlockGUI" =>
IL_COL_RIGHT),
162 array(
"news" =>
true,
173 "lpprogress" =>
true);
176 array(
"pdfeed" =>
true);
179 string $a_col_type =
"",
181 bool $use_std_context =
false
185 $this->
ctrl = $DIC->ctrl();
186 $this->
lng = $DIC->language();
187 $this->
user = $DIC->user();
188 $this->browser =
$DIC->http()->agent();
194 $this->request = $block_service->internal()
220 self::$block_types[$className] = $identifier;
231 $request = $block_service->internal()
234 return $request->getColSide();
242 $this->coltype = $a_coltype;
247 return $this->coltype;
255 $this->side = $a_side;
265 $this->enableedit = $a_enableedit;
270 return $this->enableedit;
274 bool $a_repositorymode
276 $this->repositorymode = $a_repositorymode;
281 return $this->repositorymode;
286 $this->admincommands = $a_admincommands;
291 return $this->admincommands;
298 $ilCtrl =
$DIC->ctrl();
301 $request = $block_service->internal()
305 if ($ilCtrl->getCmdClass() ==
"ilcolumngui") {
306 switch ($ilCtrl->getCmd()) {
312 $cur_block_type = $request->getBlockType();
314 if ($class = array_search($cur_block_type, self::$block_types)) {
315 return call_user_func(array($class,
'getScreenMode'));
326 string $a_block_type,
330 $this->block_property[$a_block_type][$a_property] = $a_value;
336 return $this->block_property[$a_block_type];
340 array $a_block_properties
342 $this->block_property = $a_block_properties;
346 array $a_repositoryitems
348 $this->repositoryitems = $a_repositoryitems;
353 return $this->repositoryitems;
359 $this->item_presentation = $item_presentation;
364 return $this->item_presentation;
369 return isset($this->item_presentation);
374 $ilCtrl = $this->ctrl;
376 $ilCtrl->setParameter($this,
"col_side", $this->getSide());
378 $next_class = $ilCtrl->getNextClass();
379 $cmd = $ilCtrl->getCmd(
"getHTML");
381 $cur_block_type = $this->request->getBlockType();
383 if ($next_class !=
"") {
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());
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);
399 $html = $ilCtrl->forwardCommand($block_gui);
400 $ilCtrl->setParameter($this,
"block_type",
"");
405 return (
string) $this->$cmd();
412 $ilCtrl = $this->ctrl;
414 $ilCtrl->setParameter($this,
"col_side", $this->getSide());
416 $this->tpl =
new ilTemplate(
"tpl.column.html",
true,
true,
"components/ILIAS/Container");
417 $this->determineBlocks();
419 return $this->tpl->get();
424 $ilCtrl = $this->ctrl;
425 $ilUser = $this->user;
428 $sum_moveable = count($this->blocks[$this->getSide()]);
430 foreach ($this->blocks[$this->getSide()] as $block) {
431 $gui_class = $block[
"class"] ??
null;
432 if (!is_string($gui_class)) {
435 $block_class = substr($gui_class, 0, strlen($gui_class) - 3);
438 $block_gui =
new $gui_class();
439 if (isset($this->block_property[$block[
"type"]])) {
440 $block_gui->setProperties($this->block_property[$block[
"type"]]);
442 $block_gui->setRepositoryMode($this->getRepositoryMode());
443 $block_gui->setEnableEdit($this->getEnableEdit());
444 $block_gui->setAdminCommands($this->getAdminCommands());
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"]);
456 $block_gui->setBlock($app_block);
457 if (isset($block[
"ref_id"])) {
458 $block_gui->setRefId((
int) $block[
"ref_id"]);
462 $ilCtrl->setParameter($this,
"block_type", $block_gui->getBlockType());
463 $this->tpl->setCurrentBlock(
"col_block");
465 $html = $ilCtrl->getHTML($block_gui);
469 $this->tpl->setVariable(
"BLOCK", $html);
470 $this->tpl->parseCurrentBlock();
471 $ilCtrl->setParameter($this,
"block_type",
"");
482 $ilCtrl = $this->ctrl;
484 $this->determineBlocks();
486 $sum_moveable = count($this->blocks[$this->getSide()]);
488 foreach ($this->blocks[$this->getSide()] as $block) {
491 if (!$block[
"custom"] && $ilCtrl->getContextObjType() !=
"" && $ilCtrl->getContextObjType() !=
"user") {
492 $block[
"id"] = $ilCtrl->getContextObjId();
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);
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());
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"]);
512 $ilCtrl->setParameter($this,
"block_type", $block[
"type"]);
513 echo $ilCtrl->getHTML($block_gui);
518 if ($block[
"type"] !=
"pdfeedb"
519 && $block[
"type"] !=
"news") {
525 echo
"Error: ilColumnGUI::updateBlock: Block '" .
526 $this->request->getBlockId() .
"' unknown.";
535 $ilUser = $this->user;
536 $ilCtrl = $this->ctrl;
538 if ($this->request->getBlock() !=
"") {
539 $block = explode(
"_", $this->request->getBlock());
543 $ilCtrl->returnToParent($this);
551 $ilUser = $this->user;
552 $ilCtrl = $this->ctrl;
559 if ($this->getColType() ===
'pd') {
561 $positions = array_flip($this->dash_side_panel_settings->getPositions());
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)) {
572 if ($type ==
"news") {
575 if ($type ==
"cal") {
578 if ($type ==
"chcal") {
581 if ($type ==
"tusu") {
584 if ($type ==
"pdfeedb") {
587 if ($type ==
"clsfct") {
590 if ($type ==
"lpprogress") {
594 if (is_null($side) || $side ===
"") {
601 if ($this->getColType() ===
'pd' && in_array(substr($type, 2), $this->dash_side_panel_settings->getValidModules(),
true)) {
602 $nr = $positions[substr($type, 2)] ?? $nr;
605 $this->blocks[$side][] = array(
615 if (!$this->getRepositoryMode()) {
617 $custom_block->setContextObjId($ilCtrl->getContextObjId());
618 $custom_block->setContextObjType($ilCtrl->getContextObjType());
619 $c_blocks = $custom_block->queryBlocksForContext();
621 foreach ($c_blocks as $c_block) {
622 $type = $c_block[
"type"];
624 if ($this->isGloballyActivated($type)) {
625 $class = array_search($type, self::$block_types);
628 if (is_null($side)) {
632 $this->blocks[$side][] = array(
636 "id" => $c_block[
"id"],
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);
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];
653 $class = array_search($type, self::$block_types);
656 if ($side ==
false) {
660 $this->blocks[$side][] = array(
664 "id" => $c_block[
"id"],
666 "ref_id" => $item[
"ref_id"]);
673 $custom_block->setContextObjId($ilCtrl->getContextObjId());
674 $custom_block->setContextObjType($ilCtrl->getContextObjType());
675 $c_blocks = $custom_block->queryBlocksForContext(
false);
676 foreach ($c_blocks as $c_block) {
677 $type = $c_block[
"type"];
678 $class = array_search($type, self::$block_types);
684 $this->blocks[$side][] = array(
688 "id" => $c_block[
"id"],
709 $ilCtrl = $this->ctrl;
711 if ($a_type ==
'pdfeed') {
715 if (isset($this->check_global_activation[$a_type]) && $this->check_global_activation[$a_type]) {
717 return ($this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::NEWS) &&
720 return $this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::MAIL);
722 return $this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::TASKS);
723 } elseif ($a_type ==
'news') {
727 (!in_array($ilCtrl->getContextObjType(), [
"grp",
"crs"]) ||
729 $GLOBALS[
'ilCtrl']->getContextObjId(),
734 $GLOBALS[
'ilCtrl']->getContextObjId(),
738 } elseif (
$ilSetting->get(
"block_activated_" . $a_type)) {
740 } elseif ($a_type ==
'cal' || $a_type ==
'chcal') {
743 if (!$this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::CALENDAR)) {
747 } elseif ($a_type ==
"tagcld") {
749 return (
bool) $tags_active->get(
"enable",
"0");
750 } elseif ($a_type ==
"clsfct") {
751 if ($ilCtrl->getContextObjType() ==
"cat") {
755 return (
bool) $tags_active->get(
"enable",
"0");
757 $a_type ===
"tusu" &&
761 } elseif ($a_type ===
"lpprogress") {
763 $progress_block_settings = (
new TrackingView())->progressBlock()->settings()->repository();
765 $progress_block_settings->isBlockShownForObject($ilCtrl->getContextObjId());
779 $ilCtrl = $this->ctrl;
781 if ($this->check_nr_limit[$a_type]) {
782 if (!$this->getRepositoryMode()) {
784 $costum_block->setContextObjId($ilCtrl->getContextObjId());
785 $costum_block->setContextObjType($ilCtrl->getContextObjType());
786 $costum_block->setType($a_type);
787 $res = $costum_block->queryCntBlockForContext();
794 if (
$ilSetting->get(
"block_limit_" . $a_type) > $cnt) {
High level business logic class.
This library is borrowed from the phpGroupWare API http://www.phpgroupware.org/api Modifications made...
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)
static addCustomBlockLocation(string $className, string $path)
Adds location information of the custom block gui.
AgentDetermination $browser
setColType(string $a_coltype)
static array $block_types
setAdminCommands(bool $a_admincommands)
setRepositoryItems(array $a_repositoryitems)
hasItemPresentationManager()
getItemPresentationManager()
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
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.
static lookupTutorialBlockSettingEabled(int $a_obj_id)
static getInstance(int $obj_id)
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...