19 declare(strict_types=1);
24 define(
"IL_COL_LEFT",
"left");
25 define(
"IL_COL_RIGHT",
"right");
26 define(
"IL_COL_CENTER",
"center");
28 define(
"IL_SCREEN_SIDE",
"");
29 define(
"IL_SCREEN_CENTER",
"center");
30 define(
"IL_SCREEN_FULL",
"full");
47 protected \ILIAS\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/",
93 "ilNewsForContextBlockGUI" =>
"news",
94 "ilCalendarBlockGUI" =>
"cal",
95 "ilTutorialSupportBlockGUI" =>
"tusu",
97 "ilConsultationHoursCalendarBlockGUI" =>
"chcal",
98 "ilSelectedItemsBlockGUI" =>
"pditems",
99 'ilPollBlockGUI' =>
'poll',
100 'ilClassificationBlockGUI' =>
'clsfct',
101 "ilPDStudyProgrammeSimpleListGUI" =>
"prgsimplelist",
102 "ilPDStudyProgrammeExpandableListGUI" =>
"prgexpandablelist",
124 "frm" => array(
"ilNewsForContextBlockGUI" =>
IL_COL_RIGHT),
155 array(
"news" =>
true,
168 array(
"pdfeed" =>
true);
171 string $a_col_type =
"",
173 bool $use_std_context =
false 177 $this->
ctrl = $DIC->ctrl();
178 $this->
lng = $DIC->language();
179 $this->
user = $DIC->user();
180 $this->browser = $DIC->http()->agent();
186 $this->request = $block_service->internal()
200 self::$locations[$className] =
$path;
212 self::$block_types[$className] = $identifier;
223 $request = $block_service->internal()
226 return $request->getColSide();
234 $this->coltype = $a_coltype;
247 $this->side = $a_side;
257 $this->enableedit = $a_enableedit;
266 bool $a_repositorymode
268 $this->repositorymode = $a_repositorymode;
278 $this->admincommands = $a_admincommands;
290 $ilCtrl = $DIC->ctrl();
293 $request = $block_service->internal()
297 if ($ilCtrl->getCmdClass() ==
"ilcolumngui") {
298 switch ($ilCtrl->getCmd()) {
304 $cur_block_type = $request->getBlockType();
306 if ($class = array_search($cur_block_type, self::$block_types)) {
307 return call_user_func(array($class,
'getScreenMode'));
318 string $a_block_type,
322 $this->block_property[$a_block_type][$a_property] = $a_value;
328 return $this->block_property[$a_block_type];
332 array $a_block_properties
334 $this->block_property = $a_block_properties;
338 array $a_repositoryitems
340 $this->repositoryitems = $a_repositoryitems;
361 return isset($this->item_presentation);
370 $next_class = $ilCtrl->getNextClass();
371 $cmd = $ilCtrl->getCmd(
"getHTML");
373 $cur_block_type = $this->request->getBlockType();
375 if ($next_class !=
"") {
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] ?? []);
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);
391 $html = $ilCtrl->forwardCommand($block_gui);
392 $ilCtrl->setParameter($this,
"block_type",
"");
397 return (
string) $this->$cmd();
408 $this->tpl =
new ilTemplate(
"tpl.column.html",
true,
true,
"components/ILIAS/Block");
411 return $this->tpl->get();
420 $sum_moveable = count($this->blocks[$this->
getSide()]);
422 foreach ($this->blocks[$this->
getSide()] as $block) {
423 $gui_class = $block[
"class"] ?? null;
424 if (!is_string($gui_class)) {
427 $block_class = substr($gui_class, 0, strlen($gui_class) - 3);
430 $block_gui =
new $gui_class();
431 if (isset($this->block_property[$block[
"type"]])) {
432 $block_gui->setProperties($this->block_property[$block[
"type"]]);
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"]);
448 $block_gui->setBlock($app_block);
449 if (isset($block[
"ref_id"])) {
450 $block_gui->setRefId((
int) $block[
"ref_id"]);
454 $ilCtrl->setParameter($this,
"block_type", $block_gui->getBlockType());
455 $this->tpl->setCurrentBlock(
"col_block");
457 $html = $ilCtrl->getHTML($block_gui);
461 $this->tpl->setVariable(
"BLOCK", $html);
462 $this->tpl->parseCurrentBlock();
463 $ilCtrl->setParameter($this,
"block_type",
"");
478 $sum_moveable = count($this->blocks[$this->
getSide()]);
480 foreach ($this->blocks[$this->
getSide()] as $block) {
483 if (!$block[
"custom"] && $ilCtrl->getContextObjType() !=
"" && $ilCtrl->getContextObjType() !=
"user") {
484 $block[
"id"] = $ilCtrl->getContextObjId();
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);
491 $block_gui =
new $gui_class();
492 $block_gui->setProperties($this->block_property[$block[
"type"]]);
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"]);
504 $ilCtrl->setParameter($this,
"block_type", $block[
"type"]);
505 echo $ilCtrl->getHTML($block_gui);
510 if ($block[
"type"] !=
"pdfeedb" 511 && $block[
"type"] !=
"news") {
517 echo
"Error: ilColumnGUI::updateBlock: Block '" .
518 $this->request->getBlockId() .
"' unknown.";
530 if ($this->request->getBlock() !=
"") {
531 $block = explode(
"_", $this->request->getBlock());
535 $ilCtrl->returnToParent($this);
545 $class = array_search($this->request->getBlockType(), self::$block_types);
550 $block_gui =
new $class();
551 $block_gui->setProperties($this->block_property[$this->request->getBlockType()]);
556 $ilCtrl->setParameter($this,
"block_type", $this->request->getBlockType());
557 $html = $ilCtrl->forwardCommand($block_gui);
558 $ilCtrl->setParameter($this,
"block_type",
"");
577 $positions = array_flip($this->dash_side_panel_settings->getPositions());
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];
588 if ($type ==
"news") {
591 if ($type ==
"cal") {
594 if ($type ==
"chcal") {
597 if ($type ==
"tusu") {
600 if ($type ==
"pdfeedb") {
603 if ($type ==
"clsfct") {
607 if (is_null($side) || $side ===
"") {
614 if ($this->
getColType() ===
'pd' && in_array(substr($type, 2), $this->dash_side_panel_settings->getValidModules(),
true)) {
615 $nr = $positions[substr($type, 2)] ?? $nr;
618 $this->blocks[
$side][] = array(
630 $custom_block->setContextObjId($ilCtrl->getContextObjId());
631 $custom_block->setContextObjType($ilCtrl->getContextObjType());
632 $c_blocks = $custom_block->queryBlocksForContext();
634 foreach ($c_blocks as $c_block) {
635 $type = $c_block[
"type"];
638 $class = array_search($type, self::$block_types);
641 if (is_null($side)) {
645 $this->blocks[
$side][] = array(
649 "id" => $c_block[
"id"],
654 foreach ($this->rep_block_types as $block_type) {
657 foreach ($item_ref_ids as $item_ref_id) {
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];
666 $class = array_search($type, self::$block_types);
669 if ($side ==
false) {
673 $this->blocks[
$side][] = array(
677 "id" => $c_block[
"id"],
679 "ref_id" => $item[
"ref_id"]);
686 $custom_block->setContextObjId($ilCtrl->getContextObjId());
687 $custom_block->setContextObjType($ilCtrl->getContextObjType());
688 $c_blocks = $custom_block->queryBlocksForContext(
false);
689 foreach ($c_blocks as $c_block) {
690 $type = $c_block[
"type"];
691 $class = array_search($type, self::$block_types);
697 $this->blocks[
$side][] = array(
701 "id" => $c_block[
"id"],
724 if ($a_type ==
'pdfeed') {
728 if (isset($this->check_global_activation[$a_type]) && $this->check_global_activation[$a_type]) {
730 return ($this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::NEWS) &&
733 return $this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::MAIL);
735 return $this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::TASKS);
736 } elseif ($a_type ==
'news') {
740 (!in_array($ilCtrl->getContextObjType(), [
"grp",
"crs"]) ||
742 $GLOBALS[
'ilCtrl']->getContextObjId(),
747 $GLOBALS[
'ilCtrl']->getContextObjId(),
751 } elseif (
$ilSetting->get(
"block_activated_" . $a_type)) {
753 } elseif ($a_type ==
'cal' || $a_type ==
'chcal') {
756 if (!$this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::CALENDAR)) {
760 } elseif ($a_type ==
"tagcld") {
762 return (
bool) $tags_active->get(
"enable",
"0");
763 } elseif ($a_type ==
"clsfct") {
764 if ($ilCtrl->getContextObjType() ==
"cat") {
768 return (
bool) $tags_active->get(
"enable",
"0");
770 $a_type ===
"tusu" &&
789 if ($this->check_nr_limit[$a_type]) {
792 $costum_block->setContextObjId($ilCtrl->getContextObjId());
793 $costum_block->setContextObjType($ilCtrl->getContextObjType());
794 $costum_block->setType($a_type);
795 $res = $costum_block->queryCntBlockForContext();
802 if (
$ilSetting->get(
"block_limit_" . $a_type) > $cnt) {
static addCustomBlockType(string $className, string $identifier)
Adds the block type of the custom block gui.
static getCmdSide()
Get Column Side of Current Command.
This library is borrowed from the phpGroupWare API http://www.phpgroupware.org/api Modifications made...
setActionMenu(ilAdvancedSelectionListGUI $action_menu)
activateBlock()
Activate hidden block.
__construct(string $a_col_type="", string $a_side="", bool $use_std_context=false)
setAdminCommands(bool $a_admincommands)
setRepositoryMode(bool $a_repositorymode)
getBlockProperties(string $a_block_type)
setEnableEdit(bool $a_enableedit)
AgentDetermination $browser
ilDashboardSidePanelSettingsRepository $dash_side_panel_settings
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
static array $block_types
hasItemPresentationManager()
exceededLimit(string $a_type)
Check whether limit is not exceeded.
isGloballyActivated(string $a_type)
Check whether a block type is globally activated.
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)
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...
getItemPresentationManager()
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.
static addCustomBlockLocation(string $className, string $path)
Adds location information of the custom block gui.
setRepositoryItems(array $a_repositoryitems)
determineBlocks()
Determine which blocks to show.
setAllBlockProperties(array $a_block_properties)
ILIAS Block StandardGUIRequest $request
High level business logic class.
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)