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/" 70 "ilPDMailBlockGUI" =>
"pdmail",
71 "ilPDNotesBlockGUI" =>
"pdnotes",
72 "ilUsersOnlineBlockGUI" =>
"pdusers",
73 "ilPDNewsBlockGUI" =>
"pdnews",
74 "ilBookmarkBlockGUI" =>
"pdbookm",
75 "ilNewsForContextBlockGUI" =>
"news",
76 "ilCalendarBlockGUI" =>
"cal",
77 "ilPDCalendarBlockGUI" =>
"pdcal",
78 "ilExternalFeedBlockGUI" =>
"feed",
79 "ilPDExternalFeedBlockGUI" =>
"pdfeed",
80 "ilPDSysMessageBlockGUI" =>
"pdsysmess",
81 "ilPDSelectedItemsBlockGUI" =>
"pditems",
82 'ilPDTaggingBlockGUI' =>
'pdtag',
83 'ilChatroomBlockGUI' =>
'chatviewer',
84 'ilPollBlockGUI' =>
'poll',
85 'ilClassificationBlockGUI' =>
'clsfct',
86 'ilPDPortfolioBlockGUI' =>
'pdportf',
87 "ilPDStudyProgrammeSimpleListGUI" =>
"prgsimplelist",
88 "ilPDStudyProgrammeExpandableListGUI" =>
"prgexpandablelist" 107 "frm" => array(
"ilNewsForContextBlockGUI" =>
IL_COL_RIGHT),
138 "pd" => array(
"ilPDExternalFeedBlockGUI")
144 array(
"news" =>
true,
153 "chatviewer" =>
true,
158 array(
"pdfeed" =>
true);
165 public function __construct($a_col_type =
"", $a_side =
"", $use_std_context =
false)
183 self::$locations[$className] =
$path;
198 self::$block_types[$className] = $identifier;
208 return $_GET[
"col_side"];
218 $this->coltype = $a_coltype;
228 return $this->coltype;
238 $this->side = $a_side;
258 $this->enableedit = $a_enableedit;
278 $this->repositorymode = $a_repositorymode;
298 $this->admincommands = $a_admincommands;
318 $this->movementmode = $a_movementmode;
338 $this->enablemovement = $a_enablemovement;
358 if ($ilCtrl->getCmdClass() ==
"ilcolumngui")
360 switch ($ilCtrl->getCmd())
367 $cur_block_type =
"";
368 if (isset(
$_GET[
"block_type"]) &&
$_GET[
"block_type"])
370 $cur_block_type =
$_GET[
"block_type"];
372 else if (isset(
$_POST[
"block_type"]))
374 $cur_block_type =
$_POST[
"block_type"];
377 if ($class = array_search($cur_block_type, self::$block_types))
379 include_once(
"./".self::$locations[$class].
"classes/".
380 "class.".$class.
".php");
381 return call_user_func(array($class,
'getScreenMode'));
396 $this->block_property[$a_block_type][$a_property] = $a_value;
401 return $this->block_property[$a_block_type];
406 $this->block_property = $a_block_properties;
416 $this->repositoryitems = $a_repositoryitems;
436 $ilCtrl->setParameter($this,
"col_side" ,$this->
getSide());
439 $next_class = $ilCtrl->getNextClass();
440 $cmd = $ilCtrl->getCmd(
"getHTML");
442 $cur_block_type = (
$_GET[
"block_type"])
443 ?
$_GET[
"block_type"]
446 if ($next_class !=
"")
449 if ($gui_class = array_search($cur_block_type, self::$block_types))
451 include_once(
"./".self::$locations[$gui_class].
"classes/".
452 "class.".$gui_class.
".php");
453 $ilCtrl->setParameter($this,
"block_type", $cur_block_type);
454 $block_gui =
new $gui_class();
455 $block_gui->setProperties($this->block_property[$cur_block_type]);
460 if (in_array($gui_class, $this->custom_blocks[$this->
getColType()]) ||
461 in_array($cur_block_type, $this->rep_block_types))
463 $block_class = substr($gui_class, 0, strlen($gui_class)-3);
464 include_once(
"./".self::$locations[$gui_class].
"classes/".
465 "class.".$block_class.
".php");
466 $app_block =
new $block_class(
$_GET[
"block_id"]);
467 $block_gui->setBlock($app_block);
469 $html = $ilCtrl->forwardCommand($block_gui);
470 $ilCtrl->setParameter($this,
"block_type",
"");
477 return $this->
$cmd();
488 $ilBench->start(
"Column",
"getHTML");
490 $ilCtrl->setParameter($this,
"col_side" ,$this->
getSide());
492 $this->tpl =
new ilTemplate(
"tpl.column.html",
true,
true,
"Services/Block");
494 $ilBench->start(
"Column",
"determineBlocks");
496 $ilBench->stop(
"Column",
"determineBlocks");
498 $ilBench->start(
"Column",
"showBlocks");
500 $ilBench->stop(
"Column",
"showBlocks");
504 $this->addHiddenBlockSelector();
507 $ilBench->stop(
"Column",
"getHTML");
509 return $this->tpl->get();
520 $sum_moveable = count($this->blocks[$this->
getSide()]);
522 foreach($this->blocks[$this->
getSide()] as $block)
524 if ($ilCtrl->getContextObjType() !=
"user" ||
526 $ilUser->getId(), $block[
"id"]) > 0)
528 $gui_class = $block[
"class"];
529 $block_class = substr($block[
"class"], 0, strlen($block[
"class"])-3);
532 include_once(
"./".self::$locations[$gui_class].
"classes/".
533 "class.".$gui_class.
".php");
534 $ilBench->start(
"Column",
"instantiate-".$block[
"type"]);
535 $block_gui =
new $gui_class();
536 $ilBench->stop(
"Column",
"instantiate-".$block[
"type"]);
537 if (isset($this->block_property[$block[
"type"]]))
539 $block_gui->setProperties($this->block_property[$block[
"type"]]);
546 if ($block[
"custom"])
548 $path =
"./".self::$locations[$gui_class].
"classes/".
549 "class.".$block_class.
".php";
550 if(file_exists(
$path))
553 $app_block =
new $block_class($block[
"id"]);
560 $block_gui->setBlock($app_block);
561 if (isset($block[
"ref_id"]))
563 $block_gui->setRefId($block[
"ref_id"]);
567 $ilCtrl->setParameter($this,
"block_type", $block_gui->getBlockType());
568 $this->tpl->setCurrentBlock(
"col_block");
570 $ilBench->start(
"Column",
"showBlocks-".$block_gui->getBlockType());
571 $html = $ilCtrl->getHTML($block_gui);
572 $ilBench->stop(
"Column",
"showBlocks-".$block_gui->getBlockType());
578 include_once(
"./Services/Block/classes/class.ilDummyBlockGUI.php");
580 $bl->setBlockId($block[
"id"]);
581 $bl->setBlockType($block[
"type"]);
582 $bl->setTitle($lng->txt(
"invisible_block"));
584 $html = $bl->getHTML();
590 $this->tpl->setVariable(
"BLOCK",
$html);
591 $this->tpl->parseCurrentBlock();
592 $ilCtrl->setParameter($this,
"block_type",
"");
596 if ($block[
"type"] !=
"pdsysmess" && $block[
"type"] !=
"pdfeedb" &&
597 $block[
"type"] !=
"news")
612 function addHiddenBlockSelector()
623 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
624 $hidden_blocks = array();
626 foreach($this->blocks[$this->
getSide()] as $block)
628 include_once(
"./".self::$locations[$block[
"class"]].
"classes/".
629 "class.".$block[
"class"].
".php");
631 if ($block[
"custom"] ==
false)
633 if ($ilCtrl->getContextObjType() ==
"user")
637 $hidden_blocks[$block[
"type"]] = $lng->txt(
'block_show_'.$block[
"type"]);
640 else if ($ilCtrl->getContextObjType() !=
"")
643 $ilCtrl->getContextObjId()) == 0)
645 $hidden_blocks[$block[
"type"].
"_".$ilCtrl->getContextObjId()] = $lng->txt(
'block_show_'.$block[
"type"]);
654 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
656 $hidden_blocks[$block[
"type"].
"_".$block[
"id"]] = sprintf($lng->txt(
'block_show_x'), $cblock->getTitle());
660 if(count($hidden_blocks) > 0)
662 foreach($hidden_blocks as $id => $title)
664 $ilCtrl->setParameter($this,
'block', $id);
665 $this->action_menu->addItem($title,
'', $ilCtrl->getLinkTarget($this,
'activateBlock'));
666 $ilCtrl->setParameter($this,
'block',
'');
673 $add_blocks = array();
676 if (is_array($this->custom_blocks[$this->
getColType()]))
678 foreach($this->custom_blocks[$this->
getColType()] as $block_class)
680 include_once(
"./".self::$locations[$block_class].
"classes/".
681 "class.".$block_class.
".php");
682 $block_type = call_user_func(array($block_class,
'getBlockType'));
690 $add_blocks[$block_type] = $lng->txt(
'block_create_'.$block_type);
696 if(count($add_blocks) > 0)
698 foreach($add_blocks as $id => $title)
700 $ilCtrl->setParameter($this,
'block_type', $id);
701 $this->action_menu->addItem($title,
'', $ilCtrl->getLinkTarget($this,
'addBlock'));
702 $ilCtrl->setParameter($this,
'block_type',
'');
707 $this->addBlockSorting();
713 protected function addBlockSorting()
724 include_once
'Services/jQuery/classes/class.iljQueryUtil.php';
728 if($ilBrowser->isMobile() || $ilBrowser->isIpad())
730 $tpl->addJavaScript(
'./Services/jQuery/js/jquery.ui.touch-punch.min.js');
732 $tpl->addJavaScript(
'./Services/Block/js/block_sorting.js');
737 $this->tpl->setVariable(
'BLOCK_SORTING_STORAGE_URL', $ilCtrl->getLinkTarget($this,
'saveBlockSortingAsynch',
'',
true,
false));
738 $this->tpl->setVariable(
'BLOCK_COLUMNS', json_encode(array(
'il_left_col',
'il_right_col')));
739 $this->tpl->setVariable(
'BLOCK_COLUMNS_SELECTOR',
'#il_left_col,#il_right_col');
743 $ilCtrl->setParameter($this,
'col_side', $this->
getSide());
756 $sum_moveable = count($this->blocks[$this->
getSide()]);
758 foreach ($this->blocks[$this->
getSide()] as $block)
761 include_once(
"./".self::$locations[$block[
"class"]].
"classes/".
762 "class.".$block[
"class"].
".php");
766 if (!$block[
"custom"] && $ilCtrl->getContextObjType() !=
"" && $ilCtrl->getContextObjType() !=
"user")
768 $block[
"id"] = $ilCtrl->getContextObjId();
773 if (
$_GET[
"block_id"] ==
"block_".$block[
"type"].
"_".$block[
"id"])
775 $gui_class = $block[
"class"];
776 $block_class = substr($block[
"class"], 0, strlen($block[
"class"])-3);
778 $block_gui =
new $gui_class();
779 $block_gui->setProperties($this->block_property[$block[
"type"]]);
785 if ($block[
"custom"])
787 include_once(
"./".self::$locations[$gui_class].
"classes/".
788 "class.".$block_class.
".php");
789 $app_block =
new $block_class($block[
"id"]);
790 $block_gui->setBlock($app_block);
791 $block_gui->setRefId($block[
"ref_id"]);
794 $ilCtrl->setParameter($this,
"block_type", $block[
"type"]);
795 echo $ilCtrl->getHTML($block_gui);
801 if ($block[
"type"] !=
"pdsysmess" && $block[
"type"] !=
"pdfeedb" 802 && $block[
"type"] !=
"news")
811 echo
"Error: ilColumnGUI::updateBlock: Block '".
812 $_GET[
"block_id"].
"' unknown.";
823 if (
$_GET[
"block"] !=
"")
825 $block = explode(
"_",
$_GET[
"block"]);
826 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
830 $ilCtrl->returnToParent($this);
841 $class = array_search(
$_GET[
"block_type"], self::$block_types);
843 $ilCtrl->setCmdClass($class);
844 $ilCtrl->setCmd(
"create");
845 include_once(
"./".self::$locations[$class].
"classes/class.".$class.
".php");
846 $block_gui =
new $class();
847 $block_gui->setProperties($this->block_property[
$_GET[
"block_type"]]);
852 $ilCtrl->setParameter($this,
"block_type", $_GET[
"block_type"]);
853 $html = $ilCtrl->forwardCommand($block_gui);
854 $ilCtrl->setParameter($this,
"block_type",
"");
865 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
875 if (is_array($this->default_blocks[$this->
getColType()]))
877 foreach($this->default_blocks[$this->
getColType()] as $class => $def_side)
879 $type = self::$block_types[$class];
899 if (
$type ==
"pdsysmess")
903 if (
$type ==
"pdfeedb")
907 if (
$type ==
"clsfct")
917 $this->blocks[
$side][] = array(
929 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
931 $custom_block->setContextObjId($ilCtrl->getContextObjId());
932 $custom_block->setContextObjType($ilCtrl->getContextObjType());
933 $c_blocks = $custom_block->queryBlocksForContext();
935 foreach($c_blocks as $c_block)
937 $type = $c_block[
"type"];
941 $class = array_search(
$type, self::$block_types);
953 $this->blocks[
$side][] = array(
957 "id" => $c_block[
"id"],
964 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
967 foreach($this->rep_block_types as $block_type)
971 if (!is_array($rep_items[$block_type]))
975 foreach($rep_items[$block_type] as $item)
978 $costum_block->setContextObjId($item[
"obj_id"]);
979 $costum_block->setContextObjType($block_type);
980 $c_blocks = $costum_block->queryBlocksForContext();
981 $c_block = $c_blocks[0];
984 $class = array_search(
$type, self::$block_types);
996 $this->blocks[
$side][] = array(
1000 "id" => $c_block[
"id"],
1002 "ref_id" => $item[
"ref_id"]);
1008 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
1010 $custom_block->setContextObjId($ilCtrl->getContextObjId());
1011 $custom_block->setContextObjType($ilCtrl->getContextObjType());
1012 $c_blocks = $custom_block->queryBlocksForContext(
false);
1014 foreach($c_blocks as $c_block)
1016 $type = $c_block[
"type"];
1017 $class = array_search(
$type, self::$block_types);
1024 $this->blocks[
$side][] = array(
1028 "id" => $c_block[
"id"],
1051 if (isset($this->check_global_activation[$a_type]) && $this->check_global_activation[$a_type])
1053 if ($a_type ==
'pdbookm')
1055 if (!$ilSetting->get(
"disable_bookmarks"))
1061 else if ($a_type ==
'pdnotes')
1063 if (!$ilSetting->get(
"disable_notes"))
1069 else if ($a_type ==
'pdportf')
1071 if ($ilSetting->get(
"user_portfolios"))
1074 if ($prfa_set->get(
"pd_block",
false))
1081 elseif($a_type ==
'news')
1083 include_once
'Services/Container/classes/class.ilContainer.php';
1085 $ilSetting->get(
'block_activated_news') &&
1087 $GLOBALS[
'ilCtrl']->getContextObjId(),
1092 else if ($ilSetting->get(
"block_activated_".$a_type))
1096 elseif($a_type ==
'cal')
1098 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
1102 elseif($a_type ==
'pdcal')
1104 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
1107 elseif($a_type ==
"tagcld")
1110 return (
bool)$tags_active->get(
"enable",
false);
1124 if ($this->check_nr_limit[$a_type])
1128 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
1130 $costum_block->setContextObjId($ilCtrl->getContextObjId());
1131 $costum_block->setContextObjType($ilCtrl->getContextObjType());
1132 $costum_block->setType($a_type);
1133 $res = $costum_block->queryCntBlockForContext();
1134 $cnt = (int)
$res[0][
"cnt"];
1142 if ($ilSetting->get(
"block_limit_".$a_type) > $cnt)
1157 public function saveBlockSortingAsynch()
1164 $response =
new stdClass();
1165 $response->success =
false;
1169 echo json_encode($response);
1173 if(in_array($this->
getColType(), array(
'pd')))
1175 $response->success =
true;
1177 foreach(array(IL_COL_LEFT => (array)
$_POST[IL_COL_LEFT][
'sequence'], IL_COL_RIGHT => (array)
$_POST[IL_COL_RIGHT][
'sequence']) as
$side => $blocks)
1180 foreach($blocks as $block)
1182 $bid = explode(
'_', $block);
1191 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.
& executeCommand()
execute 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)
static _lookupDetailLevel($a_type, $a_user=0, $a_block_id=0)
Lookup detail level.
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
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.
This is the super class of all custom blocks.
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)
_lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
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.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
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.