36 protected $move = array(
"left" =>
false,
"right" =>
false,
"up" =>
false,
"down" =>
false);
95 $this->
user = $DIC->user();
96 $this->ctrl =
$DIC->ctrl();
97 $this->access =
$DIC->access();
98 $this->lng =
$DIC->language();
99 $this->main_tpl =
$DIC[
"tpl"];
100 $this->obj_def =
$DIC[
"objDefinition"];
102 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
104 $this->main_tpl->addJavaScript(
"./Services/Block/js/ilblockcallback.js");
111 $this->header_links[] =
112 array(
'href' => $a_href,
'text' => $a_text,
'status' => (
bool) $status);
127 $this->
data = $a_data;
147 $this->bigmode = $a_bigmode;
167 $this->block_id = $a_block_id;
188 $this->detail_min = $a_min;
189 $this->detail_max = $a_max;
200 $this->currentdetaillevel = $a_currentdetaillevel;
212 $this->gui_object = $a_gui_object;
222 return $this->gui_object;
232 return $this->currentdetaillevel;
242 $this->title = $a_title;
262 $this->image = $a_image;
282 $this->offset = $a_offset;
292 return $this->offset;
297 if (!($this->offset < $this->max_count)) {
309 $this->limit = $a_limit;
329 $this->enableedit = $a_enableedit;
339 return $this->enableedit;
349 $this->repositorymode = $a_repositorymode;
359 return $this->repositorymode;
369 if ($a_hide_and_icon) {
370 $this->footerinfo_icon = $a_footerinfo;
372 $this->footerinfo = $a_footerinfo;
383 if ($a_hide_and_icon) {
397 $this->subtitle = $a_subtitle;
407 return $this->subtitle;
417 $this->refid = $a_refid;
437 $this->admincommands = $a_admincommands;
447 return $this->admincommands;
457 $this->colspan = $a_colspan;
477 $this->enabledetailrow = $a_enabledetailrow;
498 $this->enablenuminfo = $a_enablenuminfo;
519 $this->
property = $a_properties;
524 return $this->
property[$a_property];
529 $this->
property[$a_property] = $a_value;
539 $this->rowtemplatename = $a_rowtemplatename;
540 $this->rowtemplatedir = $a_rowtemplatedir;
570 return $this->rowtemplatename;
580 return $this->rowtemplatedir;
594 $a_right_aligned =
false,
598 return $this->block_commands[] =
599 array(
"href" => $a_href,
600 "text" => $a_text,
"target" => $a_target,
"img" => $a_img,
601 "right" => $a_right_aligned,
"checked" => $a_checked,
"html" => $a_html);
623 $this->close_command = $a_href;
625 $this->header_commands[] =
626 array(
"href" => $a_href,
650 $a_omit_separator =
false,
653 $this->footer_links[] = array(
656 "onclick" => $a_onclick,
657 "block_id" => $a_block_id,
659 "omit_separator" => $a_omit_separator,
660 "checked" => $a_checked);
676 $this->footer_links = array();
695 if ($this->detail_max > $this->detail_min) {
696 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
706 $ilCtrl->redirectByClass(
"ilcolumngui",
"");
756 if (!$ilAccess->checkAccess(
"read",
"", $this->getRefId())) {
761 $this->tpl =
new ilTemplate(
"tpl.block.html",
true,
true,
"Services/Block");
770 $this->tpl->setCurrentBlock(
"block_check");
771 $this->tpl->setVariable(
"BL_REF_ID", $this->
getRefId());
772 $this->tpl->parseCurrentBlock();
775 if ($ilAccess->checkAccess(
"delete",
"", $this->getRefId())) {
777 "ilias.php?baseClass=ilRepositoryGUI&ref_id=" .
$_GET[
"ref_id"] .
"&cmd=delete" .
778 "&item_ref_id=" . $this->
getRefId(),
784 "ilias.php?baseClass=ilRepositoryGUI&ref_id=" .
$_GET[
"ref_id"] .
"&cmd=cut" .
785 "&item_ref_id=" . $this->
getRefId(),
791 if ($ilAccess->checkAccess(
"copy",
"", $this->getRefId())) {
793 $parent_gui =
"ilObj" . $objDefinition->getClassName($parent_type) .
"GUI";
795 $ilCtrl->setParameterByClass(
"ilobjectcopygui",
"source_id", $this->
getRefId());
796 $copy_cmd =
$ilCtrl->getLinkTargetByClass(
797 array(
"ilrepositorygui", $parent_gui,
"ilobjectcopygui"),
798 "initTargetSelection"
811 $this->tpl->setCurrentBlock(
"footer_information");
812 $this->tpl->setVariable(
"FOOTER_INFO", $this->
getFooterInfo());
813 $this->tpl->setVariable(
"FICOLSPAN", $this->
getColSpan());
814 $this->tpl->parseCurrentBlock();
817 $this->dropdown = array();
821 $has_block_command =
false;
824 if (!$command[
"img"] && !$command[
"html"]) {
825 $this->dropdown[] = $command;
829 $has_block_command =
true;
831 if ($command[
"target"] !=
"") {
832 $this->tpl->setCurrentBlock(
"bc_target");
833 $this->tpl->setVariable(
"CMD_TARGET", $command[
"target"]);
834 $this->tpl->parseCurrentBlock();
837 if ($command[
"img"] !=
"") {
838 $this->tpl->setCurrentBlock(
"bc_image");
839 $this->tpl->setVariable(
"SRC_BC", $command[
"img"]);
840 $this->tpl->setVariable(
"ALT_BC", $command[
"text"]);
841 $this->tpl->parseCurrentBlock();
842 $this->tpl->setCurrentBlock(
"block_command");
843 } elseif ($command[
"html"] !=
"") {
844 if ($command[
'href'] !==
'') {
845 $this->tpl->setCurrentBlock(
"bc_html");
846 $this->tpl->setVariable(
"HTML", $command[
"html"]);
847 $this->tpl->parseCurrentBlock();
848 $this->tpl->setCurrentBlock(
"block_command");
850 $this->tpl->setCurrentBlock(
'bc_html_nohref');
851 $this->tpl->setVariable(
'HTML_NOHREF', $command[
'html']);
852 $this->tpl->parseCurrentBlock();
853 $this->tpl->setCurrentBlock(
"block_command");
856 $this->tpl->setCurrentBlock(
"block_command");
857 $this->tpl->setVariable(
"CMD_TEXT", $command[
"text"]);
858 $this->tpl->setVariable(
"BC_CLASS",
'class="il_ContainerItemCommand"');
861 if ($command[
'href'] !==
'') {
862 $this->tpl->setVariable(
"CMD_HREF", $command[
"href"]);
864 $this->tpl->parseCurrentBlock();
867 if ($has_block_command) {
868 $this->tpl->setCurrentBlock(
"block_commands");
869 $this->tpl->setVariable(
"CCOLSPAN", $this->
getColSpan());
870 $this->tpl->parseCurrentBlock();
888 $this->tpl->setCurrentBlock(
'head_delim');
889 $this->tpl->touchBlock(
'head_delim');
890 $this->tpl->parseCurrentBlock();
892 if ($command[
'status'] ==
true) {
893 $this->tpl->setCurrentBlock(
'head_link');
894 $this->tpl->setVariable(
'HHREF', $command[
'href']);
895 $this->tpl->setVariable(
'HLINK', $command[
'text']);
896 $this->tpl->parseCurrentBlock();
898 $this->tpl->setCurrentBlock(
'head_text');
899 $this->tpl->setVariable(
'HTEXT', $command[
'text']);
900 $this->tpl->parseCurrentBlock();
903 $this->tpl->setCurrentBlock(
'head_item');
904 $this->tpl->parseCurrentBlock();
909 $this->tpl->setCurrentBlock(
'header_links');
910 $this->tpl->parseCurrentBlock();
917 if (is_object(
$ilUser) &&
$ilUser->getPref(
"screen_reader_optimization")) {
925 $this->tpl->setVariable(
"COLSPAN", $this->
getColSpan());
927 $this->tpl->touchBlock(
"hclassb");
929 $this->tpl->touchBlock(
"hclass");
934 echo $this->tpl->getAsynch();
937 return '<div id="' .
"block_" . $this->
getBlockType() .
"_" . $this->block_id .
'">' .
938 $this->tpl->get() .
'</div>';
953 ($this->detail_max > $this->detail_min && $this->detail_min == 0) ||
954 $this->close_command !=
"") {
956 $this->tpl->setCurrentBlock(
"header_command");
957 $this->tpl->setVariable(
"HREF_HCOMM", $command[
"href"]);
958 $this->tpl->setVariable(
"TXT_HCOMM", $command[
"text"]);
959 $this->tpl->parseCurrentBlock();
963 if (($this->detail_max > $this->detail_min && $this->detail_min == 0 &&
966 $this->close_command !=
"") {
967 $alt =
$lng->txt(
"hide");
968 if ($this->close_command !=
"") {
976 $url =
$ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"");
984 $this->dropdown[] = array(
"text" => $alt,
989 $this->tpl->setCurrentBlock(
"header_commands");
990 $this->tpl->parseCurrentBlock();
994 include_once
"Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
1000 foreach ($this->dropdown as $item) {
1001 if ($item[
"href"] || $item[
"onclick"]) {
1002 if ($item[
"checked"]) {
1019 $this->tpl->setCurrentBlock(
"header_dropdown");
1020 $this->tpl->setVariable(
"ADV_DROPDOWN",
$dropdown);
1021 $this->tpl->parseCurrentBlock();
1023 $this->tpl->setCurrentBlock(
"hitem");
1024 $this->tpl->parseCurrentBlock();
1037 $this->tpl->setCurrentBlock(
"block_img");
1038 $this->tpl->setVariable(
"IMG_BLOCK", $this->
getImage());
1039 $this->tpl->setVariable(
1041 "block_" . $this->
getBlockType() .
"_" . $this->block_id
1043 $this->tpl->setVariable(
1045 str_replace(array(
"'",
'"'),
"", strip_tags(
$lng->txt(
"icon") .
" " . $this->getTitle()))
1047 $this->tpl->parseCurrentBlock();
1051 $this->tpl->setCurrentBlock(
"header_title");
1052 $this->tpl->setVariable(
1054 "block_" . $this->
getBlockType() .
"_" . $this->block_id
1056 $this->tpl->setVariable(
1060 $this->tpl->setVariable(
1064 $this->tpl->parseCurrentBlock();
1066 $this->tpl->setCurrentBlock(
"hitem");
1067 $this->tpl->parseCurrentBlock();
1076 $this->tpl->setCurrentBlock(
"data_section");
1078 $this->tpl->parseCurrentBlock();
1079 $this->tpl->setVariable(
"BLOCK_ROW",
"");
1097 $nav = explode(
":", $this->nav_value);
1098 if (isset($nav[2])) {
1105 $this->tpl->addBlockFile(
1113 $this->max_count = count(
$data);
1119 foreach (
$data as $record) {
1120 $this->tpl->setCurrentBlock(
"block_row");
1123 $this->tpl->setCurrentBlock(
"block_row");
1124 $this->tpl->parseCurrentBlock();
1130 foreach ($a_set as
$key => $value) {
1131 $this->tpl->setVariable(
"VAL_" . strtoupper(
$key), $value);
1141 $this->css_row = ($this->css_row !=
"ilBlockRow1")
1144 $this->tpl->setVariable($a_placeholder, $this->css_row);
1160 if (
$end > $this->max_count or $this->
getLimit() == 0) {
1164 $numinfo =
"(" .
$start .
"-" .
$end .
" " . strtolower(
$lng->txt(
"of")) .
" " . $this->max_count .
")";
1199 "block_" . $this->
getBlockType() .
"_" . $this->block_id
1202 $onclick =
$ilCtrl->getLinkTargetByClass(
1215 $href =
$ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"");
1222 $pages = intval($this->max_count / $this->
getLimit());
1225 if (($this->max_count % $this->
getLimit())) {
1230 if (!(($this->
getOffset() / $this->
getLimit()) == ($pages - 1)) && ($pages != 1)) {
1243 "block_" . $this->
getBlockType() .
"_" . $this->block_id
1247 $onclick =
$ilCtrl->getLinkTargetByClass(
1262 $href =
$ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"");
1288 $prefix = ($a_top) ?
"top" :
"foot";
1292 $omit_separator =
false;
1293 foreach ($flinks as $flink) {
1294 if ($flink[
"top"] != $a_top) {
1299 if ($flink[
"onclick"]) {
1300 $flink[
"onclick"] =
"ilBlockJSHandler('" . $flink[
"block_id"] .
1301 "','" . $flink[
"onclick"] .
"')";
1303 $this->dropdown[] = $flink;
1309 if (!$first && !$omit_separator) {
1310 $this->tpl->touchBlock($prefix .
"_delim");
1311 $this->tpl->touchBlock($prefix .
"_item");
1315 if ($flink[
"onclick"] !=
"") {
1316 $this->tpl->setCurrentBlock($prefix .
"_onclick");
1317 $this->tpl->setVariable(
1321 $this->tpl->setVariable(
1325 $this->tpl->parseCurrentBlock();
1329 if ($flink[
"href"] !=
"") {
1331 $this->tpl->setCurrentBlock($prefix .
"_link");
1332 $this->tpl->setVariable(
1336 $this->tpl->setVariable(
"FLINK", $flink[
"text"]);
1337 $this->tpl->parseCurrentBlock();
1338 $this->tpl->touchBlock($prefix .
"_item");
1340 $this->tpl->setCurrentBlock($prefix .
"_text");
1341 $this->tpl->setVariable(
"FTEXT", $flink[
"text"]);
1342 $this->tpl->parseCurrentBlock();
1343 $this->tpl->touchBlock($prefix .
"_item");
1347 $omit_separator = $flink[
"omit_separator"];
1350 if ($a_numinfo !=
"" && $has_link) {
1351 $this->tpl->setVariable(
"NUMINFO", $a_numinfo);
1373 if ($this->enabledetailrow ==
false) {
1377 $start = ($this->detail_min < 1)
1379 : $this->detail_min;
1383 : $this->detail_max;
1385 $settings = array();
1391 foreach ($settings as
$i) {
1404 $onclick = $onclick_id =
"";
1411 "block_" . $this->
getBlockType() .
"_" . $this->block_id
1413 $onclick =
$ilCtrl->getLinkTargetByClass(
1430 $url =
$ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"");
1433 $onclick =
"ilBlockJSHandler('" . $onclick_id .
"','" . $onclick .
"')";
1437 $this->dropdown[] = array(
"text" =>
$text,
1440 "onclick" => $onclick,
1441 "checked" => $checked);
1447 $this->tpl->setCurrentBlock(
"det_info");
1448 $this->tpl->setVariable(
"INFO_TEXT", $this->
getFooterInfo(
true));
1449 $this->tpl->setVariable(
"ALT_DET_INFO",
$lng->txt(
"info_short"));
1452 $this->tpl->parseCurrentBlock();
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
This class represents a block method of a block.
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
setLimit($a_limit)
Set Limit.
getBlockCommands()
Get Block commands.
setImage($a_image)
Set Image.
fillHeaderCommands()
Fill header commands block.
setFooterInfo($a_footerinfo, $a_hide_and_icon=false)
Set Footer Info.
getCurrentDetailLevel()
Get Current Detail Level.
getEnableDetailRow()
Get EnableDetailRow.
getBlockId()
Get Block Id.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
setEnableDetailRow($a_enabledetailrow)
Set EnableDetailRow.
addFooterLink( $a_text, $a_href="", $a_onclick="", $a_block_id="", $a_top=false, $a_omit_separator=false, $a_checked=false)
Add a footer text/link.
setSubtitle($a_subtitle)
Set Subtitle.
isRepositoryObject()
Returns whether block has a corresponding repository object.
setData($a_data)
Set Data.
setRefId($a_refid)
Set Ref Id (only used if isRepositoryObject() is true).
fillDetailRow()
Fill Detail Setting Row.
getRepositoryMode()
Get RepositoryMode.
__construct()
Constructor.
fillFooterLinks($a_top=false, $a_numinfo="")
Fill footer links.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
getAdminCommands()
Get Administration Commmands.
getHeaderCommands()
Get Header Block commands.
addHeaderCommand($a_href, $a_text, $a_as_close=false)
Add Header Block Command.
preloadData(array $data)
Can be overwritten in subclasses.
fillHeaderTitleBlock()
Fill header title block (title and.
fillDataSection()
Standard implementation for row based data.
static getScreenMode()
Get Screen Mode for current command.
getBigMode()
Get Big Mode.
setOffset($a_offset)
Set Offset.
setBigMode($a_bigmode)
Set Big Mode.
getRowTemplateDir()
Get Row Template Directory.
getGuiObject()
Get GuiObject.
fillRowColor($a_placeholder="CSS_ROW")
getFooterLinks()
Get footer links.
getFooterInfo($a_hide_and_icon=false)
Get Footer Info.
addHeaderLink($a_href, $a_text, $status=true)
getRowTemplateName()
Get Row Template Name.
getEnableEdit()
Get EnableEdit.
setEnableEdit($a_enableedit)
Set EnableEdit.
setColSpan($a_colspan)
Set Columns Span.
setTitle($a_title)
Set Title.
setAdminCommands($a_admincommands)
Set Administration Commmands.
setBlockId($a_block_id=0)
Set Block Id.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
addBlockCommand( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
getColSpan()
Get Columns Span.
handleDetailLevel()
Handle read/write current detail level.
getEnableNumInfo()
Get Enable Item Number Info.
setCurrentDetailLevel($a_currentdetaillevel)
Set Current Detail Level.
getRefId()
Get Ref Id (only used if isRepositoryObject() is true).
fillPreviousNext()
Fill previous/next row.
setGuiObject(&$a_gui_object)
Set GuiObject.
clearFooterLinks()
Clear footer links.
setProperties($a_properties)
This function is supposed to be used for block type specific properties, that should be inherited thr...
setRepositoryMode($a_repositorymode)
Set RepositoryMode.
getHTML()
Handle config status.
setPreviousNextLinks()
Get previous/next linkbar.
setProperty($a_property, $a_value)
getSubtitle()
Get Subtitle.
static _writeDetailLevel($a_type, $a_value, $a_user=0, $a_block_id=0)
Write detail level to database.
static _lookupDetailLevel($a_type, $a_user=0, $a_block_id=0)
Lookup detail level.
static _lookupType($a_id, $a_reference=false)
lookup object type
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static initConnection(ilTemplate $a_main_tpl=null)
Init YUI Connection module.