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/',
61 "ilPDMailBlockGUI" =>
"pdmail",
62 "ilPDNotesBlockGUI" =>
"pdnotes",
63 "ilUsersOnlineBlockGUI" =>
"pdusers",
64 "ilPDNewsBlockGUI" =>
"pdnews",
65 "ilBookmarkBlockGUI" =>
"pdbookm",
66 "ilNewsForContextBlockGUI" =>
"news",
67 "ilCalendarBlockGUI" =>
"cal",
68 "ilPDCalendarBlockGUI" =>
"pdcal",
69 "ilExternalFeedBlockGUI" =>
"feed",
70 "ilPDExternalFeedBlockGUI" =>
"pdfeed",
71 "ilPDFeedbackBlockGUI" =>
"pdfeedb",
72 "ilPDSysMessageBlockGUI" =>
"pdsysmess",
73 "ilPDSelectedItemsBlockGUI" =>
"pditems",
74 "ilHtmlBlockGUI" =>
"html",
75 'ilPDTaggingBlockGUI' =>
'pdtag',
80 "cat" => array(
"ilNewsForContextBlockGUI" =>
IL_COL_RIGHT),
113 "pd" => array(
"ilPDExternalFeedBlockGUI")
119 array(
"news" =>
true,
130 array(
"pdfeed" =>
true);
137 function ilColumnGUI($a_col_type =
"", $a_side =
"", $use_std_context =
false)
163 return $_GET[
"col_side"];
173 $this->coltype = $a_coltype;
183 return $this->coltype;
193 $this->side = $a_side;
213 $this->enableedit = $a_enableedit;
233 $this->repositorymode = $a_repositorymode;
253 $this->admincommands = $a_admincommands;
273 $this->movementmode = $a_movementmode;
293 $this->enablemovement = $a_enablemovement;
313 if ($ilCtrl->getCmdClass() ==
"ilcolumngui")
315 switch ($ilCtrl->getCmd())
322 $cur_block_type =
"";
323 if (isset(
$_GET[
"block_type"]) &&
$_GET[
"block_type"])
325 $cur_block_type =
$_GET[
"block_type"];
327 else if (isset(
$_POST[
"block_type"]))
329 $cur_block_type =
$_POST[
"block_type"];
332 if ($class = array_search($cur_block_type, self::$block_types))
334 include_once(
"./".self::$locations[$class].
"classes/".
335 "class.".$class.
".php");
336 return call_user_func(array($class,
'getScreenMode'));
351 $this->block_property[$a_block_type][$a_property] = $a_value;
356 return $this->block_property[$a_block_type];
361 $this->block_property = $a_block_properties;
371 $this->repositoryitems = $a_repositoryitems;
391 $ilCtrl->setParameter($this,
"col_side" ,$this->
getSide());
394 $next_class = $ilCtrl->getNextClass();
395 $cmd = $ilCtrl->getCmd(
"getHTML");
397 $cur_block_type = (
$_GET[
"block_type"])
398 ?
$_GET[
"block_type"]
401 if ($next_class !=
"")
404 if ($gui_class = array_search($cur_block_type, self::$block_types))
406 include_once(
"./".self::$locations[$gui_class].
"classes/".
407 "class.".$gui_class.
".php");
408 $ilCtrl->setParameter($this,
"block_type", $cur_block_type);
409 $block_gui =
new $gui_class();
410 $block_gui->setProperties($this->block_property[$cur_block_type]);
416 if (in_array($gui_class, $this->custom_blocks[$this->
getColType()]) ||
417 in_array($cur_block_type, $this->rep_block_types))
419 $block_class = substr($gui_class, 0, strlen($gui_class)-3);
420 include_once(
"./".self::$locations[$gui_class].
"classes/".
421 "class.".$block_class.
".php");
422 $app_block =
new $block_class(
$_GET[
"block_id"]);
423 $block_gui->setBlock($app_block);
425 $html = $ilCtrl->forwardCommand($block_gui);
426 $ilCtrl->setParameter($this,
"block_type",
"");
433 return $this->
$cmd();
444 $ilBench->start(
"Column",
"getHTML");
446 $ilCtrl->setParameter($this,
"col_side" ,$this->
getSide());
448 $this->tpl =
new ilTemplate(
"tpl.column.html",
true,
true,
"Services/Block");
450 $ilBench->start(
"Column",
"determineBlocks");
452 $ilBench->stop(
"Column",
"determineBlocks");
454 $ilBench->start(
"Column",
"showBlocks");
456 $ilBench->stop(
"Column",
"showBlocks");
463 $ilBench->stop(
"Column",
"getHTML");
465 return $this->tpl->get();
478 $sum_moveable = count($this->blocks[$this->
getSide()]);
480 foreach($this->blocks[$this->
getSide()] as $block)
482 if ($ilCtrl->getContextObjType() !=
"user" ||
484 $ilUser->getId(), $block[
"id"]) > 0)
486 $gui_class = $block[
"class"];
487 $block_class = substr($block[
"class"], 0, strlen($block[
"class"])-3);
490 include_once(
"./".self::$locations[$gui_class].
"classes/".
491 "class.".$gui_class.
".php");
492 $ilBench->start(
"Column",
"instantiate-".$block[
"type"]);
493 $block_gui =
new $gui_class();
494 $ilBench->stop(
"Column",
"instantiate-".$block[
"type"]);
495 if (isset($this->block_property[$block[
"type"]]))
497 $block_gui->setProperties($this->block_property[$block[
"type"]]);
506 if ($block[
"custom"])
508 include_once(
"./".self::$locations[$gui_class].
"classes/".
509 "class.".$block_class.
".php");
510 $app_block =
new $block_class($block[
"id"]);
511 $block_gui->setBlock($app_block);
512 if (isset($block[
"ref_id"]))
514 $block_gui->setRefId($block[
"ref_id"]);
518 $ilCtrl->setParameter($this,
"block_type", $block_gui->getBlockType());
519 $this->tpl->setCurrentBlock(
"col_block");
521 $ilBench->start(
"Column",
"showBlocks-".$block_gui->getBlockType());
522 $html = $ilCtrl->getHTML($block_gui);
523 $ilBench->stop(
"Column",
"showBlocks-".$block_gui->getBlockType());
529 include_once(
"./Services/Block/classes/class.ilDummyBlockGUI.php");
531 $bl->setBlockId($block[
"id"]);
532 $bl->setBlockType($block[
"type"]);
533 $bl->setTitle($lng->txt(
"invisible_block"));
536 $html = $bl->getHTML();
542 $this->tpl->setVariable(
"BLOCK", $html);
543 $this->tpl->parseCurrentBlock();
544 $ilCtrl->setParameter($this,
"block_type",
"");
548 if ($block[
"type"] !=
"pdsysmess" && $block[
"type"] !=
"pdfeedb" &&
549 $block[
"type"] !=
"news")
565 $a_block_gui->setAllowMove(
"right");
569 $a_block_gui->setAllowMove(
"left");
573 $a_block_gui->setAllowMove(
"up");
575 if ($i < $sum_moveable)
577 $a_block_gui->setAllowMove(
"down");
588 $bl_management =
false;
591 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
592 $hidden_blocks = array();
593 $blocks = array(
"pdmail" => $lng->txt(
"mail"),
594 "pdnotes" => $lng->txt(
"notes"),
595 "pdusers" => $lng->txt(
"users_online"),
596 "pdnews" => $lng->txt(
"news"),
597 "pdbookm" => $lng->txt(
"my_bms"),
598 "news" => $lng->txt(
"news_internal_news"),
599 "feed" => $lng->txt(
"feed"),
600 "pdfeed" => $lng->txt(
"feed"),
601 "html" => $lng->txt(
"html_block"),
602 "pdtag" => $lng->txt(
"tagging_my_tags"),
603 "pdcal" => $lng->txt(
'calendar')
606 foreach($this->blocks[$this->
getSide()] as $block)
608 include_once(
"./".self::$locations[$block[
"class"]].
"classes/".
609 "class.".$block[
"class"].
".php");
611 if ($block[
"custom"] ==
false)
613 if ($ilCtrl->getContextObjType() ==
"user")
617 $hidden_blocks[$block[
"type"]] = $blocks[$block[
"type"]];
620 else if ($ilCtrl->getContextObjType() !=
"")
623 $ilCtrl->getContextObjId()) == 0)
625 $hidden_blocks[$block[
"type"].
"_".$ilCtrl->getContextObjId()] = $blocks[$block[
"type"]];
634 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
636 $hidden_blocks[$block[
"type"].
"_".$block[
"id"]] =
641 if (count($hidden_blocks) > 0)
643 $this->tpl->setCurrentBlock(
"hidden_block_selector");
644 $this->tpl->setVariable(
"HB_ACTION", $ilCtrl->getFormAction($this));
646 false,
true, 0,
"ilEditSelect", array(
"id" =>
"il_show_bl_sel_".$this->
getSide())));
647 $this->tpl->setVariable(
"LAB_ID",
"il_show_bl_sel_".$this->
getSide());
648 $this->tpl->setVariable(
"TXT_ACTIVATE", $lng->txt(
"show"));
649 $this->tpl->setVariable(
"TXT_SHOW_HIDDEN_BLOCK",
650 $lng->txt(
"show_hidden_block"));
651 $this->tpl->parseCurrentBlock();
652 $bl_management =
true;
658 $add_blocks = array();
661 if (is_array($this->custom_blocks[$this->
getColType()]))
663 foreach($this->custom_blocks[$this->
getColType()] as $block_class)
665 include_once(
"./".self::$locations[$block_class].
"classes/".
666 "class.".$block_class.
".php");
667 $block_type = call_user_func(array($block_class,
'getBlockType'));
675 $add_blocks[$block_type] = $blocks[$block_type];
681 if (count($add_blocks) > 0)
683 $this->tpl->setCurrentBlock(
"add_block_selector");
684 $ilCtrl->setParameter($this,
"block_type",
"");
685 $this->tpl->setVariable(
"AB_ACTION", $ilCtrl->getFormAction($this));
686 $this->tpl->setVariable(
"ADD_BLOCK_SEL",
ilUtil::formSelect(
"",
"block_type", $add_blocks,
687 false,
true, 0,
"ilEditSelect", array(
"id" =>
"il_add_bl_sel_".$this->
getSide())));
688 $this->tpl->setVariable(
"LAB_ID",
"il_add_bl_sel_".$this->
getSide());
689 $this->tpl->setVariable(
"TXT_ADD", $lng->txt(
"create"));
690 $this->tpl->setVariable(
"TXT_CREATE_BLOCK",
691 $lng->txt(
"create_block"));
692 $this->tpl->parseCurrentBlock();
693 $bl_management =
true;
699 $this->tpl->setCurrentBlock(
"toggle_movement");
700 $this->tpl->setVariable(
"HREF_TOGGLE_MOVEMENT",
701 $ilCtrl->getLinkTarget($this,
"toggleMovement"));
704 $this->tpl->setVariable(
"TXT_TOGGLE_MOVEMENT",
705 $lng->txt(
"stop_moving_blocks"));
709 $this->tpl->setVariable(
"TXT_TOGGLE_MOVEMENT",
710 $lng->txt(
"move_blocks"));
712 $this->tpl->parseCurrentBlock();
713 $bl_management =
true;
718 $this->tpl->setCurrentBlock(
"block_management");
719 $this->tpl->setVariable(
"TXT_BLOCK_MANAGEMENT",
720 $lng->txt(
"block_management"));
721 $this->tpl->parseCurrentBlock();
734 $_SESSION[
"col_".$this->getColType().
"_movement"] =
"off";
738 $_SESSION[
"col_".$this->getColType().
"_movement"] =
"on";
740 $ilCtrl->returnToParent($this);
752 $sum_moveable = count($this->blocks[$this->
getSide()]);
754 foreach ($this->blocks[$this->
getSide()] as $block)
757 include_once(
"./".self::$locations[$block[
"class"]].
"classes/".
758 "class.".$block[
"class"].
".php");
762 if (!$block[
"custom"] && $ilCtrl->getContextObjType() !=
"" && $ilCtrl->getContextObjType() !=
"user")
764 $block[
"id"] = $ilCtrl->getContextObjId();
769 if (
$_GET[
"block_id"] ==
"block_".$block[
"type"].
"_".$block[
"id"])
771 $gui_class = $block[
"class"];
772 $block_class = substr($block[
"class"], 0, strlen($block[
"class"])-3);
774 $block_gui =
new $gui_class();
775 $block_gui->setProperties($this->block_property[$block[
"type"]]);
783 $block_gui->setAllowMove(
"right");
788 $block_gui->setAllowMove(
"left");
792 $block_gui->setAllowMove(
"up");
794 if ($i < $sum_moveable)
796 $block_gui->setAllowMove(
"down");
800 if ($block[
"custom"])
802 include_once(
"./".self::$locations[$gui_class].
"classes/".
803 "class.".$block_class.
".php");
804 $app_block =
new $block_class($block[
"id"]);
805 $block_gui->setBlock($app_block);
806 $block_gui->setRefId($block[
"ref_id"]);
809 $ilCtrl->setParameter($this,
"block_type", $block[
"type"]);
810 echo $ilCtrl->getHTML($block_gui);
816 if ($block[
"type"] !=
"pdsysmess" && $block[
"type"] !=
"pdfeedb"
817 && $block[
"type"] !=
"news")
826 echo
"Error: ilColumnGUI::updateBlock: Block '".
827 $_GET[
"block_id"].
"' unknown.";
838 if (
$_POST[
"block"] !=
"")
840 $block = explode(
"_",
$_POST[
"block"]);
841 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
845 $ilCtrl->returnToParent($this);
855 $class = array_search(
$_POST[
"block_type"], self::$block_types);
857 $ilCtrl->setCmdClass($class);
858 $ilCtrl->setCmd(
"create");
859 include_once(
"./".self::$locations[$class].
"classes/class.".$class.
".php");
860 $block_gui =
new $class();
861 $block_gui->setProperties($this->block_property[
$_POST[
"block_type"]]);
867 $ilCtrl->setParameter($this,
"block_type", $_POST[
"block_type"]);
868 $html = $ilCtrl->forwardCommand($block_gui);
869 $ilCtrl->setParameter($this,
"block_type",
"");
880 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
890 if (is_array($this->default_blocks[$this->
getColType()]))
892 foreach($this->default_blocks[$this->
getColType()] as $class => $def_side)
894 $type = self::$block_types[$class];
914 if (
$type ==
"pdsysmess")
918 if (
$type ==
"pdfeedb")
928 $this->blocks[
$side][] = array(
940 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
942 $costum_block->setContextObjId($ilCtrl->getContextObjId());
943 $costum_block->setContextObjType($ilCtrl->getContextObjType());
944 $c_blocks = $costum_block->queryBlocksForContext();
946 foreach($c_blocks as $c_block)
948 $type = $c_block[
"type"];
952 $class = array_search(
$type, self::$block_types);
964 $this->blocks[
$side][] = array(
968 "id" => $c_block[
"id"],
975 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
978 foreach($this->rep_block_types as $block_type)
982 if (!is_array($rep_items[$block_type]))
986 foreach($rep_items[$block_type] as $item)
989 $costum_block->setContextObjId($item[
"obj_id"]);
990 $costum_block->setContextObjType($block_type);
991 $c_blocks = $costum_block->queryBlocksForContext();
992 $c_block = $c_blocks[0];
995 $class = array_search(
$type, self::$block_types);
1002 if (
$side ===
false)
1007 $this->blocks[
$side][] = array(
1011 "id" => $c_block[
"id"],
1013 "ref_id" => $item[
"ref_id"]);
1035 if (in_array($this->
getColType(), array(
"pd",
"crs",
"cat",
"grp")))
1037 $bid = explode(
"_",
$_GET[
"block_id"]);
1039 foreach($this->blocks[$this->
getCmdSide()] as $block)
1043 $ilUser->getId(), $block[
"id"]) != 0)
1051 if ($block[
"type"] == $bid[0] && $block[
"id"] == $bid[1])
1053 if (
$_GET[
"move_dir"] ==
"up")
1057 if (
$_GET[
"move_dir"] ==
"down")
1061 if (
$_GET[
"move_dir"] ==
"left")
1066 if (
$_GET[
"move_dir"] ==
"right")
1080 $ilCtrl->returnToParent($this);
1089 if (isset($this->check_global_activation[$a_type]) && $this->check_global_activation[$a_type])
1091 if ($a_type ==
'pdbookm')
1093 if (!$ilSetting->get(
"disable_bookmarks"))
1099 else if ($a_type ==
'pdnotes')
1101 if (!$ilSetting->get(
"disable_notes"))
1107 else if ($ilSetting->get(
"block_activated_".$a_type))
1111 elseif($a_type ==
'cal' || $a_type ==
'pdcal')
1113 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
1128 if ($this->check_nr_limit[$a_type])
1132 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
1134 $costum_block->setContextObjId($ilCtrl->getContextObjId());
1135 $costum_block->setContextObjType($ilCtrl->getContextObjType());
1136 $costum_block->setType($a_type);
1137 $res = $costum_block->queryCntBlockForContext();
1138 $cnt = (int)
$res[0][
"cnt"];
1146 if ($ilSetting->get(
"block_limit_".$a_type) > $cnt)