19 declare(strict_types=1);
23 define(
"IL_COL_LEFT",
"left");
24 define(
"IL_COL_RIGHT",
"right");
25 define(
"IL_COL_CENTER",
"center");
27 define(
"IL_SCREEN_SIDE",
"");
28 define(
"IL_SCREEN_CENTER",
"center");
29 define(
"IL_SCREEN_FULL",
"full");
44 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 "ilPDSelectedItemsBlockGUI" =>
"Services/Dashboard/ItemsBlock/",
81 "ilPDNewsBlockGUI" =>
"Services/News/",
82 'ilPollBlockGUI' =>
'Modules/Poll/',
83 'ilClassificationBlockGUI' =>
'Services/Classification/',
84 "ilPDStudyProgrammeSimpleListGUI" =>
"Modules/StudyProgramme/",
85 "ilPDStudyProgrammeExpandableListGUI" =>
"Modules/StudyProgramme/",
89 "ilPDMailBlockGUI" =>
"pdmail",
90 "ilPDTasksBlockGUI" =>
"pdtasks",
91 "ilPDNewsBlockGUI" =>
"pdnews",
92 "ilNewsForContextBlockGUI" =>
"news",
93 "ilCalendarBlockGUI" =>
"cal",
94 "ilPDCalendarBlockGUI" =>
"pdcal",
95 "ilConsultationHoursCalendarBlockGUI" =>
"chcal",
96 "ilPDSelectedItemsBlockGUI" =>
"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;
350 $next_class = $ilCtrl->getNextClass();
351 $cmd = $ilCtrl->getCmd(
"getHTML");
353 $cur_block_type = $this->request->getBlockType();
355 if ($next_class !=
"") {
357 if ($gui_class = array_search($cur_block_type, self::$block_types)) {
358 $ilCtrl->setParameter($this,
"block_type", $cur_block_type);
359 $block_gui =
new $gui_class();
360 $block_gui->setProperties($this->block_property[$cur_block_type] ?? []);
365 if (in_array($gui_class, $this->custom_blocks[$this->
getColType()]) ||
366 in_array($cur_block_type, $this->rep_block_types)) {
367 $block_class = substr($gui_class, 0, strlen($gui_class) - 3);
368 $app_block =
new $block_class($this->request->getBlockId());
369 $block_gui->setBlock($app_block);
371 $html = $ilCtrl->forwardCommand($block_gui);
372 $ilCtrl->setParameter($this,
"block_type",
"");
377 return (
string) $this->$cmd();
388 $this->tpl =
new ilTemplate(
"tpl.column.html",
true,
true,
"Services/Block");
391 return $this->tpl->get();
400 $sum_moveable = count($this->blocks[$this->
getSide()]);
402 foreach ($this->blocks[$this->
getSide()] as $block) {
403 $gui_class = $block[
"class"] ?? null;
404 if (!is_string($gui_class)) {
407 $block_class = substr($gui_class, 0, strlen($gui_class) - 3);
410 $block_gui =
new $gui_class();
411 if (isset($this->block_property[$block[
"type"]])) {
412 $block_gui->setProperties($this->block_property[$block[
"type"]]);
419 if ($block[
"custom"]) {
420 $path =
"./" . self::$locations[$gui_class] .
"classes/" .
421 "class." . $block_class .
".php";
422 if (file_exists(
$path)) {
423 $app_block =
new $block_class((
int) $block[
"id"]);
428 $block_gui->setBlock($app_block);
429 if (isset($block[
"ref_id"])) {
430 $block_gui->setRefId((
int) $block[
"ref_id"]);
434 $ilCtrl->setParameter($this,
"block_type", $block_gui->getBlockType());
435 $this->tpl->setCurrentBlock(
"col_block");
437 $html = $ilCtrl->getHTML($block_gui);
441 $this->tpl->setVariable(
"BLOCK", $html);
442 $this->tpl->parseCurrentBlock();
443 $ilCtrl->setParameter($this,
"block_type",
"");
458 $sum_moveable = count($this->blocks[$this->
getSide()]);
460 foreach ($this->blocks[$this->
getSide()] as $block) {
464 if (!$block[
"custom"] && $ilCtrl->getContextObjType() !=
"" && $ilCtrl->getContextObjType() !=
"user") {
465 $block[
"id"] = $ilCtrl->getContextObjId();
468 if ($this->request->getBlockId() ==
"block_" . $block[
"type"] .
"_" . $block[
"id"]) {
469 $gui_class = $block[
"class"];
470 $block_class = substr($block[
"class"], 0, strlen($block[
"class"]) - 3);
472 $block_gui =
new $gui_class();
473 $block_gui->setProperties($this->block_property[$block[
"type"]]);
479 if ($block[
"custom"]) {
480 $app_block =
new $block_class($block[
"id"]);
481 $block_gui->setBlock($app_block);
482 $block_gui->setRefId($block[
"ref_id"]);
485 $ilCtrl->setParameter($this,
"block_type", $block[
"type"]);
486 echo $ilCtrl->getHTML($block_gui);
491 if ($block[
"type"] !=
"pdfeedb" 492 && $block[
"type"] !=
"news") {
498 echo
"Error: ilColumnGUI::updateBlock: Block '" .
499 $this->request->getBlockId() .
"' unknown.";
511 if ($this->request->getBlock() !=
"") {
512 $block = explode(
"_", $this->request->getBlock());
516 $ilCtrl->returnToParent($this);
526 $class = array_search($this->request->getBlockType(), self::$block_types);
529 $ilCtrl->setCmd(
"create");
530 $block_gui =
new $class();
531 $block_gui->setProperties($this->block_property[$this->request->getBlockType()]);
536 $ilCtrl->setParameter($this,
"block_type", $this->request->getBlockType());
537 $html = $ilCtrl->forwardCommand($block_gui);
538 $ilCtrl->setParameter($this,
"block_type",
"");
559 if (isset($this->default_blocks[$this->
getColType()])) {
560 foreach ($this->default_blocks[$this->
getColType()] as $class => $def_side) {
561 $type = self::$block_types[$class];
566 if ($type ==
"news") {
569 if ($type ==
"cal") {
572 if ($type ==
"chcal") {
575 if ($type ==
"pdfeedb") {
578 if ($type ==
"clsfct") {
582 if (is_null($side) || $side ===
"") {
588 $this->blocks[
$side][] = array(
600 $custom_block->setContextObjId($ilCtrl->getContextObjId());
601 $custom_block->setContextObjType($ilCtrl->getContextObjType());
602 $c_blocks = $custom_block->queryBlocksForContext();
604 foreach ($c_blocks as $c_block) {
605 $type = $c_block[
"type"];
608 $class = array_search($type, self::$block_types);
611 if (is_null($side)) {
615 $this->blocks[
$side][] = array(
619 "id" => $c_block[
"id"],
625 foreach ($this->rep_block_types as $block_type) {
627 if (!isset($rep_items[$block_type]) || !is_array($rep_items[$block_type])) {
630 foreach ($rep_items[$block_type] as $item) {
632 $costum_block->setContextObjId((
int) $item[
"obj_id"]);
633 $costum_block->setContextObjType($block_type);
634 $c_blocks = $costum_block->queryBlocksForContext();
635 $c_block = $c_blocks[0];
638 $class = array_search($type, self::$block_types);
641 if ($side ==
false) {
645 $this->blocks[
$side][] = array(
649 "id" => $c_block[
"id"],
651 "ref_id" => $item[
"ref_id"]);
658 $custom_block->setContextObjId($ilCtrl->getContextObjId());
659 $custom_block->setContextObjType($ilCtrl->getContextObjType());
660 $c_blocks = $custom_block->queryBlocksForContext(
false);
661 foreach ($c_blocks as $c_block) {
662 $type = $c_block[
"type"];
663 $class = array_search($type, self::$block_types);
669 $this->blocks[
$side][] = array(
673 "id" => $c_block[
"id"],
696 if ($a_type ==
'pdfeed') {
700 if (isset($this->check_global_activation[$a_type]) && $this->check_global_activation[$a_type]) {
701 if ($a_type ==
'pdnews') {
702 return ($this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::NEWS) &&
704 } elseif ($a_type ==
'pdmail') {
705 return $this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::MAIL);
706 } elseif ($a_type ==
'pdtasks') {
707 return $this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::TASKS);
708 } elseif ($a_type ==
'news') {
712 (!in_array($ilCtrl->getContextObjType(), [
"grp",
"crs"]) ||
714 $GLOBALS[
'ilCtrl']->getContextObjId(),
719 $GLOBALS[
'ilCtrl']->getContextObjId(),
723 } elseif (
$ilSetting->get(
"block_activated_" . $a_type)) {
725 } elseif ($a_type ==
'cal' || $a_type ==
'chcal') {
727 } elseif ($a_type ==
'pdcal') {
728 if (!$this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::CALENDAR)) {
732 } elseif ($a_type ==
"tagcld") {
734 return (
bool) $tags_active->get(
"enable",
"0");
735 } elseif ($a_type ==
"clsfct") {
736 if ($ilCtrl->getContextObjType() ==
"cat") {
740 return (
bool) $tags_active->get(
"enable",
"0");
756 if ($this->check_nr_limit[$a_type]) {
759 $costum_block->setContextObjId($ilCtrl->getContextObjId());
760 $costum_block->setContextObjType($ilCtrl->getContextObjType());
761 $costum_block->setType($a_type);
762 $res = $costum_block->queryCntBlockForContext();
769 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
exceededLimit(string $a_type)
Check whether limit is not exceeded.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)