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 "ilPDTasksBlockGUI" =>
"Services/Tasks/",
80 "ilPDMailBlockGUI" =>
"Services/Mail/",
81 "ilPDSelectedItemsBlockGUI" =>
"Services/Dashboard/ItemsBlock/",
82 "ilPDNewsBlockGUI" =>
"Services/News/",
83 "ilExternalFeedBlockGUI" =>
"Modules/ExternalFeed/",
84 "ilPDExternalFeedBlockGUI" =>
"Services/Feeds/",
85 'ilPollBlockGUI' =>
'Modules/Poll/',
86 'ilClassificationBlockGUI' =>
'Services/Classification/',
87 "ilPDStudyProgrammeSimpleListGUI" =>
"Modules/StudyProgramme/",
88 "ilPDStudyProgrammeExpandableListGUI" =>
"Modules/StudyProgramme/",
92 "ilPDMailBlockGUI" =>
"pdmail",
93 "ilPDTasksBlockGUI" =>
"pdtasks",
94 "ilPDNewsBlockGUI" =>
"pdnews",
95 "ilNewsForContextBlockGUI" =>
"news",
96 "ilCalendarBlockGUI" =>
"cal",
97 "ilPDCalendarBlockGUI" =>
"pdcal",
98 "ilExternalFeedBlockGUI" =>
"feed",
99 "ilPDExternalFeedBlockGUI" =>
"pdfeed",
100 "ilPDSelectedItemsBlockGUI" =>
"pditems",
101 'ilPollBlockGUI' =>
'poll',
102 'ilClassificationBlockGUI' =>
'clsfct',
103 "ilPDStudyProgrammeSimpleListGUI" =>
"prgsimplelist",
104 "ilPDStudyProgrammeExpandableListGUI" =>
"prgexpandablelist",
123 "frm" => array(
"ilNewsForContextBlockGUI" =>
IL_COL_RIGHT),
157 array(
"news" =>
true,
168 array(
"pdfeed" =>
true);
175 public function __construct($a_col_type =
"", $a_side =
"", $use_std_context =
false)
179 $this->ctrl = $DIC->ctrl();
180 $this->lng = $DIC->language();
181 $this->
user = $DIC->user();
182 $this->tpl = $DIC[
"tpl"];
183 $this->browser = $DIC[
"ilBrowser"];
203 self::$locations[$className] = $path;
218 self::$block_types[$className] = $identifier;
228 return $_GET[
"col_side"];
238 $this->coltype = $a_coltype;
248 return $this->coltype;
258 $this->side = $a_side;
278 $this->enableedit = $a_enableedit;
298 $this->repositorymode = $a_repositorymode;
318 $this->admincommands = $a_admincommands;
340 if (
$ilCtrl->getCmdClass() ==
"ilcolumngui") {
347 $cur_block_type =
"";
348 if (isset(
$_GET[
"block_type"]) &&
$_GET[
"block_type"]) {
349 $cur_block_type =
$_GET[
"block_type"];
350 } elseif (isset(
$_POST[
"block_type"])) {
351 $cur_block_type =
$_POST[
"block_type"];
354 if ($class = array_search($cur_block_type, self::$block_types)) {
355 include_once(
"./" . self::$locations[$class] .
"classes/" .
356 "class." . $class .
".php");
357 return call_user_func(array($class,
'getScreenMode'));
372 $this->block_property[$a_block_type][$a_property] = $a_value;
377 return $this->block_property[$a_block_type];
382 $this->block_property = $a_block_properties;
392 $this->repositoryitems = $a_repositoryitems;
415 $next_class =
$ilCtrl->getNextClass();
416 $cmd =
$ilCtrl->getCmd(
"getHTML");
418 $cur_block_type = (
$_GET[
"block_type"])
419 ?
$_GET[
"block_type"]
422 if ($next_class !=
"") {
424 if ($gui_class = array_search($cur_block_type, self::$block_types)) {
425 include_once(
"./" . self::$locations[$gui_class] .
"classes/" .
426 "class." . $gui_class .
".php");
427 $ilCtrl->setParameter($this,
"block_type", $cur_block_type);
428 $block_gui =
new $gui_class();
429 $block_gui->setProperties($this->block_property[$cur_block_type]);
434 if (in_array($gui_class, $this->custom_blocks[$this->
getColType()]) ||
435 in_array($cur_block_type, $this->rep_block_types)) {
436 $block_class = substr($gui_class, 0, strlen($gui_class) - 3);
437 include_once(
"./" . self::$locations[$gui_class] .
"classes/" .
438 "class." . $block_class .
".php");
439 $app_block =
new $block_class(
$_GET[
"block_id"]);
440 $block_gui->setBlock($app_block);
442 $html =
$ilCtrl->forwardCommand($block_gui);
443 $ilCtrl->setParameter($this,
"block_type",
"");
448 return $this->$cmd();
461 $this->tpl =
new ilTemplate(
"tpl.column.html",
true,
true,
"Services/Block");
466 $this->addHiddenBlockSelector();
469 return $this->tpl->get();
482 $sum_moveable = count($this->blocks[$this->
getSide()]);
484 foreach ($this->blocks[$this->
getSide()] as $block) {
485 if (
$ilCtrl->getContextObjType() !=
"user" ||
491 $gui_class = $block[
"class"];
492 $block_class = substr($block[
"class"], 0, strlen($block[
"class"]) - 3);
495 include_once(
"./" . self::$locations[$gui_class] .
"classes/" .
496 "class." . $gui_class .
".php");
497 $block_gui =
new $gui_class();
498 if (isset($this->block_property[$block[
"type"]])) {
499 $block_gui->setProperties($this->block_property[$block[
"type"]]);
506 if ($block[
"custom"]) {
507 $path =
"./" . self::$locations[$gui_class] .
"classes/" .
508 "class." . $block_class .
".php";
509 if (file_exists($path)) {
511 $app_block =
new $block_class($block[
"id"]);
516 $block_gui->setBlock($app_block);
517 if (isset($block[
"ref_id"])) {
518 $block_gui->setRefId($block[
"ref_id"]);
522 $ilCtrl->setParameter($this,
"block_type", $block_gui->getBlockType());
523 $this->tpl->setCurrentBlock(
"col_block");
525 $html =
$ilCtrl->getHTML($block_gui);
529 $this->tpl->setVariable(
"BLOCK", $html);
530 $this->tpl->parseCurrentBlock();
531 $ilCtrl->setParameter($this,
"block_type",
"");
535 if ($block[
"type"] !=
"pdfeedb" &&
536 $block[
"type"] !=
"news") {
548 public function addHiddenBlockSelector()
561 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
562 $hidden_blocks = array();
564 foreach ($this->blocks[$this->
getSide()] as $block) {
565 include_once(
"./" . self::$locations[$block[
"class"]] .
"classes/" .
566 "class." . $block[
"class"] .
".php");
568 if ($block[
"custom"] ==
false) {
569 if (
$ilCtrl->getContextObjType() ==
"user") {
571 $hidden_blocks[$block[
"type"]] =
$lng->txt(
'block_show_' . $block[
"type"]);
573 } elseif (
$ilCtrl->getContextObjType() !=
"") {
579 $hidden_blocks[$block[
"type"] .
"_" .
$ilCtrl->getContextObjId()] =
$lng->txt(
'block_show_' . $block[
"type"]);
588 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
590 $hidden_blocks[$block[
"type"] .
"_" . $block[
"id"]] = sprintf(
$lng->txt(
'block_show_x'), $cblock->getTitle());
594 if (count($hidden_blocks) > 0) {
595 foreach ($hidden_blocks as $id => $title) {
596 $ilCtrl->setParameter($this,
'block', $id);
597 $this->action_menu->addItem($title,
'',
$ilCtrl->getLinkTarget($this,
'activateBlock'));
598 $ilCtrl->setParameter($this,
'block',
'');
604 $add_blocks = array();
606 if (is_array($this->custom_blocks[$this->
getColType()])) {
607 foreach ($this->custom_blocks[$this->
getColType()] as $block_class) {
608 include_once(
"./" . self::$locations[$block_class] .
"classes/" .
609 "class." . $block_class .
".php");
610 $block_gui =
new $block_class();
611 $block_type = $block_gui->getBlockType();
617 $add_blocks[$block_type] =
$lng->txt(
'block_create_' . $block_type);
623 if (count($add_blocks) > 0) {
624 foreach ($add_blocks as $id => $title) {
625 $ilCtrl->setParameter($this,
'block_type', $id);
626 $this->action_menu->addItem($title,
'',
$ilCtrl->getLinkTarget($this,
'addBlock'));
627 $ilCtrl->setParameter($this,
'block_type',
'');
643 $sum_moveable = count($this->blocks[$this->
getSide()]);
645 foreach ($this->blocks[$this->
getSide()] as $block) {
646 include_once(
"./" . self::$locations[$block[
"class"]] .
"classes/" .
647 "class." . $block[
"class"] .
".php");
651 if (!$block[
"custom"] &&
$ilCtrl->getContextObjType() !=
"" &&
$ilCtrl->getContextObjType() !=
"user") {
652 $block[
"id"] =
$ilCtrl->getContextObjId();
657 if (
$_GET[
"block_id"] ==
"block_" . $block[
"type"] .
"_" . $block[
"id"]) {
658 $gui_class = $block[
"class"];
659 $block_class = substr($block[
"class"], 0, strlen($block[
"class"]) - 3);
661 $block_gui =
new $gui_class();
662 $block_gui->setProperties($this->block_property[$block[
"type"]]);
668 if ($block[
"custom"]) {
669 include_once(
"./" . self::$locations[$gui_class] .
"classes/" .
670 "class." . $block_class .
".php");
671 $app_block =
new $block_class($block[
"id"]);
672 $block_gui->setBlock($app_block);
673 $block_gui->setRefId($block[
"ref_id"]);
676 $ilCtrl->setParameter($this,
"block_type", $block[
"type"]);
677 echo
$ilCtrl->getHTML($block_gui);
682 if ($block[
"type"] !=
"pdfeedb" 683 && $block[
"type"] !=
"news") {
689 echo
"Error: ilColumnGUI::updateBlock: Block '" .
690 $_GET[
"block_id"] .
"' unknown.";
702 if (
$_GET[
"block"] !=
"") {
703 $block = explode(
"_",
$_GET[
"block"]);
704 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
708 $ilCtrl->returnToParent($this);
718 $class = array_search(
$_GET[
"block_type"], self::$block_types);
722 include_once(
"./" . self::$locations[$class] .
"classes/class." . $class .
".php");
723 $block_gui =
new $class();
724 $block_gui->setProperties($this->block_property[
$_GET[
"block_type"]]);
729 $ilCtrl->setParameter($this,
"block_type", $_GET[
"block_type"]);
730 $html =
$ilCtrl->forwardCommand($block_gui);
731 $ilCtrl->setParameter($this,
"block_type",
"");
744 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
754 if (is_array($this->default_blocks[$this->
getColType()])) {
755 foreach ($this->default_blocks[$this->
getColType()] as $class => $def_side) {
756 $type = self::$block_types[$class];
762 if (
$type ==
"news") {
765 if (
$type ==
"cal") {
768 if (
$type ==
"pdfeedb") {
771 if (
$type ==
"clsfct") {
775 if (
$side ===
false) {
782 $this->blocks[
$side][] = array(
793 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
795 $custom_block->setContextObjId(
$ilCtrl->getContextObjId());
796 $custom_block->setContextObjType(
$ilCtrl->getContextObjType());
797 $c_blocks = $custom_block->queryBlocksForContext();
799 foreach ($c_blocks as $c_block) {
800 $type = $c_block[
"type"];
803 $class = array_search(
$type, self::$block_types);
806 if (
$side ===
false) {
810 $this->blocks[
$side][] = array(
814 "id" => $c_block[
"id"],
819 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
822 foreach ($this->rep_block_types as $block_type) {
824 if (!is_array($rep_items[$block_type])) {
827 foreach ($rep_items[$block_type] as $item) {
829 $costum_block->setContextObjId($item[
"obj_id"]);
830 $costum_block->setContextObjType($block_type);
831 $c_blocks = $costum_block->queryBlocksForContext();
832 $c_block = $c_blocks[0];
835 $class = array_search(
$type, self::$block_types);
838 if (
$side ===
false) {
842 $this->blocks[
$side][] = array(
846 "id" => $c_block[
"id"],
848 "ref_id" => $item[
"ref_id"]);
854 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
856 $custom_block->setContextObjId(
$ilCtrl->getContextObjId());
857 $custom_block->setContextObjType(
$ilCtrl->getContextObjType());
858 $c_blocks = $custom_block->queryBlocksForContext(
false);
860 foreach ($c_blocks as $c_block) {
861 $type = $c_block[
"type"];
862 $class = array_search(
$type, self::$block_types);
868 $this->blocks[
$side][] = array(
872 "id" => $c_block[
"id"],
899 if (isset($this->check_global_activation[
$a_type]) && $this->check_global_activation[$a_type]) {
900 if ($a_type ==
'pdnews') {
901 return ($this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::NEWS) &&
903 } elseif ($a_type ==
'pdmail') {
904 return $this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::MAIL);
905 } elseif ($a_type ==
'pdtasks') {
906 return $this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::TASKS);
907 } elseif ($a_type ==
'news') {
908 include_once
'Services/Container/classes/class.ilContainer.php';
912 (!in_array(
$ilCtrl->getContextObjType(), [
"grp",
"crs"]) ||
914 $GLOBALS[
'ilCtrl']->getContextObjId(),
919 $GLOBALS[
'ilCtrl']->getContextObjId(),
923 } elseif (
$ilSetting->get(
"block_activated_" . $a_type)) {
925 } elseif ($a_type ==
'cal') {
926 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
928 } elseif ($a_type ==
'pdcal') {
929 if (!$this->dash_side_panel_settings->isEnabled($this->dash_side_panel_settings::CALENDAR)) {
932 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
934 } elseif ($a_type ==
"tagcld") {
936 return (
bool) $tags_active->get(
"enable",
false);
937 } elseif ($a_type ==
"clsfct") {
938 if (
$ilCtrl->getContextObjType() ==
"cat") {
942 return (
bool) $tags_active->get(
"enable",
false);
957 if ($this->check_nr_limit[
$a_type]) {
959 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
961 $costum_block->setContextObjId(
$ilCtrl->getContextObjId());
962 $costum_block->setContextObjType(
$ilCtrl->getContextObjType());
963 $costum_block->setType($a_type);
964 $res = $costum_block->queryCntBlockForContext();
965 $cnt = (int)
$res[0][
"cnt"];
971 if (
$ilSetting->get(
"block_limit_" . $a_type) > $cnt) {
983 public function saveBlockSortingAsynch()
998 if (in_array($this->
getColType(), array(
'pd'))) {
1001 foreach (array(IL_COL_LEFT => (array)
$_POST[IL_COL_LEFT][
'sequence'], IL_COL_RIGHT => (array)
$_POST[IL_COL_RIGHT][
'sequence']) as
$side => $blocks) {
1003 foreach ($blocks as $block) {
1004 $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 lookupCalendarActivated($a_obj_id)
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.
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.