4 define(
"IL_COL_LEFT",
"left");
5 define(
"IL_COL_RIGHT",
"right");
6 define(
"IL_COL_CENTER",
"center");
8 define(
"IL_SCREEN_SIDE",
"");
9 define(
"IL_SCREEN_CENTER",
"center");
10 define(
"IL_SCREEN_FULL",
"full");
76 "ilNewsForContextBlockGUI" =>
"Services/News/",
77 "ilCalendarBlockGUI" =>
"Services/Calendar/",
78 "ilPDCalendarBlockGUI" =>
"Services/Calendar/",
79 "ilConsultationHoursCalendarBlockGUI" =>
"Services/Calendar/",
80 "ilPDTasksBlockGUI" =>
"Services/Tasks/",
81 "ilPDMailBlockGUI" =>
"Services/Mail/",
82 "ilPDSelectedItemsBlockGUI" =>
"Services/Dashboard/ItemsBlock/",
83 "ilPDNewsBlockGUI" =>
"Services/News/",
84 "ilExternalFeedBlockGUI" =>
"Modules/ExternalFeed/",
85 "ilPDExternalFeedBlockGUI" =>
"Services/Feeds/",
86 'ilPollBlockGUI' =>
'Modules/Poll/',
87 'ilClassificationBlockGUI' =>
'Services/Classification/',
88 "ilPDStudyProgrammeSimpleListGUI" =>
"Modules/StudyProgramme/",
89 "ilPDStudyProgrammeExpandableListGUI" =>
"Modules/StudyProgramme/",
93 "ilPDMailBlockGUI" =>
"pdmail",
94 "ilPDTasksBlockGUI" =>
"pdtasks",
95 "ilPDNewsBlockGUI" =>
"pdnews",
96 "ilNewsForContextBlockGUI" =>
"news",
97 "ilCalendarBlockGUI" =>
"cal",
98 "ilPDCalendarBlockGUI" =>
"pdcal",
99 "ilConsultationHoursCalendarBlockGUI" =>
"chcal",
100 "ilExternalFeedBlockGUI" =>
"feed",
101 "ilPDExternalFeedBlockGUI" =>
"pdfeed",
102 "ilPDSelectedItemsBlockGUI" =>
"pditems",
103 'ilPollBlockGUI' =>
'poll',
104 'ilClassificationBlockGUI' =>
'clsfct',
105 "ilPDStudyProgrammeSimpleListGUI" =>
"prgsimplelist",
106 "ilPDStudyProgrammeExpandableListGUI" =>
"prgexpandablelist",
127 "frm" => array(
"ilNewsForContextBlockGUI" =>
IL_COL_RIGHT),
161 array(
"news" =>
true,
173 array(
"pdfeed" =>
true);
180 public function __construct($a_col_type =
"", $a_side =
"", $use_std_context =
false)
184 $this->ctrl = $DIC->ctrl();
185 $this->lng = $DIC->language();
186 $this->
user = $DIC->user();
187 $this->tpl = $DIC[
"tpl"];
188 $this->browser = $DIC[
"ilBrowser"];
208 self::$locations[$className] = $path;
223 self::$block_types[$className] = $identifier;
233 return $_GET[
"col_side"];
243 $this->coltype = $a_coltype;
253 return $this->coltype;
263 $this->side = $a_side;
283 $this->enableedit = $a_enableedit;
303 $this->repositorymode = $a_repositorymode;
323 $this->admincommands = $a_admincommands;
343 $ilCtrl = $DIC->ctrl();
345 if ($ilCtrl->getCmdClass() ==
"ilcolumngui") {
346 switch ($ilCtrl->getCmd()) {
352 $cur_block_type =
"";
353 if (isset(
$_GET[
"block_type"]) &&
$_GET[
"block_type"]) {
354 $cur_block_type =
$_GET[
"block_type"];
355 } elseif (isset(
$_POST[
"block_type"])) {
356 $cur_block_type =
$_POST[
"block_type"];
359 if ($class = array_search($cur_block_type, self::$block_types)) {
360 include_once(
"./" . self::$locations[$class] .
"classes/" .
361 "class." . $class .
".php");
362 return call_user_func(array($class,
'getScreenMode'));
377 $this->block_property[$a_block_type][$a_property] = $a_value;
382 return $this->block_property[$a_block_type];
387 $this->block_property = $a_block_properties;
397 $this->repositoryitems = $a_repositoryitems;
417 $ilCtrl->setParameter($this,
"col_side", $this->
getSide());
420 $next_class = $ilCtrl->getNextClass();
421 $cmd = $ilCtrl->getCmd(
"getHTML");
423 $cur_block_type = (
$_GET[
"block_type"])
424 ?
$_GET[
"block_type"]
427 if ($next_class !=
"") {
429 if ($gui_class = array_search($cur_block_type, self::$block_types)) {
430 include_once(
"./" . self::$locations[$gui_class] .
"classes/" .
431 "class." . $gui_class .
".php");
432 $ilCtrl->setParameter($this,
"block_type", $cur_block_type);
433 $block_gui =
new $gui_class();
434 $block_gui->setProperties($this->block_property[$cur_block_type]);
439 if (in_array($gui_class, $this->custom_blocks[$this->
getColType()]) ||
440 in_array($cur_block_type, $this->rep_block_types)) {
441 $block_class = substr($gui_class, 0, strlen($gui_class) - 3);
442 include_once(
"./" . self::$locations[$gui_class] .
"classes/" .
443 "class." . $block_class .
".php");
444 $app_block =
new $block_class(
$_GET[
"block_id"]);
445 $block_gui->setBlock($app_block);
447 $html = $ilCtrl->forwardCommand($block_gui);
448 $ilCtrl->setParameter($this,
"block_type",
"");
453 return $this->$cmd();
464 $ilCtrl->setParameter($this,
"col_side", $this->
getSide());
466 $this->tpl =
new ilTemplate(
"tpl.column.html",
true,
true,
"Services/Block");
471 $this->addHiddenBlockSelector();
474 return $this->tpl->get();
487 $sum_moveable = count($this->blocks[$this->
getSide()]);
489 foreach ($this->blocks[$this->
getSide()] as $block) {
490 if ($ilCtrl->getContextObjType() !=
"user" ||
496 $gui_class = $block[
"class"];
497 $block_class = substr($block[
"class"], 0, strlen($block[
"class"]) - 3);
500 include_once(
"./" . self::$locations[$gui_class] .
"classes/" .
501 "class." . $gui_class .
".php");
502 $block_gui =
new $gui_class();
503 if (isset($this->block_property[$block[
"type"]])) {
504 $block_gui->setProperties($this->block_property[$block[
"type"]]);
511 if ($block[
"custom"]) {
512 $path =
"./" . self::$locations[$gui_class] .
"classes/" .
513 "class." . $block_class .
".php";
514 if (file_exists($path)) {
516 $app_block =
new $block_class($block[
"id"]);
521 $block_gui->setBlock($app_block);
522 if (isset($block[
"ref_id"])) {
523 $block_gui->setRefId($block[
"ref_id"]);
527 $ilCtrl->setParameter($this,
"block_type", $block_gui->getBlockType());
528 $this->tpl->setCurrentBlock(
"col_block");
530 $html = $ilCtrl->getHTML($block_gui);
534 $this->tpl->setVariable(
"BLOCK", $html);
535 $this->tpl->parseCurrentBlock();
536 $ilCtrl->setParameter($this,
"block_type",
"");
540 if ($block[
"type"] !=
"pdfeedb" &&
541 $block[
"type"] !=
"news") {
553 public function addHiddenBlockSelector()
566 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
567 $hidden_blocks = array();
569 foreach ($this->blocks[$this->
getSide()] as $block) {
570 include_once(
"./" . self::$locations[$block[
"class"]] .
"classes/" .
571 "class." . $block[
"class"] .
".php");
573 if ($block[
"custom"] ==
false) {
574 if ($ilCtrl->getContextObjType() ==
"user") {
576 $hidden_blocks[$block[
"type"]] =
$lng->txt(
'block_show_' . $block[
"type"]);
578 } elseif ($ilCtrl->getContextObjType() !=
"") {
582 $ilCtrl->getContextObjId()
584 $hidden_blocks[$block[
"type"] .
"_" . $ilCtrl->getContextObjId()] =
$lng->txt(
'block_show_' . $block[
"type"]);
593 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
595 $hidden_blocks[$block[
"type"] .
"_" . $block[
"id"]] = sprintf(
$lng->txt(
'block_show_x'), $cblock->getTitle());
599 if (count($hidden_blocks) > 0) {
600 foreach ($hidden_blocks as $id => $title) {
601 $ilCtrl->setParameter($this,
'block', $id);
602 $this->action_menu->addItem($title,
'', $ilCtrl->getLinkTarget($this,
'activateBlock'));
603 $ilCtrl->setParameter($this,
'block',
'');
609 $add_blocks = array();
611 if (is_array($this->custom_blocks[$this->
getColType()])) {
612 foreach ($this->custom_blocks[$this->
getColType()] as $block_class) {
613 include_once(
"./" . self::$locations[$block_class] .
"classes/" .
614 "class." . $block_class .
".php");
615 $block_gui =
new $block_class();
616 $block_type = $block_gui->getBlockType();
622 $add_blocks[$block_type] =
$lng->txt(
'block_create_' . $block_type);
628 if (count($add_blocks) > 0) {
629 foreach ($add_blocks as $id => $title) {
630 $ilCtrl->setParameter($this,
'block_type', $id);
631 $this->action_menu->addItem($title,
'', $ilCtrl->getLinkTarget($this,
'addBlock'));
632 $ilCtrl->setParameter($this,
'block_type',
'');
648 $sum_moveable = count($this->blocks[$this->
getSide()]);
650 foreach ($this->blocks[$this->
getSide()] as $block) {
651 include_once(
"./" . self::$locations[$block[
"class"]] .
"classes/" .
652 "class." . $block[
"class"] .
".php");
656 if (!$block[
"custom"] && $ilCtrl->getContextObjType() !=
"" && $ilCtrl->getContextObjType() !=
"user") {
657 $block[
"id"] = $ilCtrl->getContextObjId();
662 if (
$_GET[
"block_id"] ==
"block_" . $block[
"type"] .
"_" . $block[
"id"]) {
663 $gui_class = $block[
"class"];
664 $block_class = substr($block[
"class"], 0, strlen($block[
"class"]) - 3);
666 $block_gui =
new $gui_class();
667 $block_gui->setProperties($this->block_property[$block[
"type"]]);
673 if ($block[
"custom"]) {
674 include_once(
"./" . self::$locations[$gui_class] .
"classes/" .
675 "class." . $block_class .
".php");
676 $app_block =
new $block_class($block[
"id"]);
677 $block_gui->setBlock($app_block);
678 $block_gui->setRefId($block[
"ref_id"]);
681 $ilCtrl->setParameter($this,
"block_type", $block[
"type"]);
682 echo $ilCtrl->getHTML($block_gui);
687 if ($block[
"type"] !=
"pdfeedb" 688 && $block[
"type"] !=
"news") {
694 echo
"Error: ilColumnGUI::updateBlock: Block '" .
695 $_GET[
"block_id"] .
"' unknown.";
707 if (
$_GET[
"block"] !=
"") {
708 $block = explode(
"_",
$_GET[
"block"]);
709 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
713 $ilCtrl->returnToParent($this);
723 $class = array_search(
$_GET[
"block_type"], self::$block_types);
725 $ilCtrl->setCmdClass($class);
726 $ilCtrl->setCmd(
"create");
727 include_once(
"./" . self::$locations[$class] .
"classes/class." . $class .
".php");
728 $block_gui =
new $class();
729 $block_gui->setProperties($this->block_property[
$_GET[
"block_type"]]);
734 $ilCtrl->setParameter($this,
"block_type", $_GET[
"block_type"]);
735 $html = $ilCtrl->forwardCommand($block_gui);
736 $ilCtrl->setParameter($this,
"block_type",
"");
749 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
759 if (is_array($this->default_blocks[$this->
getColType()])) {
760 foreach ($this->default_blocks[$this->
getColType()] as $class => $def_side) {
761 $type = self::$block_types[$class];
767 if (
$type ==
"news") {
770 if (
$type ==
"cal") {
773 if (
$type ==
"chcal") {
776 if (
$type ==
"pdfeedb") {
779 if (
$type ==
"clsfct") {
783 if (
$side ===
false) {
790 $this->blocks[
$side][] = array(
801 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
803 $custom_block->setContextObjId($ilCtrl->getContextObjId());
804 $custom_block->setContextObjType($ilCtrl->getContextObjType());
805 $c_blocks = $custom_block->queryBlocksForContext();
807 foreach ($c_blocks as $c_block) {
808 $type = $c_block[
"type"];
811 $class = array_search(
$type, self::$block_types);
814 if (
$side ===
false) {
818 $this->blocks[
$side][] = array(
822 "id" => $c_block[
"id"],
827 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
830 foreach ($this->rep_block_types as $block_type) {
832 if (!is_array($rep_items[$block_type])) {
835 foreach ($rep_items[$block_type] as $item) {
837 $costum_block->setContextObjId($item[
"obj_id"]);
838 $costum_block->setContextObjType($block_type);
839 $c_blocks = $costum_block->queryBlocksForContext();
840 $c_block = $c_blocks[0];
843 $class = array_search(
$type, self::$block_types);
846 if (
$side ===
false) {
850 $this->blocks[
$side][] = array(
854 "id" => $c_block[
"id"],
856 "ref_id" => $item[
"ref_id"]);
862 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
864 $custom_block->setContextObjId($ilCtrl->getContextObjId());
865 $custom_block->setContextObjType($ilCtrl->getContextObjType());
866 $c_blocks = $custom_block->queryBlocksForContext(
false);
868 foreach ($c_blocks as $c_block) {
869 $type = $c_block[
"type"];
870 $class = array_search(
$type, self::$block_types);
876 $this->blocks[
$side][] = array(
880 "id" => $c_block[
"id"],
903 if ($a_type ==
'pdfeed') {
907 if (isset($this->check_global_activation[$a_type]) && $this->check_global_activation[$a_type]) {
908 if ($a_type ==
'pdnews') {
909 return ($this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::NEWS) &&
911 } elseif ($a_type ==
'pdmail') {
912 return $this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::MAIL);
913 } elseif ($a_type ==
'pdtasks') {
914 return $this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::TASKS);
915 } elseif ($a_type ==
'news') {
916 include_once
'Services/Container/classes/class.ilContainer.php';
920 (!in_array($ilCtrl->getContextObjType(), [
"grp",
"crs"]) ||
922 $GLOBALS[
'ilCtrl']->getContextObjId(),
927 $GLOBALS[
'ilCtrl']->getContextObjId(),
931 } elseif (
$ilSetting->get(
"block_activated_" . $a_type)) {
933 } elseif ($a_type ==
'cal' || $a_type ==
'chcal') {
935 } elseif ($a_type ==
'pdcal') {
936 if (!$this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::CALENDAR)) {
939 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
941 } elseif ($a_type ==
"tagcld") {
943 return (
bool) $tags_active->get(
"enable",
false);
944 } elseif ($a_type ==
"clsfct") {
945 if ($ilCtrl->getContextObjType() ==
"cat") {
949 return (
bool) $tags_active->get(
"enable",
false);
964 if ($this->check_nr_limit[$a_type]) {
966 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
968 $costum_block->setContextObjId($ilCtrl->getContextObjId());
969 $costum_block->setContextObjType($ilCtrl->getContextObjType());
970 $costum_block->setType($a_type);
971 $res = $costum_block->queryCntBlockForContext();
972 $cnt = (int)
$res[0][
"cnt"];
978 if (
$ilSetting->get(
"block_limit_" . $a_type) > $cnt) {
990 public function saveBlockSortingAsynch()
1005 if (in_array($this->
getColType(), array(
'pd'))) {
1008 foreach (array(IL_COL_LEFT => (array)
$_POST[IL_COL_LEFT][
'sequence'], IL_COL_RIGHT => (array)
$_POST[IL_COL_RIGHT][
'sequence']) as
$side => $blocks) {
1010 foreach ($blocks as $block) {
1011 $bid = explode(
'_', $block);
__construct($a_col_type="", $a_side="", $use_std_context=false)
Constructor.
exceededLimit($a_type)
Check whether limit is not exceeded.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static _getInstance()
get singleton instance
static addCustomBlockType($className, $identifier)
Adds the block type of the custom block gui.
static getCmdSide()
Get Column Side of Current Command.
setBlockProperty($a_block_type, $a_property, $a_value)
This function is supposed to be used for block type specific properties, that should be passed to ilB...
getAdminCommands()
Get Administration Commmands.
static _writeDetailLevel($a_type, $a_value, $a_user=0, $a_block_id=0)
Write detail level to database.
static _writeSide($a_type, $a_value, $a_user=0, $a_block_id=0)
Write side to database.
activateBlock()
Activate hidden block.
setAllBlockProperties($a_block_properties)
static _lookupDetailLevel($a_type, $a_user=0, $a_block_id=0)
Lookup detail level.
executeCommand()
execute command
setEnableEdit($a_enableedit)
Set EnableEdit.
getHTML()
Get HTML for column.
getBlockProperties($a_block_type)
setColType($a_coltype)
Set Column Type.
setRepositoryItems($a_repositoryitems)
Set Repository Items.
Dashboard side panel settings Repo.
foreach($_POST as $key=> $value) $res
setActionMenu($action_menu)
getRepositoryItems()
Get Repository Items.
Column user interface class.
setRepositoryMode($a_repositorymode)
Set RepositoryMode.
getSide()
Get Side IL_COL_LEFT | IL_COL_RIGHT.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
getEnableEdit()
Get EnableEdit.
static _lookupSide($a_type, $a_user=0, $a_block_id=0)
Lookup side.
static lookupCalendarContentPresentationEnabled(int $obj_id)
This is the super class of all custom blocks.
static getScreenMode()
Get Screen Mode for current command.
updateBlock()
Update Block (asynchronous)
static addCustomBlockLocation($className, $path)
Adds location information of the custom block gui.
static _writeNumber($a_type, $a_value, $a_user=0, $a_block_id=0)
Write number to database.
setAdminCommands($a_admincommands)
Set Administration Commmands.
getRepositoryMode()
Get RepositoryMode.
isGloballyActivated($a_type)
Check whether a block type is globally activated.
setSide($a_side)
Set Side IL_COL_LEFT | IL_COL_RIGHT.
getColType()
Get Column Type.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
determineBlocks()
Determine which blocks to show.