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");
39 "ilNewsForContextBlockGUI" =>
"Services/News/",
40 "ilCalendarBlockGUI" =>
"Services/Calendar/",
41 "ilPDCalendarBlockGUI" =>
"Services/Calendar/",
42 "ilPDNotesBlockGUI" =>
"Services/Notes/",
43 "ilPDMailBlockGUI" =>
"Services/Mail/",
44 "ilUsersOnlineBlockGUI" =>
"Services/PersonalDesktop/",
45 "ilPDSysMessageBlockGUI" =>
"Services/Mail/",
46 "ilPDSelectedItemsBlockGUI" =>
"Services/PersonalDesktop/",
47 "ilBookmarkBlockGUI" =>
"Services/PersonalDesktop/",
48 "ilPDNewsBlockGUI" =>
"Services/News/",
49 "ilExternalFeedBlockGUI" =>
"Services/Block/",
50 "ilPDExternalFeedBlockGUI" =>
"Services/Feeds/",
51 "ilHtmlBlockGUI" =>
"Services/Block/",
52 "ilPDFeedbackBlockGUI" =>
"Services/Feedback/",
53 'ilPDTaggingBlockGUI' =>
'Services/Tagging/',
54 'ilChatBlockGUI' =>
'Modules/Chat/'
58 "ilPDMailBlockGUI" =>
"pdmail",
59 "ilPDNotesBlockGUI" =>
"pdnotes",
60 "ilUsersOnlineBlockGUI" =>
"pdusers",
61 "ilPDNewsBlockGUI" =>
"pdnews",
62 "ilBookmarkBlockGUI" =>
"pdbookm",
63 "ilNewsForContextBlockGUI" =>
"news",
64 "ilCalendarBlockGUI" =>
"cal",
65 "ilPDCalendarBlockGUI" =>
"pdcal",
66 "ilExternalFeedBlockGUI" =>
"feed",
67 "ilPDExternalFeedBlockGUI" =>
"pdfeed",
68 "ilPDFeedbackBlockGUI" =>
"pdfeedb",
69 "ilPDSysMessageBlockGUI" =>
"pdsysmess",
70 "ilPDSelectedItemsBlockGUI" =>
"pditems",
71 "ilHtmlBlockGUI" =>
"html",
72 'ilPDTaggingBlockGUI' =>
'pdtag',
73 'ilChatBlockGUI' =>
'chatviewer'
78 "cat" => array(
"ilNewsForContextBlockGUI" =>
IL_COL_RIGHT),
86 "frm" => array(
"ilNewsForContextBlockGUI" =>
IL_COL_RIGHT),
114 "pd" => array(
"ilPDExternalFeedBlockGUI")
120 array(
"news" =>
true,
129 "chatviewer" =>
true);
132 array(
"pdfeed" =>
true);
139 function ilColumnGUI($a_col_type =
"", $a_side =
"", $use_std_context =
false)
164 return $_GET[
"col_side"];
174 $this->coltype = $a_coltype;
184 return $this->coltype;
194 $this->side = $a_side;
214 $this->enableedit = $a_enableedit;
234 $this->repositorymode = $a_repositorymode;
254 $this->admincommands = $a_admincommands;
264 return $this->admincommands;
274 $this->movementmode = $a_movementmode;
284 return $this->movementmode;
294 $this->enablemovement = $a_enablemovement;
304 return $this->enablemovement;
314 if ($ilCtrl->getCmdClass() ==
"ilcolumngui")
316 switch ($ilCtrl->getCmd())
323 $cur_block_type = (
$_GET[
"block_type"])
324 ?
$_GET[
"block_type"]
327 if ($class = array_search($cur_block_type, self::$block_types))
329 include_once(
"./".self::$locations[$class].
"classes/".
330 "class.".$class.
".php");
331 return call_user_func(array($class,
'getScreenMode'));
346 $this->block_property[$a_block_type][$a_property] = $a_value;
351 return $this->block_property[$a_block_type];
356 $this->block_property = $a_block_properties;
366 $this->repositoryitems = $a_repositoryitems;
386 $ilCtrl->setParameter($this,
"col_side" ,$this->
getSide());
389 $next_class = $ilCtrl->getNextClass();
390 $cmd = $ilCtrl->getCmd(
"getHTML");
392 $cur_block_type = (
$_GET[
"block_type"])
393 ?
$_GET[
"block_type"]
396 if ($next_class !=
"")
399 if ($gui_class = array_search($cur_block_type, self::$block_types))
401 include_once(
"./".self::$locations[$gui_class].
"classes/".
402 "class.".$gui_class.
".php");
403 $ilCtrl->setParameter($this,
"block_type", $cur_block_type);
404 $block_gui =
new $gui_class();
405 $block_gui->setProperties($this->block_property[$cur_block_type]);
411 if (in_array($gui_class, $this->custom_blocks[$this->
getColType()]) ||
412 in_array($cur_block_type, $this->rep_block_types))
414 $block_class = substr($gui_class, 0, strlen($gui_class)-3);
415 include_once(
"./".self::$locations[$gui_class].
"classes/".
416 "class.".$block_class.
".php");
417 $app_block =
new $block_class(
$_GET[
"block_id"]);
418 $block_gui->setBlock($app_block);
420 $html = $ilCtrl->forwardCommand($block_gui);
421 $ilCtrl->setParameter($this,
"block_type",
"");
428 return $this->
$cmd();
439 $ilBench->start(
"Column",
"getHTML");
441 $ilCtrl->setParameter($this,
"col_side" ,$this->
getSide());
443 $this->tpl =
new ilTemplate(
"tpl.column.html",
true,
true,
"Services/Block");
445 $ilBench->start(
"Column",
"determineBlocks");
447 $ilBench->stop(
"Column",
"determineBlocks");
449 $ilBench->start(
"Column",
"showBlocks");
451 $ilBench->stop(
"Column",
"showBlocks");
458 $ilBench->stop(
"Column",
"getHTML");
460 return $this->tpl->get();
473 $sum_moveable = count($this->blocks[$this->
getSide()]);
475 foreach($this->blocks[$this->
getSide()] as $block)
477 if ($ilCtrl->getContextObjType() !=
"user" ||
479 $ilUser->getId(), $block[
"id"]) > 0)
481 $gui_class = $block[
"class"];
482 $block_class = substr($block[
"class"], 0, strlen($block[
"class"])-3);
485 include_once(
"./".self::$locations[$gui_class].
"classes/".
486 "class.".$gui_class.
".php");
487 $ilBench->start(
"Column",
"instantiate-".$block[
"type"]);
488 $block_gui =
new $gui_class();
489 $ilBench->stop(
"Column",
"instantiate-".$block[
"type"]);
490 $block_gui->setProperties($this->block_property[$block[
"type"]]);
498 if ($block[
"custom"])
500 include_once(
"./".self::$locations[$gui_class].
"classes/".
501 "class.".$block_class.
".php");
502 $app_block =
new $block_class($block[
"id"]);
503 $block_gui->setBlock($app_block);
504 $block_gui->setRefId($block[
"ref_id"]);
507 $ilCtrl->setParameter($this,
"block_type", $block_gui->getBlockType());
508 $this->tpl->setCurrentBlock(
"col_block");
510 $ilBench->start(
"Column",
"showBlocks-".$block_gui->getBlockType());
511 $html = $ilCtrl->getHTML($block_gui);
512 $ilBench->stop(
"Column",
"showBlocks-".$block_gui->getBlockType());
518 include_once(
"./Services/Block/classes/class.ilDummyBlockGUI.php");
520 $bl->setBlockId($block[
"id"]);
521 $bl->setBlockType($block[
"type"]);
522 $bl->setTitle($lng->txt(
"invisible_block"));
525 $html = $bl->getHTML();
531 $this->tpl->setVariable(
"BLOCK", $html);
532 $this->tpl->parseCurrentBlock();
533 $ilCtrl->setParameter($this,
"block_type",
"");
537 if ($block[
"type"] !=
"pdsysmess" && $block[
"type"] !=
"pdfeedb" &&
538 $block[
"type"] !=
"news")
554 $a_block_gui->setAllowMove(
"right");
558 $a_block_gui->setAllowMove(
"left");
562 $a_block_gui->setAllowMove(
"up");
564 if ($i < $sum_moveable)
566 $a_block_gui->setAllowMove(
"down");
577 $bl_management =
false;
580 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
581 $hidden_blocks = array();
582 $blocks = array(
"pdmail" => $lng->txt(
"mail"),
583 "pdnotes" => $lng->txt(
"notes"),
584 "pdusers" => $lng->txt(
"users_online"),
585 "pdnews" => $lng->txt(
"news"),
586 "pdbookm" => $lng->txt(
"my_bms"),
587 "news" => $lng->txt(
"news_internal_news"),
588 "feed" => $lng->txt(
"feed"),
589 "pdfeed" => $lng->txt(
"feed"),
590 "html" => $lng->txt(
"html_block"),
591 "pdtag" => $lng->txt(
"tagging_my_tags"),
592 "pdcal" => $lng->txt(
'calendar'),
593 "chatviewer" => $lng->txt(
'chat'),
596 foreach($this->blocks[$this->
getSide()] as $block)
598 include_once(
"./".self::$locations[$block[
"class"]].
"classes/".
599 "class.".$block[
"class"].
".php");
601 if ($block[
"custom"] ==
false)
603 if ($ilCtrl->getContextObjType() ==
"user")
607 $hidden_blocks[$block[
"type"]] = $blocks[$block[
"type"]];
610 else if ($ilCtrl->getContextObjType() !=
"")
613 $ilCtrl->getContextObjId()) == 0)
615 $hidden_blocks[$block[
"type"].
"_".$ilCtrl->getContextObjId()] = $blocks[$block[
"type"]];
624 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
626 $hidden_blocks[$block[
"type"].
"_".$block[
"id"]] =
631 if (count($hidden_blocks) > 0)
633 $this->tpl->setCurrentBlock(
"hidden_block_selector");
634 $this->tpl->setVariable(
"HB_ACTION", $ilCtrl->getFormAction($this));
636 false,
true, 0,
"ilEditSelect", array(
"id" =>
"il_show_bl_sel_".$this->
getSide())));
637 $this->tpl->setVariable(
"LAB_ID",
"il_show_bl_sel_".$this->
getSide());
638 $this->tpl->setVariable(
"TXT_ACTIVATE", $lng->txt(
"show"));
639 $this->tpl->setVariable(
"TXT_SHOW_HIDDEN_BLOCK",
640 $lng->txt(
"show_hidden_block"));
641 $this->tpl->parseCurrentBlock();
642 $bl_management =
true;
648 $add_blocks = array();
651 if (is_array($this->custom_blocks[$this->
getColType()]))
653 foreach($this->custom_blocks[$this->
getColType()] as $block_class)
655 include_once(
"./".self::$locations[$block_class].
"classes/".
656 "class.".$block_class.
".php");
657 $block_type = call_user_func(array($block_class,
'getBlockType'));
665 $add_blocks[$block_type] = $blocks[$block_type];
671 if (count($add_blocks) > 0)
673 $this->tpl->setCurrentBlock(
"add_block_selector");
674 $ilCtrl->setParameter($this,
"block_type",
"");
675 $this->tpl->setVariable(
"AB_ACTION", $ilCtrl->getFormAction($this));
676 $this->tpl->setVariable(
"ADD_BLOCK_SEL",
ilUtil::formSelect(
"",
"block_type", $add_blocks,
677 false,
true, 0,
"ilEditSelect", array(
"id" =>
"il_add_bl_sel_".$this->
getSide())));
678 $this->tpl->setVariable(
"LAB_ID",
"il_add_bl_sel_".$this->
getSide());
679 $this->tpl->setVariable(
"TXT_ADD", $lng->txt(
"create"));
680 $this->tpl->setVariable(
"TXT_CREATE_BLOCK",
681 $lng->txt(
"create_block"));
682 $this->tpl->parseCurrentBlock();
683 $bl_management =
true;
689 $this->tpl->setCurrentBlock(
"toggle_movement");
690 $this->tpl->setVariable(
"HREF_TOGGLE_MOVEMENT",
691 $ilCtrl->getLinkTarget($this,
"toggleMovement"));
694 $this->tpl->setVariable(
"TXT_TOGGLE_MOVEMENT",
695 $lng->txt(
"stop_moving_blocks"));
699 $this->tpl->setVariable(
"TXT_TOGGLE_MOVEMENT",
700 $lng->txt(
"move_blocks"));
702 $this->tpl->parseCurrentBlock();
703 $bl_management =
true;
708 $this->tpl->setCurrentBlock(
"block_management");
709 $this->tpl->setVariable(
"TXT_BLOCK_MANAGEMENT",
710 $lng->txt(
"block_management"));
711 $this->tpl->parseCurrentBlock();
724 $_SESSION[
"col_".$this->getColType().
"_".movement] =
"off";
728 $_SESSION[
"col_".$this->getColType().
"_".movement] =
"on";
730 $ilCtrl->returnToParent($this);
742 $sum_moveable = count($this->blocks[$this->
getSide()]);
744 foreach ($this->blocks[$this->
getSide()] as $block)
747 include_once(
"./".self::$locations[$block[
"class"]].
"classes/".
748 "class.".$block[
"class"].
".php");
752 if (!$block[
"custom"] && $ilCtrl->getContextObjType() !=
"" && $ilCtrl->getContextObjType() !=
"user")
754 $block[
"id"] = $ilCtrl->getContextObjId();
759 if (
$_GET[
"block_id"] ==
"block_".$block[
"type"].
"_".$block[
"id"])
761 $gui_class = $block[
"class"];
762 $block_class = substr($block[
"class"], 0, strlen($block[
"class"])-3);
764 $block_gui =
new $gui_class();
765 $block_gui->setProperties($this->block_property[$block[
"type"]]);
773 $block_gui->setAllowMove(
"right");
778 $block_gui->setAllowMove(
"left");
782 $block_gui->setAllowMove(
"up");
784 if ($i < $sum_moveable)
786 $block_gui->setAllowMove(
"down");
790 if ($block[
"custom"])
792 include_once(
"./".self::$locations[$gui_class].
"classes/".
793 "class.".$block_class.
".php");
794 $app_block =
new $block_class($block[
"id"]);
795 $block_gui->setBlock($app_block);
796 $block_gui->setRefId($block[
"ref_id"]);
799 $ilCtrl->setParameter($this,
"block_type", $block[
"type"]);
800 echo $ilCtrl->getHTML($block_gui);
806 if ($block[
"type"] !=
"pdsysmess" && $block[
"type"] !=
"pdfeedb"
807 && $block[
"type"] !=
"news")
816 echo
"Error: ilColumnGUI::updateBlock: Block '".
817 $_GET[
"block_id"].
"' unknown.";
828 if (
$_POST[
"block"] !=
"")
830 $block = explode(
"_",
$_POST[
"block"]);
831 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
835 $ilCtrl->returnToParent($this);
845 $class = array_search(
$_POST[
"block_type"], self::$block_types);
847 $ilCtrl->setCmdClass($class);
848 $ilCtrl->setCmd(
"create");
849 include_once(
"./".self::$locations[$class].
"classes/class.".$class.
".php");
850 $block_gui =
new $class();
851 $block_gui->setProperties($this->block_property[
$_POST[
"block_type"]]);
857 $ilCtrl->setParameter($this,
"block_type", $_POST[
"block_type"]);
858 $html = $ilCtrl->forwardCommand($block_gui);
859 $ilCtrl->setParameter($this,
"block_type",
"");
870 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
880 if (is_array($this->default_blocks[$this->
getColType()]))
882 foreach($this->default_blocks[$this->
getColType()] as $class => $def_side)
884 $type = self::$block_types[$class];
904 if (
$type ==
"pdsysmess")
908 if (
$type ==
"pdfeedb")
918 $this->blocks[
$side][] = array(
930 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
932 $costum_block->setContextObjId($ilCtrl->getContextObjId());
933 $costum_block->setContextObjType($ilCtrl->getContextObjType());
934 $c_blocks = $costum_block->queryBlocksForContext();
936 foreach($c_blocks as $c_block)
938 $type = $c_block[
"type"];
942 $class = array_search(
$type, self::$block_types);
954 $this->blocks[
$side][] = array(
958 "id" => $c_block[
"id"],
965 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
968 foreach($this->rep_block_types as $block_type)
972 if (!is_array($rep_items[$block_type]))
976 foreach($rep_items[$block_type] as $item)
979 $costum_block->setContextObjId($item[
"obj_id"]);
980 $costum_block->setContextObjType($block_type);
981 $c_blocks = $costum_block->queryBlocksForContext();
982 $c_block = $c_blocks[0];
985 $class = array_search(
$type, self::$block_types);
997 $this->blocks[
$side][] = array(
1001 "id" => $c_block[
"id"],
1003 "ref_id" => $item[
"ref_id"]);
1025 if (in_array($this->
getColType(), array(
"pd",
"crs",
"cat",
"grp")))
1027 $bid = explode(
"_",
$_GET[
"block_id"]);
1029 foreach($this->blocks[$this->
getCmdSide()] as $block)
1033 $ilUser->getId(), $block[
"id"]) != 0)
1041 if ($block[
"type"] == $bid[0] && $block[
"id"] == $bid[1])
1043 if (
$_GET[
"move_dir"] ==
"up")
1047 if (
$_GET[
"move_dir"] ==
"down")
1051 if (
$_GET[
"move_dir"] ==
"left")
1056 if (
$_GET[
"move_dir"] ==
"right")
1070 $ilCtrl->returnToParent($this);
1079 if ($this->check_global_activation[$a_type])
1081 if ($a_type ==
'pdbookm')
1083 if (!$ilSetting->get(
"disable_bookmarks"))
1089 else if ($a_type ==
'pdnotes')
1091 if (!$ilSetting->get(
"disable_notes"))
1097 else if ($ilSetting->get(
"block_activated_".$a_type))
1101 elseif($a_type ==
'cal' || $a_type ==
'pdcal')
1103 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
1118 if ($this->check_nr_limit[$a_type])
1122 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
1124 $costum_block->setContextObjId($ilCtrl->getContextObjId());
1125 $costum_block->setContextObjType($ilCtrl->getContextObjType());
1126 $costum_block->setType($a_type);
1127 $res = $costum_block->queryCntBlockForContext();
1128 $cnt = (int)
$res[0][
"cnt"];
1136 if ($ilSetting->get(
"block_limit_".$a_type) > $cnt)