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");
59 "ilNewsForContextBlockGUI" =>
"Services/News/",
60 "ilCalendarBlockGUI" =>
"Services/Calendar/",
61 "ilPDCalendarBlockGUI" =>
"Services/Calendar/",
62 "ilPDNotesBlockGUI" =>
"Services/Notes/",
63 "ilPDMailBlockGUI" =>
"Services/Mail/",
64 "ilUsersOnlineBlockGUI" =>
"Services/PersonalDesktop/",
65 "ilPDSysMessageBlockGUI" =>
"Services/Mail/",
66 "ilPDSelectedItemsBlockGUI" =>
"Services/PersonalDesktop/",
67 "ilBookmarkBlockGUI" =>
"Services/PersonalDesktop/",
68 "ilPDNewsBlockGUI" =>
"Services/News/",
69 "ilExternalFeedBlockGUI" =>
"Services/Block/",
70 "ilPDExternalFeedBlockGUI" =>
"Services/Feeds/",
71 "ilHtmlBlockGUI" =>
"Services/Block/",
72 "ilPDFeedbackBlockGUI" =>
"Services/Feedback/",
73 'ilPDTaggingBlockGUI' =>
'Services/Tagging/'
77 "ilPDMailBlockGUI" =>
"pdmail",
78 "ilPDNotesBlockGUI" =>
"pdnotes",
79 "ilUsersOnlineBlockGUI" =>
"pdusers",
80 "ilPDNewsBlockGUI" =>
"pdnews",
81 "ilBookmarkBlockGUI" =>
"pdbookm",
82 "ilNewsForContextBlockGUI" =>
"news",
83 "ilCalendarBlockGUI" =>
"cal",
84 "ilPDCalendarBlockGUI" =>
"pdcal",
85 "ilExternalFeedBlockGUI" =>
"feed",
86 "ilPDExternalFeedBlockGUI" =>
"pdfeed",
87 "ilPDFeedbackBlockGUI" =>
"pdfeedb",
88 "ilPDSysMessageBlockGUI" =>
"pdsysmess",
89 "ilPDSelectedItemsBlockGUI" =>
"pditems",
90 "ilHtmlBlockGUI" =>
"html",
91 'ilPDTaggingBlockGUI' =>
'pdtag'
96 "cat" => array(
"ilNewsForContextBlockGUI" =>
IL_COL_RIGHT),
104 "frm" => array(
"ilNewsForContextBlockGUI" =>
IL_COL_RIGHT),
131 "pd" => array(
"ilPDExternalFeedBlockGUI")
137 array(
"news" =>
true,
148 array(
"pdfeed" =>
true);
155 function ilColumnGUI($a_col_type =
"", $a_side =
"", $use_std_context =
false)
180 return $_GET[
"col_side"];
190 $this->coltype = $a_coltype;
200 return $this->coltype;
210 $this->side = $a_side;
230 $this->enableedit = $a_enableedit;
250 $this->repositorymode = $a_repositorymode;
270 $this->admincommands = $a_admincommands;
280 return $this->admincommands;
290 $this->movementmode = $a_movementmode;
300 return $this->movementmode;
310 $this->enablemovement = $a_enablemovement;
320 return $this->enablemovement;
330 if ($ilCtrl->getCmdClass() ==
"ilcolumngui")
332 switch ($ilCtrl->getCmd())
339 $cur_block_type = (
$_GET[
"block_type"])
340 ?
$_GET[
"block_type"]
341 : $_POST[
"block_type"];
343 if ($class = array_search($cur_block_type, self::$block_types))
345 include_once(
"./".self::$locations[$class].
"classes/".
346 "class.".$class.
".php");
347 return call_user_func(array($class,
'getScreenMode'));
362 $this->block_property[$a_block_type][$a_property] = $a_value;
367 return $this->block_property[$a_block_type];
372 $this->block_property = $a_block_properties;
382 $this->repositoryitems = $a_repositoryitems;
402 $ilCtrl->setParameter($this,
"col_side" ,$this->
getSide());
405 $next_class = $ilCtrl->getNextClass();
406 $cmd = $ilCtrl->getCmd(
"getHTML");
408 $cur_block_type = (
$_GET[
"block_type"])
409 ?
$_GET[
"block_type"]
410 : $_POST[
"block_type"];
412 if ($next_class !=
"")
415 if ($gui_class = array_search($cur_block_type, self::$block_types))
417 include_once(
"./".self::$locations[$gui_class].
"classes/".
418 "class.".$gui_class.
".php");
419 $ilCtrl->setParameter($this,
"block_type", $cur_block_type);
420 $block_gui =
new $gui_class();
421 $block_gui->setProperties($this->block_property[$cur_block_type]);
427 if (in_array($gui_class, $this->custom_blocks[$this->
getColType()]) ||
428 in_array($cur_block_type, $this->rep_block_types))
430 $block_class = substr($gui_class, 0, strlen($gui_class)-3);
431 include_once(
"./".self::$locations[$gui_class].
"classes/".
432 "class.".$block_class.
".php");
433 $app_block =
new $block_class(
$_GET[
"block_id"]);
434 $block_gui->setBlock($app_block);
436 $html = $ilCtrl->forwardCommand($block_gui);
437 $ilCtrl->setParameter($this,
"block_type",
"");
444 return $this->
$cmd();
455 $ilBench->start(
"Column",
"getHTML");
457 $ilCtrl->setParameter($this,
"col_side" ,$this->
getSide());
459 $this->tpl =
new ilTemplate(
"tpl.column.html",
true,
true,
"Services/Block");
461 $ilBench->start(
"Column",
"determineBlocks");
463 $ilBench->stop(
"Column",
"determineBlocks");
465 $ilBench->start(
"Column",
"showBlocks");
467 $ilBench->stop(
"Column",
"showBlocks");
474 $ilBench->stop(
"Column",
"getHTML");
476 return $this->tpl->get();
489 $sum_moveable = count($this->blocks[$this->
getSide()]);
491 foreach($this->blocks[$this->
getSide()] as $block)
493 if ($ilCtrl->getContextObjType() !=
"user" ||
495 $ilUser->getId(), $block[
"id"]) > 0)
497 $gui_class = $block[
"class"];
498 $block_class = substr($block[
"class"], 0, strlen($block[
"class"])-3);
501 include_once(
"./".self::$locations[$gui_class].
"classes/".
502 "class.".$gui_class.
".php");
503 $ilBench->start(
"Column",
"instantiate-".$block[
"type"]);
504 $block_gui =
new $gui_class();
505 $ilBench->stop(
"Column",
"instantiate-".$block[
"type"]);
506 $block_gui->setProperties($this->block_property[$block[
"type"]]);
514 if ($block[
"custom"])
516 include_once(
"./".self::$locations[$gui_class].
"classes/".
517 "class.".$block_class.
".php");
518 $app_block =
new $block_class($block[
"id"]);
519 $block_gui->setBlock($app_block);
520 $block_gui->setRefId($block[
"ref_id"]);
523 $ilCtrl->setParameter($this,
"block_type", $block_gui->getBlockType());
524 $this->tpl->setCurrentBlock(
"col_block");
526 $ilBench->start(
"Column",
"showBlocks-".$block_gui->getBlockType());
527 $html = $ilCtrl->getHTML($block_gui);
528 $ilBench->stop(
"Column",
"showBlocks-".$block_gui->getBlockType());
534 include_once(
"./Services/Block/classes/class.ilDummyBlockGUI.php");
536 $bl->setBlockId($block[
"id"]);
537 $bl->setBlockType($block[
"type"]);
538 $bl->setTitle($lng->txt(
"invisible_block"));
541 $html = $bl->getHTML();
547 $this->tpl->setVariable(
"BLOCK", $html);
548 $this->tpl->parseCurrentBlock();
549 $ilCtrl->setParameter($this,
"block_type",
"");
553 if ($block[
"type"] !=
"pdsysmess" && $block[
"type"] !=
"pdfeedb" &&
554 $block[
"type"] !=
"news")
570 $a_block_gui->setAllowMove(
"right");
574 $a_block_gui->setAllowMove(
"left");
578 $a_block_gui->setAllowMove(
"up");
580 if ($i < $sum_moveable)
582 $a_block_gui->setAllowMove(
"down");
594 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
595 $hidden_blocks = array();
596 $blocks = array(
"pdmail" => $lng->txt(
"mail"),
597 "pdnotes" => $lng->txt(
"notes"),
598 "pdusers" => $lng->txt(
"users_online"),
599 "pdnews" => $lng->txt(
"news"),
600 "pdbookm" => $lng->txt(
"my_bms"),
601 "news" => $lng->txt(
"news_internal_news"),
602 "feed" => $lng->txt(
"feed"),
603 "pdfeed" => $lng->txt(
"feed"),
604 "html" => $lng->txt(
"html_block"),
605 "pdtag" => $lng->txt(
"tagging_my_tags"),
606 "pdcal" => $lng->txt(
'calendar'),
609 foreach($this->blocks[$this->
getSide()] as $block)
611 include_once(
"./".self::$locations[$block[
"class"]].
"classes/".
612 "class.".$block[
"class"].
".php");
614 if ($block[
"custom"] ==
false)
616 if ($ilCtrl->getContextObjType() ==
"user")
620 $hidden_blocks[$block[
"type"]] = $blocks[$block[
"type"]];
623 else if ($ilCtrl->getContextObjType() !=
"")
626 $ilCtrl->getContextObjId()) == 0)
628 $hidden_blocks[$block[
"type"].
"_".$ilCtrl->getContextObjId()] = $blocks[$block[
"type"]];
637 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
639 $hidden_blocks[$block[
"type"].
"_".$block[
"id"]] =
644 if (count($hidden_blocks) > 0)
646 $this->tpl->setCurrentBlock(
"hidden_block_selector");
647 $this->tpl->setVariable(
"HB_ACTION", $ilCtrl->getFormAction($this));
649 false,
true, 0,
"ilEditSelect"));
650 $this->tpl->setVariable(
"TXT_ACTIVATE", $lng->txt(
"show"));
651 $this->tpl->parseCurrentBlock();
657 $add_blocks = array();
660 if (is_array($this->custom_blocks[$this->
getColType()]))
662 foreach($this->custom_blocks[$this->
getColType()] as $block_class)
664 include_once(
"./".self::$locations[$block_class].
"classes/".
665 "class.".$block_class.
".php");
666 $block_type = call_user_func(array($block_class,
'getBlockType'));
674 $add_blocks[$block_type] = $blocks[$block_type];
680 if (count($add_blocks) > 0)
682 $this->tpl->setCurrentBlock(
"add_block_selector");
683 $this->tpl->setVariable(
"AB_ACTION", $ilCtrl->getFormAction($this));
684 $this->tpl->setVariable(
"ADD_BLOCK_SEL",
ilUtil::formSelect(
"",
"block_type", $add_blocks,
685 false,
true, 0,
"ilEditSelect"));
686 $this->tpl->setVariable(
"TXT_ADD", $lng->txt(
"create"));
687 $this->tpl->parseCurrentBlock();
693 $this->tpl->setCurrentBlock(
"toggle_movement");
694 $this->tpl->setVariable(
"HREF_TOGGLE_MOVEMENT",
695 $ilCtrl->getLinkTarget($this,
"toggleMovement"));
698 $this->tpl->setVariable(
"TXT_TOGGLE_MOVEMENT",
699 $lng->txt(
"stop_moving_blocks"));
703 $this->tpl->setVariable(
"TXT_TOGGLE_MOVEMENT",
704 $lng->txt(
"move_blocks"));
706 $this->tpl->parseCurrentBlock();
719 $_SESSION[
"col_".$this->getColType().
"_".movement] =
"off";
723 $_SESSION[
"col_".$this->getColType().
"_".movement] =
"on";
725 $ilCtrl->returnToParent($this);
737 $sum_moveable = count($this->blocks[$this->
getSide()]);
739 foreach ($this->blocks[$this->
getSide()] as $block)
742 include_once(
"./".self::$locations[$block[
"class"]].
"classes/".
743 "class.".$block[
"class"].
".php");
747 if (!$block[
"custom"] && $ilCtrl->getContextObjType() !=
"" && $ilCtrl->getContextObjType() !=
"user")
749 $block[
"id"] = $ilCtrl->getContextObjId();
754 if (
$_GET[
"block_id"] ==
"block_".$block[
"type"].
"_".$block[
"id"])
756 $gui_class = $block[
"class"];
757 $block_class = substr($block[
"class"], 0, strlen($block[
"class"])-3);
759 $block_gui =
new $gui_class();
760 $block_gui->setProperties($this->block_property[$block[
"type"]]);
768 $block_gui->setAllowMove(
"right");
773 $block_gui->setAllowMove(
"left");
777 $block_gui->setAllowMove(
"up");
779 if ($i < $sum_moveable)
781 $block_gui->setAllowMove(
"down");
785 if ($block[
"custom"])
787 include_once(
"./".self::$locations[$gui_class].
"classes/".
788 "class.".$block_class.
".php");
789 $app_block =
new $block_class($block[
"id"]);
790 $block_gui->setBlock($app_block);
791 $block_gui->setRefId($block[
"ref_id"]);
794 $ilCtrl->setParameter($this,
"block_type", $block[
"type"]);
795 echo $ilCtrl->getHTML($block_gui);
801 if ($block[
"type"] !=
"pdsysmess" && $block[
"type"] !=
"pdfeedb"
802 && $block[
"type"] !=
"news")
811 echo
"Error: ilColumnGUI::updateBlock: Block '".
812 $_GET[
"block_id"].
"' unknown.";
823 if ($_POST[
"block"] !=
"")
825 $block = explode(
"_", $_POST[
"block"]);
826 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
830 $ilCtrl->returnToParent($this);
840 $class = array_search($_POST[
"block_type"], self::$block_types);
842 $ilCtrl->setCmdClass($class);
843 $ilCtrl->setCmd(
"create");
844 include_once(
"./".self::$locations[$class].
"classes/class.".$class.
".php");
845 $block_gui =
new $class();
846 $block_gui->setProperties($this->block_property[$_POST[
"block_type"]]);
852 $ilCtrl->setParameter($this,
"block_type", $_POST[
"block_type"]);
853 $html = $ilCtrl->forwardCommand($block_gui);
854 $ilCtrl->setParameter($this,
"block_type",
"");
865 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
875 if (is_array($this->default_blocks[$this->
getColType()]))
877 foreach($this->default_blocks[$this->
getColType()] as $class => $def_side)
879 $type = self::$block_types[$class];
899 if (
$type ==
"pdsysmess")
903 if (
$type ==
"pdfeedb")
913 $this->blocks[
$side][] = array(
925 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
927 $costum_block->setContextObjId($ilCtrl->getContextObjId());
928 $costum_block->setContextObjType($ilCtrl->getContextObjType());
929 $c_blocks = $costum_block->queryBlocksForContext();
931 foreach($c_blocks as $c_block)
933 $type = $c_block[
"type"];
937 $class = array_search(
$type, self::$block_types);
949 $this->blocks[
$side][] = array(
953 "id" => $c_block[
"id"],
960 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
963 foreach($this->rep_block_types as $block_type)
967 if (!is_array($rep_items[$block_type]))
971 foreach($rep_items[$block_type] as $item)
974 $costum_block->setContextObjId($item[
"obj_id"]);
975 $costum_block->setContextObjType($block_type);
976 $c_blocks = $costum_block->queryBlocksForContext();
977 $c_block = $c_blocks[0];
980 $class = array_search(
$type, self::$block_types);
992 $this->blocks[
$side][] = array(
996 "id" => $c_block[
"id"],
998 "ref_id" => $item[
"ref_id"]);
1020 if (in_array($this->
getColType(), array(
"pd",
"crs",
"cat",
"grp")))
1022 $bid = explode(
"_",
$_GET[
"block_id"]);
1024 foreach($this->blocks[$this->
getCmdSide()] as $block)
1028 $ilUser->getId(), $block[
"id"]) != 0)
1036 if ($block[
"type"] == $bid[0] && $block[
"id"] == $bid[1])
1038 if (
$_GET[
"move_dir"] ==
"up")
1042 if (
$_GET[
"move_dir"] ==
"down")
1046 if (
$_GET[
"move_dir"] ==
"left")
1051 if (
$_GET[
"move_dir"] ==
"right")
1065 $ilCtrl->returnToParent($this);
1074 if ($this->check_global_activation[$a_type])
1076 if ($a_type ==
'pdbookm')
1078 if (!$ilSetting->get(
"disable_bookmarks"))
1084 else if ($a_type ==
'pdnotes')
1086 if (!$ilSetting->get(
"disable_notes"))
1092 else if ($ilSetting->get(
"block_activated_".$a_type))
1096 elseif($a_type ==
'cal' || $a_type ==
'pdcal')
1098 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
1113 if ($this->check_nr_limit[$a_type])
1117 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
1119 $costum_block->setContextObjId($ilCtrl->getContextObjId());
1120 $costum_block->setContextObjType($ilCtrl->getContextObjType());
1121 $costum_block->setType($a_type);
1122 $res = $costum_block->queryCntBlockForContext();
1123 $cnt = (int)
$res[0][
"cnt"];
1131 if ($ilSetting->get(
"block_limit_".$a_type) > $cnt)