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");
48 "ilNewsForContextBlockGUI" =>
"Services/News/",
49 "ilCalendarBlockGUI" =>
"Services/Calendar/",
50 "ilPDCalendarBlockGUI" =>
"Services/Calendar/",
51 "ilPDNotesBlockGUI" =>
"Services/Notes/",
52 "ilPDMailBlockGUI" =>
"Services/Mail/",
53 "ilUsersOnlineBlockGUI" =>
"Services/PersonalDesktop/",
54 "ilPDSysMessageBlockGUI" =>
"Services/Mail/",
55 "ilPDSelectedItemsBlockGUI" =>
"Services/PersonalDesktop/",
56 "ilBookmarkBlockGUI" =>
"Services/Bookmarks/",
57 "ilPDNewsBlockGUI" =>
"Services/News/",
58 "ilExternalFeedBlockGUI" =>
"Services/Block/",
59 "ilPDExternalFeedBlockGUI" =>
"Services/Feeds/",
60 'ilPDTaggingBlockGUI' =>
'Services/Tagging/',
61 'ilChatroomBlockGUI' =>
'Modules/Chatroom/',
62 'ilPollBlockGUI' =>
'Modules/Poll/',
63 'ilClassificationBlockGUI' =>
'Services/Classification/',
64 'ilPDPortfolioBlockGUI' =>
'Modules/Portfolio/',
65 "ilPDStudyProgrammeSimpleListGUI" =>
"Modules/StudyProgramme/",
66 "ilPDStudyProgrammeExpandableListGUI" =>
"Modules/StudyProgramme/",
67 "ilForumPostingDraftsBlockGUI" =>
"Modules/Forum/" 71 "ilPDMailBlockGUI" =>
"pdmail",
72 "ilPDNotesBlockGUI" =>
"pdnotes",
73 "ilUsersOnlineBlockGUI" =>
"pdusers",
74 "ilPDNewsBlockGUI" =>
"pdnews",
75 "ilBookmarkBlockGUI" =>
"pdbookm",
76 "ilNewsForContextBlockGUI" =>
"news",
77 "ilCalendarBlockGUI" =>
"cal",
78 "ilPDCalendarBlockGUI" =>
"pdcal",
79 "ilExternalFeedBlockGUI" =>
"feed",
80 "ilPDExternalFeedBlockGUI" =>
"pdfeed",
81 "ilPDSysMessageBlockGUI" =>
"pdsysmess",
82 "ilPDSelectedItemsBlockGUI" =>
"pditems",
83 'ilPDTaggingBlockGUI' =>
'pdtag',
84 'ilChatroomBlockGUI' =>
'chatviewer',
85 'ilPollBlockGUI' =>
'poll',
86 'ilClassificationBlockGUI' =>
'clsfct',
87 'ilPDPortfolioBlockGUI' =>
'pdportf',
88 "ilPDStudyProgrammeSimpleListGUI" =>
"prgsimplelist",
89 "ilPDStudyProgrammeExpandableListGUI" =>
"prgexpandablelist",
90 "ilForumPostingDraftsBlockGUI" =>
"pdfrmpostdraft" 141 "pd" =>
array(
"ilPDExternalFeedBlockGUI")
147 array(
"news" =>
true,
157 "chatviewer" =>
true,
158 "pdfrmpostdraft" =>
true,
164 array(
"pdfeed" =>
true);
171 public function __construct($a_col_type =
"", $a_side =
"", $use_std_context =
false)
189 self::$locations[$className] =
$path;
204 self::$block_types[$className] = $identifier;
214 return $_GET[
"col_side"];
224 $this->coltype = $a_coltype;
234 return $this->coltype;
244 $this->side = $a_side;
264 $this->enableedit = $a_enableedit;
284 $this->repositorymode = $a_repositorymode;
304 $this->admincommands = $a_admincommands;
324 $this->movementmode = $a_movementmode;
344 $this->enablemovement = $a_enablemovement;
364 if ($ilCtrl->getCmdClass() ==
"ilcolumngui")
366 switch ($ilCtrl->getCmd())
373 $cur_block_type =
"";
374 if (isset(
$_GET[
"block_type"]) &&
$_GET[
"block_type"])
376 $cur_block_type =
$_GET[
"block_type"];
378 else if (isset(
$_POST[
"block_type"]))
380 $cur_block_type =
$_POST[
"block_type"];
383 if ($class = array_search($cur_block_type, self::$block_types))
385 include_once(
"./".self::$locations[$class].
"classes/".
386 "class.".$class.
".php");
387 return call_user_func(
array($class,
'getScreenMode'));
402 $this->block_property[$a_block_type][$a_property] = $a_value;
407 return $this->block_property[$a_block_type];
412 $this->block_property = $a_block_properties;
422 $this->repositoryitems = $a_repositoryitems;
442 $ilCtrl->setParameter($this,
"col_side" ,$this->
getSide());
445 $next_class = $ilCtrl->getNextClass();
446 $cmd = $ilCtrl->getCmd(
"getHTML");
448 $cur_block_type = (
$_GET[
"block_type"])
449 ?
$_GET[
"block_type"]
452 if ($next_class !=
"")
455 if ($gui_class = array_search($cur_block_type, self::$block_types))
457 include_once(
"./".self::$locations[$gui_class].
"classes/".
458 "class.".$gui_class.
".php");
459 $ilCtrl->setParameter($this,
"block_type", $cur_block_type);
460 $block_gui =
new $gui_class();
461 $block_gui->setProperties($this->block_property[$cur_block_type]);
466 if (in_array($gui_class, $this->custom_blocks[$this->
getColType()]) ||
467 in_array($cur_block_type, $this->rep_block_types))
469 $block_class = substr($gui_class, 0, strlen($gui_class)-3);
470 include_once(
"./".self::$locations[$gui_class].
"classes/".
471 "class.".$block_class.
".php");
472 $app_block =
new $block_class(
$_GET[
"block_id"]);
473 $block_gui->setBlock($app_block);
475 $html = $ilCtrl->forwardCommand($block_gui);
476 $ilCtrl->setParameter($this,
"block_type",
"");
483 return $this->
$cmd();
494 $ilBench->start(
"Column",
"getHTML");
496 $ilCtrl->setParameter($this,
"col_side" ,$this->
getSide());
498 $this->tpl =
new ilTemplate(
"tpl.column.html",
true,
true,
"Services/Block");
500 $ilBench->start(
"Column",
"determineBlocks");
502 $ilBench->stop(
"Column",
"determineBlocks");
504 $ilBench->start(
"Column",
"showBlocks");
506 $ilBench->stop(
"Column",
"showBlocks");
510 $this->addHiddenBlockSelector();
513 $ilBench->stop(
"Column",
"getHTML");
515 return $this->tpl->get();
526 $sum_moveable = count($this->blocks[$this->
getSide()]);
528 foreach($this->blocks[$this->
getSide()] as $block)
530 if ($ilCtrl->getContextObjType() !=
"user" ||
532 $ilUser->getId(), $block[
"id"]) > 0)
534 $gui_class = $block[
"class"];
535 $block_class = substr($block[
"class"], 0, strlen($block[
"class"])-3);
538 include_once(
"./".self::$locations[$gui_class].
"classes/".
539 "class.".$gui_class.
".php");
540 $ilBench->start(
"Column",
"instantiate-".$block[
"type"]);
541 $block_gui =
new $gui_class();
542 $ilBench->stop(
"Column",
"instantiate-".$block[
"type"]);
543 if (isset($this->block_property[$block[
"type"]]))
545 $block_gui->setProperties($this->block_property[$block[
"type"]]);
552 if ($block[
"custom"])
554 $path =
"./".self::$locations[$gui_class].
"classes/".
555 "class.".$block_class.
".php";
556 if(file_exists(
$path))
559 $app_block =
new $block_class($block[
"id"]);
566 $block_gui->setBlock($app_block);
567 if (isset($block[
"ref_id"]))
569 $block_gui->setRefId($block[
"ref_id"]);
573 $ilCtrl->setParameter($this,
"block_type", $block_gui->getBlockType());
574 $this->tpl->setCurrentBlock(
"col_block");
576 $ilBench->start(
"Column",
"showBlocks-".$block_gui->getBlockType());
577 $html = $ilCtrl->getHTML($block_gui);
578 $ilBench->stop(
"Column",
"showBlocks-".$block_gui->getBlockType());
584 include_once(
"./Services/Block/classes/class.ilDummyBlockGUI.php");
586 $bl->setBlockId($block[
"id"]);
587 $bl->setBlockType($block[
"type"]);
588 $bl->setTitle($lng->txt(
"invisible_block"));
590 $html = $bl->getHTML();
596 $this->tpl->setVariable(
"BLOCK",
$html);
597 $this->tpl->parseCurrentBlock();
598 $ilCtrl->setParameter($this,
"block_type",
"");
602 if ($block[
"type"] !=
"pdsysmess" && $block[
"type"] !=
"pdfeedb" &&
603 $block[
"type"] !=
"news")
618 function addHiddenBlockSelector()
629 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
630 $hidden_blocks =
array();
632 foreach($this->blocks[$this->
getSide()] as $block)
634 include_once(
"./".self::$locations[$block[
"class"]].
"classes/".
635 "class.".$block[
"class"].
".php");
637 if ($block[
"custom"] ==
false)
639 if ($ilCtrl->getContextObjType() ==
"user")
643 $hidden_blocks[$block[
"type"]] = $lng->txt(
'block_show_'.$block[
"type"]);
646 else if ($ilCtrl->getContextObjType() !=
"")
649 $ilCtrl->getContextObjId()) == 0)
651 $hidden_blocks[$block[
"type"].
"_".$ilCtrl->getContextObjId()] = $lng->txt(
'block_show_'.$block[
"type"]);
660 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
662 $hidden_blocks[$block[
"type"].
"_".$block[
"id"]] = sprintf($lng->txt(
'block_show_x'), $cblock->getTitle());
666 if(count($hidden_blocks) > 0)
668 foreach($hidden_blocks as $id =>
$title)
670 $ilCtrl->setParameter($this,
'block', $id);
671 $this->action_menu->addItem(
$title,
'', $ilCtrl->getLinkTarget($this,
'activateBlock'));
672 $ilCtrl->setParameter($this,
'block',
'');
679 $add_blocks =
array();
682 if (is_array($this->custom_blocks[$this->
getColType()]))
684 foreach($this->custom_blocks[$this->
getColType()] as $block_class)
686 include_once(
"./".self::$locations[$block_class].
"classes/".
687 "class.".$block_class.
".php");
688 $block_type = call_user_func(
array($block_class,
'getBlockType'));
696 $add_blocks[$block_type] = $lng->txt(
'block_create_'.$block_type);
702 if(count($add_blocks) > 0)
704 foreach($add_blocks as $id =>
$title)
706 $ilCtrl->setParameter($this,
'block_type', $id);
707 $this->action_menu->addItem(
$title,
'', $ilCtrl->getLinkTarget($this,
'addBlock'));
708 $ilCtrl->setParameter($this,
'block_type',
'');
713 $this->addBlockSorting();
719 protected function addBlockSorting()
730 include_once
'Services/jQuery/classes/class.iljQueryUtil.php';
734 if($ilBrowser->isMobile() || $ilBrowser->isIpad())
736 $tpl->addJavaScript(
'./Services/jQuery/js/jquery.ui.touch-punch.min.js');
738 $tpl->addJavaScript(
'./Services/Block/js/block_sorting.js');
743 $this->tpl->setVariable(
'BLOCK_SORTING_STORAGE_URL', $ilCtrl->getLinkTarget($this,
'saveBlockSortingAsynch',
'',
true,
false));
744 $this->tpl->setVariable(
'BLOCK_COLUMNS', json_encode(
array(
'il_left_col',
'il_right_col')));
745 $this->tpl->setVariable(
'BLOCK_COLUMNS_SELECTOR',
'#il_left_col,#il_right_col');
749 $ilCtrl->setParameter($this,
'col_side', $this->
getSide());
762 $sum_moveable = count($this->blocks[$this->
getSide()]);
764 foreach ($this->blocks[$this->
getSide()] as $block)
767 include_once(
"./".self::$locations[$block[
"class"]].
"classes/".
768 "class.".$block[
"class"].
".php");
772 if (!$block[
"custom"] && $ilCtrl->getContextObjType() !=
"" && $ilCtrl->getContextObjType() !=
"user")
774 $block[
"id"] = $ilCtrl->getContextObjId();
779 if (
$_GET[
"block_id"] ==
"block_".$block[
"type"].
"_".$block[
"id"])
781 $gui_class = $block[
"class"];
782 $block_class = substr($block[
"class"], 0, strlen($block[
"class"])-3);
784 $block_gui =
new $gui_class();
785 $block_gui->setProperties($this->block_property[$block[
"type"]]);
791 if ($block[
"custom"])
793 include_once(
"./".self::$locations[$gui_class].
"classes/".
794 "class.".$block_class.
".php");
795 $app_block =
new $block_class($block[
"id"]);
796 $block_gui->setBlock($app_block);
797 $block_gui->setRefId($block[
"ref_id"]);
800 $ilCtrl->setParameter($this,
"block_type", $block[
"type"]);
801 echo $ilCtrl->getHTML($block_gui);
807 if ($block[
"type"] !=
"pdsysmess" && $block[
"type"] !=
"pdfeedb" 808 && $block[
"type"] !=
"news")
817 echo "Error: ilColumnGUI::updateBlock: Block '".
818 $_GET[
"block_id"].
"' unknown.";
829 if (
$_GET[
"block"] !=
"")
831 $block = explode(
"_",
$_GET[
"block"]);
832 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
836 $ilCtrl->returnToParent($this);
847 $class = array_search(
$_GET[
"block_type"], self::$block_types);
849 $ilCtrl->setCmdClass($class);
850 $ilCtrl->setCmd(
"create");
851 include_once(
"./".self::$locations[$class].
"classes/class.".$class.
".php");
852 $block_gui =
new $class();
853 $block_gui->setProperties($this->block_property[
$_GET[
"block_type"]]);
858 $ilCtrl->setParameter($this,
"block_type", $_GET[
"block_type"]);
859 $html = $ilCtrl->forwardCommand($block_gui);
860 $ilCtrl->setParameter($this,
"block_type",
"");
871 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
881 if (is_array($this->default_blocks[$this->
getColType()]))
883 foreach($this->default_blocks[$this->
getColType()] as $class => $def_side)
885 $type = self::$block_types[$class];
905 if (
$type ==
"pdsysmess")
909 if (
$type ==
"pdfeedb")
913 if (
$type ==
"clsfct")
935 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
937 $custom_block->setContextObjId($ilCtrl->getContextObjId());
938 $custom_block->setContextObjType($ilCtrl->getContextObjType());
939 $c_blocks = $custom_block->queryBlocksForContext();
941 foreach($c_blocks as $c_block)
943 $type = $c_block[
"type"];
947 $class = array_search(
$type, self::$block_types);
963 "id" => $c_block[
"id"],
970 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
973 foreach($this->rep_block_types as $block_type)
977 if (!is_array($rep_items[$block_type]))
981 foreach($rep_items[$block_type] as $item)
984 $costum_block->setContextObjId($item[
"obj_id"]);
985 $costum_block->setContextObjType($block_type);
986 $c_blocks = $costum_block->queryBlocksForContext();
987 $c_block = $c_blocks[0];
990 $class = array_search(
$type, self::$block_types);
1006 "id" => $c_block[
"id"],
1008 "ref_id" => $item[
"ref_id"]);
1014 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
1016 $custom_block->setContextObjId($ilCtrl->getContextObjId());
1017 $custom_block->setContextObjType($ilCtrl->getContextObjType());
1018 $c_blocks = $custom_block->queryBlocksForContext(
false);
1020 foreach($c_blocks as $c_block)
1022 $type = $c_block[
"type"];
1023 $class = array_search(
$type, self::$block_types);
1034 "id" => $c_block[
"id"],
1057 if (isset($this->check_global_activation[
$a_type]) && $this->check_global_activation[$a_type])
1059 if ($a_type ==
'pdbookm')
1061 if (!$ilSetting->get(
"disable_bookmarks"))
1067 else if ($a_type ==
'pdnotes')
1069 if (!$ilSetting->get(
"disable_notes"))
1075 else if ($a_type ==
'pdportf')
1077 if ($ilSetting->get(
"user_portfolios"))
1080 if ($prfa_set->get(
"pd_block",
false))
1087 elseif($a_type ==
'news')
1089 include_once
'Services/Container/classes/class.ilContainer.php';
1091 $ilSetting->get(
'block_activated_news') &&
1093 $GLOBALS[
'ilCtrl']->getContextObjId(),
1098 else if($a_type ==
'pdsysmess')
1100 require_once
'Services/Mail/classes/class.ilObjMail.php';
1103 else if ($ilSetting->get(
"block_activated_".$a_type))
1107 elseif($a_type ==
'cal')
1109 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
1113 elseif($a_type ==
'pdcal')
1115 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
1118 elseif($a_type ==
"tagcld")
1121 return (
bool)$tags_active->get(
"enable",
false);
1123 elseif($a_type ==
"clsfct")
1125 if ($ilCtrl->getContextObjType() ==
"cat")
1130 return (
bool)$tags_active->get(
"enable",
false);
1144 if ($this->check_nr_limit[
$a_type])
1148 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
1150 $costum_block->setContextObjId($ilCtrl->getContextObjId());
1151 $costum_block->setContextObjType($ilCtrl->getContextObjType());
1152 $costum_block->setType($a_type);
1153 $res = $costum_block->queryCntBlockForContext();
1154 $cnt = (int)
$res[0][
"cnt"];
1162 if ($ilSetting->get(
"block_limit_".$a_type) > $cnt)
1177 public function saveBlockSortingAsynch()
1184 $response =
new stdClass();
1185 $response->success =
false;
1189 echo json_encode($response);
1195 $response->success =
true;
1200 foreach($blocks as $block)
1202 $bid = explode(
'_', $block);
1211 echo json_encode($response);
__construct($a_col_type="", $a_side="", $use_std_context=false)
Constructor.
exceededLimit($a_type)
Check whether limit is not exceeded.
static initjQueryUI()
Init jQuery UI (see included_components.txt for included components)
static _getInstance()
get singleton instance
static addCustomBlockType($className, $identifier)
Adds the block type of the custom block gui.
static getCmdSide()
Get Column Side of Current Command.
setBlockProperty($a_block_type, $a_property, $a_value)
This function is supposed to be used for block type specific properties, that should be passed to ilB...
getAdminCommands()
Get Administration Commmands.
static _writeDetailLevel($a_type, $a_value, $a_user=0, $a_block_id=0)
Write detail level to database.
setMovementMode($a_movementmode)
Set Movement Mode.
static _writeSide($a_type, $a_value, $a_user=0, $a_block_id=0)
Write side to database.
BlockGUI class for dummy block.
activateBlock()
Activate hidden block.
setAllBlockProperties($a_block_properties)
static lookupCalendarActivated($a_obj_id)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static _lookupDetailLevel($a_type, $a_user=0, $a_block_id=0)
Lookup detail level.
executeCommand()
execute command
setEnableEdit($a_enableedit)
Set EnableEdit.
getHTML()
Get HTML for column.
getBlockProperties($a_block_type)
setColType($a_coltype)
Set Column Type.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
const PD_SYS_MSG_OWN_BLOCK
setRepositoryItems($a_repositoryitems)
Set Repository Items.
setActionMenu($action_menu)
getRepositoryItems()
Get Repository Items.
Column user interface class.
setRepositoryMode($a_repositorymode)
Set RepositoryMode.
special template class to simplify handling of ITX/PEAR
getSide()
Get Side IL_COL_LEFT | IL_COL_RIGHT.
getEnableEdit()
Get EnableEdit.
getMovementMode()
Get Movement Mode.
getEnableMovement()
Get Enable Movement.
static _lookupSide($a_type, $a_user=0, $a_block_id=0)
Lookup side.
Create styles array
The data for the language used.
This is the super class of all custom blocks.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
static _lookupNr($a_type, $a_user=0, $a_block_id=0)
Lookup number.
static getScreenMode()
Get Screen Mode for current command.
updateBlock()
Update Block (asynchronous)
static initjQuery($a_tpl=null)
Init jQuery.
static addCustomBlockLocation($className, $path)
Adds location information of the custom block gui.
static _writeNumber($a_type, $a_value, $a_user=0, $a_block_id=0)
Write number to database.
setAdminCommands($a_admincommands)
Set Administration Commmands.
getRepositoryMode()
Get RepositoryMode.
isGloballyActivated($a_type)
Check whether a block type is globally activated.
setSide($a_side)
Set Side IL_COL_LEFT | IL_COL_RIGHT.
getColType()
Get Column Type.
setEnableMovement($a_enablemovement)
Set Enable Movement.
determineBlocks()
Determine which blocks to show.