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 'ilChatBlockGUI' =>
'Modules/Chat/'
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 'ilChatBlockGUI' =>
'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)
169 return $_GET[
"col_side"];
179 $this->coltype = $a_coltype;
189 return $this->coltype;
199 $this->side = $a_side;
219 $this->enableedit = $a_enableedit;
239 $this->repositorymode = $a_repositorymode;
259 $this->admincommands = $a_admincommands;
279 $this->movementmode = $a_movementmode;
299 $this->enablemovement = $a_enablemovement;
319 if ($ilCtrl->getCmdClass() ==
"ilcolumngui")
321 switch ($ilCtrl->getCmd())
328 $cur_block_type =
"";
329 if (isset(
$_GET[
"block_type"]) &&
$_GET[
"block_type"])
331 $cur_block_type =
$_GET[
"block_type"];
333 else if (isset(
$_POST[
"block_type"]))
335 $cur_block_type =
$_POST[
"block_type"];
338 if ($class = array_search($cur_block_type, self::$block_types))
340 include_once(
"./".self::$locations[$class].
"classes/".
341 "class.".$class.
".php");
342 return call_user_func(array($class,
'getScreenMode'));
357 $this->block_property[$a_block_type][$a_property] = $a_value;
362 return $this->block_property[$a_block_type];
367 $this->block_property = $a_block_properties;
377 $this->repositoryitems = $a_repositoryitems;
397 $ilCtrl->setParameter($this,
"col_side" ,$this->
getSide());
400 $next_class = $ilCtrl->getNextClass();
401 $cmd = $ilCtrl->getCmd(
"getHTML");
403 $cur_block_type = (
$_GET[
"block_type"])
404 ?
$_GET[
"block_type"]
407 if ($next_class !=
"")
410 if ($gui_class = array_search($cur_block_type, self::$block_types))
412 include_once(
"./".self::$locations[$gui_class].
"classes/".
413 "class.".$gui_class.
".php");
414 $ilCtrl->setParameter($this,
"block_type", $cur_block_type);
415 $block_gui =
new $gui_class();
416 $block_gui->setProperties($this->block_property[$cur_block_type]);
422 if (in_array($gui_class, $this->custom_blocks[$this->
getColType()]) ||
423 in_array($cur_block_type, $this->rep_block_types))
425 $block_class = substr($gui_class, 0, strlen($gui_class)-3);
426 include_once(
"./".self::$locations[$gui_class].
"classes/".
427 "class.".$block_class.
".php");
428 $app_block =
new $block_class(
$_GET[
"block_id"]);
429 $block_gui->setBlock($app_block);
431 $html = $ilCtrl->forwardCommand($block_gui);
432 $ilCtrl->setParameter($this,
"block_type",
"");
439 return $this->
$cmd();
450 $ilBench->start(
"Column",
"getHTML");
452 $ilCtrl->setParameter($this,
"col_side" ,$this->
getSide());
454 $this->tpl =
new ilTemplate(
"tpl.column.html",
true,
true,
"Services/Block");
456 $ilBench->start(
"Column",
"determineBlocks");
458 $ilBench->stop(
"Column",
"determineBlocks");
460 $ilBench->start(
"Column",
"showBlocks");
462 $ilBench->stop(
"Column",
"showBlocks");
469 $ilBench->stop(
"Column",
"getHTML");
471 return $this->tpl->get();
484 $sum_moveable = count($this->blocks[$this->
getSide()]);
486 foreach($this->blocks[$this->
getSide()] as $block)
488 if ($ilCtrl->getContextObjType() !=
"user" ||
490 $ilUser->getId(), $block[
"id"]) > 0)
492 $gui_class = $block[
"class"];
493 $block_class = substr($block[
"class"], 0, strlen($block[
"class"])-3);
496 include_once(
"./".self::$locations[$gui_class].
"classes/".
497 "class.".$gui_class.
".php");
498 $ilBench->start(
"Column",
"instantiate-".$block[
"type"]);
499 $block_gui =
new $gui_class();
500 $ilBench->stop(
"Column",
"instantiate-".$block[
"type"]);
501 if (isset($this->block_property[$block[
"type"]]))
503 $block_gui->setProperties($this->block_property[$block[
"type"]]);
512 if ($block[
"custom"])
514 include_once(
"./".self::$locations[$gui_class].
"classes/".
515 "class.".$block_class.
".php");
516 $app_block =
new $block_class($block[
"id"]);
517 $block_gui->setBlock($app_block);
518 if (isset($block[
"ref_id"]))
520 $block_gui->setRefId($block[
"ref_id"]);
524 $ilCtrl->setParameter($this,
"block_type", $block_gui->getBlockType());
525 $this->tpl->setCurrentBlock(
"col_block");
527 $ilBench->start(
"Column",
"showBlocks-".$block_gui->getBlockType());
528 $html = $ilCtrl->getHTML($block_gui);
529 $ilBench->stop(
"Column",
"showBlocks-".$block_gui->getBlockType());
535 include_once(
"./Services/Block/classes/class.ilDummyBlockGUI.php");
537 $bl->setBlockId($block[
"id"]);
538 $bl->setBlockType($block[
"type"]);
539 $bl->setTitle($lng->txt(
"invisible_block"));
542 $html = $bl->getHTML();
548 $this->tpl->setVariable(
"BLOCK", $html);
549 $this->tpl->parseCurrentBlock();
550 $ilCtrl->setParameter($this,
"block_type",
"");
554 if ($block[
"type"] !=
"pdsysmess" && $block[
"type"] !=
"pdfeedb" &&
555 $block[
"type"] !=
"news")
571 $a_block_gui->setAllowMove(
"right");
575 $a_block_gui->setAllowMove(
"left");
579 $a_block_gui->setAllowMove(
"up");
581 if ($i < $sum_moveable)
583 $a_block_gui->setAllowMove(
"down");
594 $bl_management =
false;
597 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
598 $hidden_blocks = array();
599 $blocks = array(
"pdmail" => $lng->txt(
"mail"),
600 "pdnotes" => $lng->txt(
"notes"),
601 "pdusers" => $lng->txt(
"users_online"),
602 "pdnews" => $lng->txt(
"news"),
603 "pdbookm" => $lng->txt(
"my_bms"),
604 "news" => $lng->txt(
"news_internal_news"),
605 "feed" => $lng->txt(
"feed"),
606 "pdfeed" => $lng->txt(
"feed"),
607 "html" => $lng->txt(
"html_block"),
608 "pdtag" => $lng->txt(
"tagging_my_tags"),
609 "pdcal" => $lng->txt(
'calendar'),
610 "chatviewer" => $lng->txt(
'chat'),
613 foreach($this->blocks[$this->
getSide()] as $block)
615 include_once(
"./".self::$locations[$block[
"class"]].
"classes/".
616 "class.".$block[
"class"].
".php");
618 if ($block[
"custom"] ==
false)
620 if ($ilCtrl->getContextObjType() ==
"user")
624 $hidden_blocks[$block[
"type"]] = $blocks[$block[
"type"]];
627 else if ($ilCtrl->getContextObjType() !=
"")
630 $ilCtrl->getContextObjId()) == 0)
632 $hidden_blocks[$block[
"type"].
"_".$ilCtrl->getContextObjId()] = $blocks[$block[
"type"]];
641 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
643 $hidden_blocks[$block[
"type"].
"_".$block[
"id"]] =
648 if (count($hidden_blocks) > 0)
650 $this->tpl->setCurrentBlock(
"hidden_block_selector");
651 $this->tpl->setVariable(
"HB_ACTION", $ilCtrl->getFormAction($this));
653 false,
true, 0,
"ilEditSelect", array(
"id" =>
"il_show_bl_sel_".$this->
getSide())));
654 $this->tpl->setVariable(
"LAB_ID",
"il_show_bl_sel_".$this->
getSide());
655 $this->tpl->setVariable(
"TXT_ACTIVATE", $lng->txt(
"show"));
656 $this->tpl->setVariable(
"TXT_SHOW_HIDDEN_BLOCK",
657 $lng->txt(
"show_hidden_block"));
658 $this->tpl->parseCurrentBlock();
659 $bl_management =
true;
665 $add_blocks = array();
668 if (is_array($this->custom_blocks[$this->
getColType()]))
670 foreach($this->custom_blocks[$this->
getColType()] as $block_class)
672 include_once(
"./".self::$locations[$block_class].
"classes/".
673 "class.".$block_class.
".php");
674 $block_type = call_user_func(array($block_class,
'getBlockType'));
682 $add_blocks[$block_type] = $blocks[$block_type];
688 if (count($add_blocks) > 0)
690 $this->tpl->setCurrentBlock(
"add_block_selector");
691 $ilCtrl->setParameter($this,
"block_type",
"");
692 $this->tpl->setVariable(
"AB_ACTION", $ilCtrl->getFormAction($this));
693 $this->tpl->setVariable(
"ADD_BLOCK_SEL",
ilUtil::formSelect(
"",
"block_type", $add_blocks,
694 false,
true, 0,
"ilEditSelect", array(
"id" =>
"il_add_bl_sel_".$this->
getSide())));
695 $this->tpl->setVariable(
"LAB_ID",
"il_add_bl_sel_".$this->
getSide());
696 $this->tpl->setVariable(
"TXT_ADD", $lng->txt(
"create"));
697 $this->tpl->setVariable(
"TXT_CREATE_BLOCK",
698 $lng->txt(
"create_block"));
699 $this->tpl->parseCurrentBlock();
700 $bl_management =
true;
706 $this->tpl->setCurrentBlock(
"toggle_movement");
707 $this->tpl->setVariable(
"HREF_TOGGLE_MOVEMENT",
708 $ilCtrl->getLinkTarget($this,
"toggleMovement"));
711 $this->tpl->setVariable(
"TXT_TOGGLE_MOVEMENT",
712 $lng->txt(
"stop_moving_blocks"));
716 $this->tpl->setVariable(
"TXT_TOGGLE_MOVEMENT",
717 $lng->txt(
"move_blocks"));
719 $this->tpl->parseCurrentBlock();
720 $bl_management =
true;
725 $this->tpl->setCurrentBlock(
"block_management");
726 $this->tpl->setVariable(
"TXT_BLOCK_MANAGEMENT",
727 $lng->txt(
"block_management"));
728 $this->tpl->parseCurrentBlock();
741 $_SESSION[
"col_".$this->getColType().
"_movement"] =
"off";
745 $_SESSION[
"col_".$this->getColType().
"_movement"] =
"on";
747 $ilCtrl->returnToParent($this);
759 $sum_moveable = count($this->blocks[$this->
getSide()]);
761 foreach ($this->blocks[$this->
getSide()] as $block)
764 include_once(
"./".self::$locations[$block[
"class"]].
"classes/".
765 "class.".$block[
"class"].
".php");
769 if (!$block[
"custom"] && $ilCtrl->getContextObjType() !=
"" && $ilCtrl->getContextObjType() !=
"user")
771 $block[
"id"] = $ilCtrl->getContextObjId();
776 if (
$_GET[
"block_id"] ==
"block_".$block[
"type"].
"_".$block[
"id"])
778 $gui_class = $block[
"class"];
779 $block_class = substr($block[
"class"], 0, strlen($block[
"class"])-3);
781 $block_gui =
new $gui_class();
782 $block_gui->setProperties($this->block_property[$block[
"type"]]);
790 $block_gui->setAllowMove(
"right");
795 $block_gui->setAllowMove(
"left");
799 $block_gui->setAllowMove(
"up");
801 if ($i < $sum_moveable)
803 $block_gui->setAllowMove(
"down");
807 if ($block[
"custom"])
809 include_once(
"./".self::$locations[$gui_class].
"classes/".
810 "class.".$block_class.
".php");
811 $app_block =
new $block_class($block[
"id"]);
812 $block_gui->setBlock($app_block);
813 $block_gui->setRefId($block[
"ref_id"]);
816 $ilCtrl->setParameter($this,
"block_type", $block[
"type"]);
817 echo $ilCtrl->getHTML($block_gui);
823 if ($block[
"type"] !=
"pdsysmess" && $block[
"type"] !=
"pdfeedb"
824 && $block[
"type"] !=
"news")
833 echo
"Error: ilColumnGUI::updateBlock: Block '".
834 $_GET[
"block_id"].
"' unknown.";
845 if (
$_POST[
"block"] !=
"")
847 $block = explode(
"_",
$_POST[
"block"]);
848 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
852 $ilCtrl->returnToParent($this);
862 $class = array_search(
$_POST[
"block_type"], self::$block_types);
864 $ilCtrl->setCmdClass($class);
865 $ilCtrl->setCmd(
"create");
866 include_once(
"./".self::$locations[$class].
"classes/class.".$class.
".php");
867 $block_gui =
new $class();
868 $block_gui->setProperties($this->block_property[
$_POST[
"block_type"]]);
874 $ilCtrl->setParameter($this,
"block_type", $_POST[
"block_type"]);
875 $html = $ilCtrl->forwardCommand($block_gui);
876 $ilCtrl->setParameter($this,
"block_type",
"");
887 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
897 if (is_array($this->default_blocks[$this->
getColType()]))
899 foreach($this->default_blocks[$this->
getColType()] as $class => $def_side)
901 $type = self::$block_types[$class];
921 if (
$type ==
"pdsysmess")
925 if (
$type ==
"pdfeedb")
935 $this->blocks[
$side][] = array(
947 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
949 $costum_block->setContextObjId($ilCtrl->getContextObjId());
950 $costum_block->setContextObjType($ilCtrl->getContextObjType());
951 $c_blocks = $costum_block->queryBlocksForContext();
953 foreach($c_blocks as $c_block)
955 $type = $c_block[
"type"];
959 $class = array_search(
$type, self::$block_types);
971 $this->blocks[
$side][] = array(
975 "id" => $c_block[
"id"],
982 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
985 foreach($this->rep_block_types as $block_type)
989 if (!is_array($rep_items[$block_type]))
993 foreach($rep_items[$block_type] as $item)
996 $costum_block->setContextObjId($item[
"obj_id"]);
997 $costum_block->setContextObjType($block_type);
998 $c_blocks = $costum_block->queryBlocksForContext();
999 $c_block = $c_blocks[0];
1001 $type = $block_type;
1002 $class = array_search(
$type, self::$block_types);
1009 if (
$side ===
false)
1014 $this->blocks[
$side][] = array(
1018 "id" => $c_block[
"id"],
1020 "ref_id" => $item[
"ref_id"]);
1042 if (in_array($this->
getColType(), array(
"pd",
"crs",
"cat",
"grp")))
1044 $bid = explode(
"_",
$_GET[
"block_id"]);
1046 foreach($this->blocks[$this->
getCmdSide()] as $block)
1050 $ilUser->getId(), $block[
"id"]) != 0)
1058 if ($block[
"type"] == $bid[0] && $block[
"id"] == $bid[1])
1060 if (
$_GET[
"move_dir"] ==
"up")
1064 if (
$_GET[
"move_dir"] ==
"down")
1068 if (
$_GET[
"move_dir"] ==
"left")
1073 if (
$_GET[
"move_dir"] ==
"right")
1087 $ilCtrl->returnToParent($this);
1096 if (isset($this->check_global_activation[$a_type]) && $this->check_global_activation[$a_type])
1098 if ($a_type ==
'pdbookm')
1100 if (!$ilSetting->get(
"disable_bookmarks"))
1106 else if ($a_type ==
'pdnotes')
1108 if (!$ilSetting->get(
"disable_notes"))
1114 else if ($ilSetting->get(
"block_activated_".$a_type))
1118 elseif($a_type ==
'cal' || $a_type ==
'pdcal')
1120 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
1135 if ($this->check_nr_limit[$a_type])
1139 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
1141 $costum_block->setContextObjId($ilCtrl->getContextObjId());
1142 $costum_block->setContextObjType($ilCtrl->getContextObjType());
1143 $costum_block->setType($a_type);
1144 $res = $costum_block->queryCntBlockForContext();
1145 $cnt = (int)
$res[0][
"cnt"];
1153 if ($ilSetting->get(
"block_limit_".$a_type) > $cnt)