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" =>
"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/",
92 "ilNewsForContextBlockGUI" =>
"news",
93 "ilCalendarBlockGUI" =>
"cal",
95 "ilConsultationHoursCalendarBlockGUI" =>
"chcal",
96 "ilSelectedItemsBlockGUI" =>
"pditems",
97 'ilPollBlockGUI' =>
'poll',
98 'ilClassificationBlockGUI' =>
'clsfct',
99 "ilPDStudyProgrammeSimpleListGUI" =>
"prgsimplelist",
100 "ilPDStudyProgrammeExpandableListGUI" =>
"prgexpandablelist",
121 "frm" => array(
"ilNewsForContextBlockGUI" =>
IL_COL_RIGHT),
152 array(
"news" =>
true,
164 array(
"pdfeed" =>
true);
167 string $a_col_type =
"",
169 bool $use_std_context =
false 173 $this->
ctrl = $DIC->ctrl();
174 $this->
lng = $DIC->language();
175 $this->
user = $DIC->user();
176 $this->browser = $DIC->http()->agent();
182 $this->request = $block_service->internal()
196 self::$locations[$className] =
$path;
208 self::$block_types[$className] = $identifier;
219 $request = $block_service->internal()
222 return $request->getColSide();
230 $this->coltype = $a_coltype;
243 $this->side = $a_side;
253 $this->enableedit = $a_enableedit;
262 bool $a_repositorymode
264 $this->repositorymode = $a_repositorymode;
274 $this->admincommands = $a_admincommands;
286 $ilCtrl = $DIC->ctrl();
289 $request = $block_service->internal()
293 if ($ilCtrl->getCmdClass() ==
"ilcolumngui") {
294 switch ($ilCtrl->getCmd()) {
300 $cur_block_type = $request->getBlockType();
302 if ($class = array_search($cur_block_type, self::$block_types)) {
303 return call_user_func(array($class,
'getScreenMode'));
314 string $a_block_type,
318 $this->block_property[$a_block_type][$a_property] = $a_value;
324 return $this->block_property[$a_block_type];
328 array $a_block_properties
330 $this->block_property = $a_block_properties;
334 array $a_repositoryitems
336 $this->repositoryitems = $a_repositoryitems;
357 return isset($this->item_presentation);
366 $next_class = $ilCtrl->getNextClass();
367 $cmd = $ilCtrl->getCmd(
"getHTML");
369 $cur_block_type = $this->request->getBlockType();
371 if ($next_class !=
"") {
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] ?? []);
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);
387 $html = $ilCtrl->forwardCommand($block_gui);
388 $ilCtrl->setParameter($this,
"block_type",
"");
393 return (
string) $this->$cmd();
404 $this->tpl =
new ilTemplate(
"tpl.column.html",
true,
true,
"Services/Block");
407 return $this->tpl->get();
416 $sum_moveable = count($this->blocks[$this->
getSide()]);
418 foreach ($this->blocks[$this->
getSide()] as $block) {
419 $gui_class = $block[
"class"] ?? null;
420 if (!is_string($gui_class)) {
423 $block_class = substr($gui_class, 0, strlen($gui_class) - 3);
426 $block_gui =
new $gui_class();
427 if (isset($this->block_property[$block[
"type"]])) {
428 $block_gui->setProperties($this->block_property[$block[
"type"]]);
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"]);
444 $block_gui->setBlock($app_block);
445 if (isset($block[
"ref_id"])) {
446 $block_gui->setRefId((
int) $block[
"ref_id"]);
450 $ilCtrl->setParameter($this,
"block_type", $block_gui->getBlockType());
451 $this->tpl->setCurrentBlock(
"col_block");
453 $html = $ilCtrl->getHTML($block_gui);
457 $this->tpl->setVariable(
"BLOCK", $html);
458 $this->tpl->parseCurrentBlock();
459 $ilCtrl->setParameter($this,
"block_type",
"");
474 $sum_moveable = count($this->blocks[$this->
getSide()]);
476 foreach ($this->blocks[$this->
getSide()] as $block) {
479 if (!$block[
"custom"] && $ilCtrl->getContextObjType() !=
"" && $ilCtrl->getContextObjType() !=
"user") {
480 $block[
"id"] = $ilCtrl->getContextObjId();
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);
487 $block_gui =
new $gui_class();
488 $block_gui->setProperties($this->block_property[$block[
"type"]]);
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"]);
500 $ilCtrl->setParameter($this,
"block_type", $block[
"type"]);
501 echo $ilCtrl->getHTML($block_gui);
506 if ($block[
"type"] !=
"pdfeedb" 507 && $block[
"type"] !=
"news") {
513 echo
"Error: ilColumnGUI::updateBlock: Block '" .
514 $this->request->getBlockId() .
"' unknown.";
526 if ($this->request->getBlock() !=
"") {
527 $block = explode(
"_", $this->request->getBlock());
531 $ilCtrl->returnToParent($this);
541 $class = array_search($this->request->getBlockType(), self::$block_types);
544 $ilCtrl->setCmd(
"create");
545 $block_gui =
new $class();
546 $block_gui->setProperties($this->block_property[$this->request->getBlockType()]);
551 $ilCtrl->setParameter($this,
"block_type", $this->request->getBlockType());
552 $html = $ilCtrl->forwardCommand($block_gui);
553 $ilCtrl->setParameter($this,
"block_type",
"");
571 $user_id = $ilUser->getId();
572 $positions = array_flip($this->dash_side_panel_settings->getPositions());
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];
583 if ($type ==
"news") {
586 if ($type ==
"cal") {
589 if ($type ==
"chcal") {
592 if ($type ==
"pdfeedb") {
595 if ($type ==
"clsfct") {
599 if (is_null($side) || $side ===
"") {
606 if ($this->
getColType() ===
'pd' && in_array(substr($type, 2), $this->dash_side_panel_settings->getValidModules(),
true)) {
607 $nr = $positions[substr($type, 2)] ?? $nr;
610 $this->blocks[
$side][] = array(
622 $custom_block->setContextObjId($ilCtrl->getContextObjId());
623 $custom_block->setContextObjType($ilCtrl->getContextObjType());
624 $c_blocks = $custom_block->queryBlocksForContext();
626 foreach ($c_blocks as $c_block) {
627 $type = $c_block[
"type"];
630 $class = array_search($type, self::$block_types);
633 if (is_null($side)) {
637 $this->blocks[
$side][] = array(
641 "id" => $c_block[
"id"],
646 foreach ($this->rep_block_types as $block_type) {
649 foreach ($item_ref_ids as $item_ref_id) {
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];
658 $class = array_search($type, self::$block_types);
661 if ($side ==
false) {
665 $this->blocks[
$side][] = array(
669 "id" => $c_block[
"id"],
671 "ref_id" => $item[
"ref_id"]);
678 $custom_block->setContextObjId($ilCtrl->getContextObjId());
679 $custom_block->setContextObjType($ilCtrl->getContextObjType());
680 $c_blocks = $custom_block->queryBlocksForContext(
false);
681 foreach ($c_blocks as $c_block) {
682 $type = $c_block[
"type"];
683 $class = array_search($type, self::$block_types);
689 $this->blocks[
$side][] = array(
693 "id" => $c_block[
"id"],
716 if ($a_type ==
'pdfeed') {
720 if (isset($this->check_global_activation[$a_type]) && $this->check_global_activation[$a_type]) {
722 return ($this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::NEWS) &&
725 return $this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::MAIL);
727 return $this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::TASKS);
728 } elseif ($a_type ==
'news') {
732 (!in_array($ilCtrl->getContextObjType(), [
"grp",
"crs"]) ||
734 $GLOBALS[
'ilCtrl']->getContextObjId(),
739 $GLOBALS[
'ilCtrl']->getContextObjId(),
743 } elseif (
$ilSetting->get(
"block_activated_" . $a_type)) {
745 } elseif ($a_type ==
'cal' || $a_type ==
'chcal') {
748 if (!$this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::CALENDAR)) {
752 } elseif ($a_type ==
"tagcld") {
754 return (
bool) $tags_active->get(
"enable",
"0");
755 } elseif ($a_type ==
"clsfct") {
756 if ($ilCtrl->getContextObjType() ==
"cat") {
760 return (
bool) $tags_active->get(
"enable",
"0");
776 if ($this->check_nr_limit[$a_type]) {
779 $costum_block->setContextObjId($ilCtrl->getContextObjId());
780 $costum_block->setContextObjType($ilCtrl->getContextObjType());
781 $costum_block->setType($a_type);
782 $res = $costum_block->queryCntBlockForContext();
789 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)
setCmdClass($a_cmd_class)
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)
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)