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");
43 "ilNewsForContextBlockGUI" =>
"Services/News/",
44 "ilCalendarBlockGUI" =>
"Services/Calendar/",
45 "ilPDCalendarBlockGUI" =>
"Services/Calendar/",
46 "ilPDNotesBlockGUI" =>
"Services/Notes/",
47 "ilPDMailBlockGUI" =>
"Services/Mail/",
48 "ilUsersOnlineBlockGUI" =>
"Services/PersonalDesktop/",
49 "ilPDSysMessageBlockGUI" =>
"Services/Mail/",
50 "ilPDSelectedItemsBlockGUI" =>
"Services/PersonalDesktop/",
51 "ilBookmarkBlockGUI" =>
"Services/PersonalDesktop/",
52 "ilPDNewsBlockGUI" =>
"Services/News/",
53 "ilExternalFeedBlockGUI" =>
"Services/Block/",
54 "ilPDExternalFeedBlockGUI" =>
"Services/Feeds/",
55 "ilHtmlBlockGUI" =>
"Services/Block/",
56 "ilPDFeedbackBlockGUI" =>
"Services/Feedback/",
57 'ilPDTaggingBlockGUI' =>
'Services/Tagging/',
58 'ilChatroomBlockGUI' =>
'Modules/Chatroom/'
62 "ilPDMailBlockGUI" =>
"pdmail",
63 "ilPDNotesBlockGUI" =>
"pdnotes",
64 "ilUsersOnlineBlockGUI" =>
"pdusers",
65 "ilPDNewsBlockGUI" =>
"pdnews",
66 "ilBookmarkBlockGUI" =>
"pdbookm",
67 "ilNewsForContextBlockGUI" =>
"news",
68 "ilCalendarBlockGUI" =>
"cal",
69 "ilPDCalendarBlockGUI" =>
"pdcal",
70 "ilExternalFeedBlockGUI" =>
"feed",
71 "ilPDExternalFeedBlockGUI" =>
"pdfeed",
72 "ilPDFeedbackBlockGUI" =>
"pdfeedb",
73 "ilPDSysMessageBlockGUI" =>
"pdsysmess",
74 "ilPDSelectedItemsBlockGUI" =>
"pditems",
75 "ilHtmlBlockGUI" =>
"html",
76 'ilPDTaggingBlockGUI' =>
'pdtag',
77 'ilChatroomBlockGUI' =>
'chatviewer'
82 "cat" => array(
"ilNewsForContextBlockGUI" =>
IL_COL_RIGHT),
90 "frm" => array(
"ilNewsForContextBlockGUI" =>
IL_COL_RIGHT),
118 "pd" => array(
"ilPDExternalFeedBlockGUI")
124 array(
"news" =>
true,
133 "chatviewer" =>
true);
136 array(
"pdfeed" =>
true);
143 function ilColumnGUI($a_col_type =
"", $a_side =
"", $use_std_context =
false)
174 self::$locations[$className] =
$path;
189 self::$block_types[$className] = $identifier;
199 return $_GET[
"col_side"];
209 $this->coltype = $a_coltype;
219 return $this->coltype;
229 $this->side = $a_side;
249 $this->enableedit = $a_enableedit;
269 $this->repositorymode = $a_repositorymode;
289 $this->admincommands = $a_admincommands;
309 $this->movementmode = $a_movementmode;
329 $this->enablemovement = $a_enablemovement;
349 if ($ilCtrl->getCmdClass() ==
"ilcolumngui")
351 switch ($ilCtrl->getCmd())
358 $cur_block_type =
"";
359 if (isset(
$_GET[
"block_type"]) &&
$_GET[
"block_type"])
361 $cur_block_type =
$_GET[
"block_type"];
363 else if (isset(
$_POST[
"block_type"]))
365 $cur_block_type =
$_POST[
"block_type"];
368 if ($class = array_search($cur_block_type, self::$block_types))
370 include_once(
"./".self::$locations[$class].
"classes/".
371 "class.".$class.
".php");
372 return call_user_func(array($class,
'getScreenMode'));
387 $this->block_property[$a_block_type][$a_property] = $a_value;
392 return $this->block_property[$a_block_type];
397 $this->block_property = $a_block_properties;
407 $this->repositoryitems = $a_repositoryitems;
427 $ilCtrl->setParameter($this,
"col_side" ,$this->
getSide());
430 $next_class = $ilCtrl->getNextClass();
431 $cmd = $ilCtrl->getCmd(
"getHTML");
433 $cur_block_type = (
$_GET[
"block_type"])
434 ?
$_GET[
"block_type"]
437 if ($next_class !=
"")
440 if ($gui_class = array_search($cur_block_type, self::$block_types))
442 include_once(
"./".self::$locations[$gui_class].
"classes/".
443 "class.".$gui_class.
".php");
444 $ilCtrl->setParameter($this,
"block_type", $cur_block_type);
445 $block_gui =
new $gui_class();
446 $block_gui->setProperties($this->block_property[$cur_block_type]);
452 if (in_array($gui_class, $this->custom_blocks[$this->
getColType()]) ||
453 in_array($cur_block_type, $this->rep_block_types))
455 $block_class = substr($gui_class, 0, strlen($gui_class)-3);
456 include_once(
"./".self::$locations[$gui_class].
"classes/".
457 "class.".$block_class.
".php");
458 $app_block =
new $block_class(
$_GET[
"block_id"]);
459 $block_gui->setBlock($app_block);
461 $html = $ilCtrl->forwardCommand($block_gui);
462 $ilCtrl->setParameter($this,
"block_type",
"");
469 return $this->
$cmd();
480 $ilBench->start(
"Column",
"getHTML");
482 $ilCtrl->setParameter($this,
"col_side" ,$this->
getSide());
484 $this->tpl =
new ilTemplate(
"tpl.column.html",
true,
true,
"Services/Block");
486 $ilBench->start(
"Column",
"determineBlocks");
488 $ilBench->stop(
"Column",
"determineBlocks");
490 $ilBench->start(
"Column",
"showBlocks");
492 $ilBench->stop(
"Column",
"showBlocks");
499 $ilBench->stop(
"Column",
"getHTML");
501 return $this->tpl->get();
514 $sum_moveable = count($this->blocks[$this->
getSide()]);
516 foreach($this->blocks[$this->
getSide()] as $block)
518 if ($ilCtrl->getContextObjType() !=
"user" ||
520 $ilUser->getId(), $block[
"id"]) > 0)
522 $gui_class = $block[
"class"];
523 $block_class = substr($block[
"class"], 0, strlen($block[
"class"])-3);
526 include_once(
"./".self::$locations[$gui_class].
"classes/".
527 "class.".$gui_class.
".php");
528 $ilBench->start(
"Column",
"instantiate-".$block[
"type"]);
529 $block_gui =
new $gui_class();
530 $ilBench->stop(
"Column",
"instantiate-".$block[
"type"]);
531 if (isset($this->block_property[$block[
"type"]]))
533 $block_gui->setProperties($this->block_property[$block[
"type"]]);
542 if ($block[
"custom"])
544 include_once(
"./".self::$locations[$gui_class].
"classes/".
545 "class.".$block_class.
".php");
546 $app_block =
new $block_class($block[
"id"]);
547 $block_gui->setBlock($app_block);
548 if (isset($block[
"ref_id"]))
550 $block_gui->setRefId($block[
"ref_id"]);
554 $ilCtrl->setParameter($this,
"block_type", $block_gui->getBlockType());
555 $this->tpl->setCurrentBlock(
"col_block");
557 $ilBench->start(
"Column",
"showBlocks-".$block_gui->getBlockType());
558 $html = $ilCtrl->getHTML($block_gui);
559 $ilBench->stop(
"Column",
"showBlocks-".$block_gui->getBlockType());
565 include_once(
"./Services/Block/classes/class.ilDummyBlockGUI.php");
567 $bl->setBlockId($block[
"id"]);
568 $bl->setBlockType($block[
"type"]);
569 $bl->setTitle($lng->txt(
"invisible_block"));
572 $html = $bl->getHTML();
578 $this->tpl->setVariable(
"BLOCK", $html);
579 $this->tpl->parseCurrentBlock();
580 $ilCtrl->setParameter($this,
"block_type",
"");
584 if ($block[
"type"] !=
"pdsysmess" && $block[
"type"] !=
"pdfeedb" &&
585 $block[
"type"] !=
"news")
601 $a_block_gui->setAllowMove(
"right");
605 $a_block_gui->setAllowMove(
"left");
609 $a_block_gui->setAllowMove(
"up");
611 if ($i < $sum_moveable)
613 $a_block_gui->setAllowMove(
"down");
624 $bl_management =
false;
627 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
628 $hidden_blocks = array();
629 $blocks = array(
"pdmail" => $lng->txt(
"mail"),
630 "pdnotes" => $lng->txt(
"notes"),
631 "pdusers" => $lng->txt(
"users_online"),
632 "pdnews" => $lng->txt(
"news"),
633 "pdbookm" => $lng->txt(
"my_bms"),
634 "news" => $lng->txt(
"news_internal_news"),
635 "feed" => $lng->txt(
"feed"),
636 "pdfeed" => $lng->txt(
"feed"),
637 "html" => $lng->txt(
"html_block"),
638 "pdtag" => $lng->txt(
"tagging_my_tags"),
639 "pdcal" => $lng->txt(
'calendar'),
640 "chatviewer" => $lng->txt(
'chat_chatviewer'),
643 foreach($this->blocks[$this->
getSide()] as $block)
645 include_once(
"./".self::$locations[$block[
"class"]].
"classes/".
646 "class.".$block[
"class"].
".php");
648 if ($block[
"custom"] ==
false)
650 if ($ilCtrl->getContextObjType() ==
"user")
654 $hidden_blocks[$block[
"type"]] = $blocks[$block[
"type"]];
657 else if ($ilCtrl->getContextObjType() !=
"")
660 $ilCtrl->getContextObjId()) == 0)
662 $hidden_blocks[$block[
"type"].
"_".$ilCtrl->getContextObjId()] = $blocks[$block[
"type"]];
671 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
673 $hidden_blocks[$block[
"type"].
"_".$block[
"id"]] =
678 if (count($hidden_blocks) > 0)
680 $this->tpl->setCurrentBlock(
"hidden_block_selector");
681 $this->tpl->setVariable(
"HB_ACTION", $ilCtrl->getFormAction($this));
683 false,
true, 0,
"ilEditSelect", array(
"id" =>
"il_show_bl_sel_".$this->
getSide())));
684 $this->tpl->setVariable(
"LAB_ID",
"il_show_bl_sel_".$this->
getSide());
685 $this->tpl->setVariable(
"TXT_ACTIVATE", $lng->txt(
"show"));
686 $this->tpl->setVariable(
"TXT_SHOW_HIDDEN_BLOCK",
687 $lng->txt(
"show_hidden_block"));
688 $this->tpl->parseCurrentBlock();
689 $bl_management =
true;
695 $add_blocks = array();
698 if (is_array($this->custom_blocks[$this->
getColType()]))
700 foreach($this->custom_blocks[$this->
getColType()] as $block_class)
702 include_once(
"./".self::$locations[$block_class].
"classes/".
703 "class.".$block_class.
".php");
704 $block_type = call_user_func(array($block_class,
'getBlockType'));
712 $add_blocks[$block_type] = $blocks[$block_type];
718 if (count($add_blocks) > 0)
720 $this->tpl->setCurrentBlock(
"add_block_selector");
721 $ilCtrl->setParameter($this,
"block_type",
"");
722 $this->tpl->setVariable(
"AB_ACTION", $ilCtrl->getFormAction($this));
723 $this->tpl->setVariable(
"ADD_BLOCK_SEL",
ilUtil::formSelect(
"",
"block_type", $add_blocks,
724 false,
true, 0,
"ilEditSelect", array(
"id" =>
"il_add_bl_sel_".$this->
getSide())));
725 $this->tpl->setVariable(
"LAB_ID",
"il_add_bl_sel_".$this->
getSide());
726 $this->tpl->setVariable(
"TXT_ADD", $lng->txt(
"create"));
727 $this->tpl->setVariable(
"TXT_CREATE_BLOCK",
728 $lng->txt(
"create_block"));
729 $this->tpl->parseCurrentBlock();
730 $bl_management =
true;
736 $this->tpl->setCurrentBlock(
"toggle_movement");
737 $this->tpl->setVariable(
"HREF_TOGGLE_MOVEMENT",
738 $ilCtrl->getLinkTarget($this,
"toggleMovement"));
741 $this->tpl->setVariable(
"TXT_TOGGLE_MOVEMENT",
742 $lng->txt(
"stop_moving_blocks"));
746 $this->tpl->setVariable(
"TXT_TOGGLE_MOVEMENT",
747 $lng->txt(
"move_blocks"));
749 $this->tpl->parseCurrentBlock();
750 $bl_management =
true;
755 $this->tpl->setCurrentBlock(
"block_management");
756 $this->tpl->setVariable(
"TXT_BLOCK_MANAGEMENT",
757 $lng->txt(
"block_management"));
758 $this->tpl->parseCurrentBlock();
771 $_SESSION[
"col_".$this->getColType().
"_movement"] =
"off";
775 $_SESSION[
"col_".$this->getColType().
"_movement"] =
"on";
777 $ilCtrl->returnToParent($this);
789 $sum_moveable = count($this->blocks[$this->
getSide()]);
791 foreach ($this->blocks[$this->
getSide()] as $block)
794 include_once(
"./".self::$locations[$block[
"class"]].
"classes/".
795 "class.".$block[
"class"].
".php");
799 if (!$block[
"custom"] && $ilCtrl->getContextObjType() !=
"" && $ilCtrl->getContextObjType() !=
"user")
801 $block[
"id"] = $ilCtrl->getContextObjId();
806 if (
$_GET[
"block_id"] ==
"block_".$block[
"type"].
"_".$block[
"id"])
808 $gui_class = $block[
"class"];
809 $block_class = substr($block[
"class"], 0, strlen($block[
"class"])-3);
811 $block_gui =
new $gui_class();
812 $block_gui->setProperties($this->block_property[$block[
"type"]]);
820 $block_gui->setAllowMove(
"right");
825 $block_gui->setAllowMove(
"left");
829 $block_gui->setAllowMove(
"up");
831 if ($i < $sum_moveable)
833 $block_gui->setAllowMove(
"down");
837 if ($block[
"custom"])
839 include_once(
"./".self::$locations[$gui_class].
"classes/".
840 "class.".$block_class.
".php");
841 $app_block =
new $block_class($block[
"id"]);
842 $block_gui->setBlock($app_block);
843 $block_gui->setRefId($block[
"ref_id"]);
846 $ilCtrl->setParameter($this,
"block_type", $block[
"type"]);
847 echo $ilCtrl->getHTML($block_gui);
853 if ($block[
"type"] !=
"pdsysmess" && $block[
"type"] !=
"pdfeedb"
854 && $block[
"type"] !=
"news")
863 echo
"Error: ilColumnGUI::updateBlock: Block '".
864 $_GET[
"block_id"].
"' unknown.";
875 if (
$_POST[
"block"] !=
"")
877 $block = explode(
"_",
$_POST[
"block"]);
878 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
882 $ilCtrl->returnToParent($this);
892 $class = array_search(
$_POST[
"block_type"], self::$block_types);
894 $ilCtrl->setCmdClass($class);
895 $ilCtrl->setCmd(
"create");
896 include_once(
"./".self::$locations[$class].
"classes/class.".$class.
".php");
897 $block_gui =
new $class();
898 $block_gui->setProperties($this->block_property[
$_POST[
"block_type"]]);
904 $ilCtrl->setParameter($this,
"block_type", $_POST[
"block_type"]);
905 $html = $ilCtrl->forwardCommand($block_gui);
906 $ilCtrl->setParameter($this,
"block_type",
"");
917 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
927 if (is_array($this->default_blocks[$this->
getColType()]))
929 foreach($this->default_blocks[$this->
getColType()] as $class => $def_side)
931 $type = self::$block_types[$class];
951 if (
$type ==
"pdsysmess")
955 if (
$type ==
"pdfeedb")
965 $this->blocks[
$side][] = array(
977 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
979 $costum_block->setContextObjId($ilCtrl->getContextObjId());
980 $costum_block->setContextObjType($ilCtrl->getContextObjType());
981 $c_blocks = $costum_block->queryBlocksForContext();
983 foreach($c_blocks as $c_block)
985 $type = $c_block[
"type"];
989 $class = array_search(
$type, self::$block_types);
1001 $this->blocks[
$side][] = array(
1005 "id" => $c_block[
"id"],
1012 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
1015 foreach($this->rep_block_types as $block_type)
1019 if (!is_array($rep_items[$block_type]))
1023 foreach($rep_items[$block_type] as $item)
1026 $costum_block->setContextObjId($item[
"obj_id"]);
1027 $costum_block->setContextObjType($block_type);
1028 $c_blocks = $costum_block->queryBlocksForContext();
1029 $c_block = $c_blocks[0];
1031 $type = $block_type;
1032 $class = array_search(
$type, self::$block_types);
1039 if (
$side ===
false)
1044 $this->blocks[
$side][] = array(
1048 "id" => $c_block[
"id"],
1050 "ref_id" => $item[
"ref_id"]);
1072 if (in_array($this->
getColType(), array(
"pd",
"crs",
"cat",
"grp")))
1074 $bid = explode(
"_",
$_GET[
"block_id"]);
1076 foreach($this->blocks[$this->
getCmdSide()] as $block)
1080 $ilUser->getId(), $block[
"id"]) != 0)
1088 if ($block[
"type"] == $bid[0] && $block[
"id"] == $bid[1])
1090 if (
$_GET[
"move_dir"] ==
"up")
1094 if (
$_GET[
"move_dir"] ==
"down")
1098 if (
$_GET[
"move_dir"] ==
"left")
1103 if (
$_GET[
"move_dir"] ==
"right")
1117 $ilCtrl->returnToParent($this);
1126 if (isset($this->check_global_activation[$a_type]) && $this->check_global_activation[$a_type])
1128 if ($a_type ==
'pdbookm')
1130 if (!$ilSetting->get(
"disable_bookmarks"))
1136 else if ($a_type ==
'pdnotes')
1138 if (!$ilSetting->get(
"disable_notes"))
1144 else if ($ilSetting->get(
"block_activated_".$a_type))
1148 elseif($a_type ==
'cal' || $a_type ==
'pdcal')
1150 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
1165 if ($this->check_nr_limit[$a_type])
1169 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
1171 $costum_block->setContextObjId($ilCtrl->getContextObjId());
1172 $costum_block->setContextObjType($ilCtrl->getContextObjType());
1173 $costum_block->setType($a_type);
1174 $res = $costum_block->queryCntBlockForContext();
1175 $cnt = (int)
$res[0][
"cnt"];
1183 if ($ilSetting->get(
"block_limit_".$a_type) > $cnt)