ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilBlockGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
12abstract class ilBlockGUI
13{
14 abstract static function getBlockType(); // return block type, e.g. "feed"
15 abstract static function isRepositoryObject(); // returns whether block has a
16 // corresponding repository object
17
18 protected $data = array();
19 protected $colspan = 1;
20 protected $enablenuminfo = true;
21 protected $detail_min = 0;
22 protected $detail_max = 0;
23 protected $bigmode = false;
24 protected $footer_links = array();
25 protected $block_id = 0;
26 protected $header_commands = array();
27 protected $allow_moving = true;
28 protected $move = array("left" => false, "right" => false, "up" => false, "down" => false);
29 protected $enabledetailrow = true;
30 protected $header_links = array();
31 protected $footerinfo = false;
32 protected $footerinfo_icon = false;
33 protected $block_commands = array();
34 protected $max_count = false;
35 protected $close_command = false;
36 protected $image = false;
37 protected $property = false;
38 protected $nav_value = "";
39 protected $css_row = "";
40
41 protected $dropdown;
42
48 function ilBlockGUI()
49 {
50 global $ilUser, $tpl, $ilCtrl;
51
52 include_once("./Services/YUI/classes/class.ilYuiUtil.php");
54 $tpl->addJavaScript("./Services/Block/js/ilblockcallback.js");
55
56 $this->setLimit($ilUser->getPref("hits_per_page"));
57 }
58
59 public function addHeaderLink($a_href, $a_text, $status = true)
60 {
61 $this->header_links[] =
62 array('href' => $a_href, 'text' => $a_text, 'status' => (bool)$status);
63 }
64
65 public function getHeaderLinks()
66 {
68 }
69
75 function setData($a_data)
76 {
77 $this->data = $a_data;
78 }
79
85 function getData()
86 {
87 return $this->data;
88 }
89
95 function setBigMode($a_bigmode)
96 {
97 $this->bigmode = $a_bigmode;
98 }
99
105 function getBigMode()
106 {
107 return $this->bigmode;
108 }
109
115 function setBlockId($a_block_id = 0)
116 {
117 $this->block_id = $a_block_id;
118 }
119
125 function getBlockId()
126 {
127 return $this->block_id;
128 }
129
136 function setAvailableDetailLevels($a_max, $a_min = 0)
137 {
138 $this->detail_min = $a_min;
139 $this->detail_max = $a_max;
140 $this->handleDetailLevel();
141 }
142
148 function setCurrentDetailLevel($a_currentdetaillevel)
149 {
150 $this->currentdetaillevel = $a_currentdetaillevel;
151 }
152
160 public function setGuiObject(&$a_gui_object)
161 {
162 $this->gui_object = $a_gui_object;
163 }
164
170 public function getGuiObject()
171 {
172 return $this->gui_object;
173 }
174
181 {
182 return $this->currentdetaillevel;
183 }
184
190 function setTitle($a_title)
191 {
192 $this->title = $a_title;
193 }
194
200 function getTitle()
201 {
202 return $this->title;
203 }
204
210 function setImage($a_image)
211 {
212 $this->image = $a_image;
213 }
214
220 function getImage()
221 {
222 return $this->image;
223 }
224
230 function setOffset($a_offset)
231 {
232 $this->offset = $a_offset;
233 }
234
240 function getOffset()
241 {
242 return $this->offset;
243 }
244
245 function correctOffset()
246 {
247 if (!($this->offset < $this->max_count))
248 {
249 $this->setOffset(0);
250 }
251 }
252
258 function setLimit($a_limit)
259 {
260 $this->limit = $a_limit;
261 }
262
268 function getLimit()
269 {
270 return $this->limit;
271 }
272
278 function setEnableEdit($a_enableedit)
279 {
280 $this->enableedit = $a_enableedit;
281 }
282
288 function getEnableEdit()
289 {
290 return $this->enableedit;
291 }
292
298 function setRepositoryMode($a_repositorymode)
299 {
300 $this->repositorymode = $a_repositorymode;
301 }
302
309 {
310 return $this->repositorymode;
311 }
312
318 function setFooterInfo($a_footerinfo, $a_hide_and_icon = false)
319 {
320 if ($a_hide_and_icon)
321 {
322 $this->footerinfo_icon = $a_footerinfo;
323 }
324 else
325 {
326 $this->footerinfo = $a_footerinfo;
327 }
328 }
329
335 function getFooterInfo($a_hide_and_icon = false)
336 {
337 if ($a_hide_and_icon)
338 {
340 }
341 else
342 {
343 return $this->footerinfo;
344 }
345 }
346
352 function setSubtitle($a_subtitle)
353 {
354 $this->subtitle = $a_subtitle;
355 }
356
362 function getSubtitle()
363 {
364 return $this->subtitle;
365 }
366
372 function setRefId($a_refid)
373 {
374 $this->refid = $a_refid;
375 }
376
382 function getRefId()
383 {
384 return $this->refid;
385 }
386
392 function setAdminCommands($a_admincommands)
393 {
394 $this->admincommands = $a_admincommands;
395 }
396
403 {
404 return $this->admincommands;
405 }
406
412 function setColSpan($a_colspan)
413 {
414 $this->colspan = $a_colspan;
415 }
416
422 function getColSpan()
423 {
424 return $this->colspan;
425 }
426
432 function setEnableDetailRow($a_enabledetailrow)
433 {
434 $this->enabledetailrow = $a_enabledetailrow;
435 }
436
443 {
445 }
446
447
453 function setEnableNumInfo($a_enablenuminfo)
454 {
455 $this->enablenuminfo = $a_enablenuminfo;
456 }
457
464 {
466 }
467
474 function setProperties($a_properties)
475 {
476 $this->property = $a_properties;
477 }
478
479 function getProperty($a_property)
480 {
481 return $this->property[$a_property];
482 }
483
484 function setProperty($a_property, $a_value)
485 {
486 $this->property[$a_property] = $a_value;
487 }
488
494 function setRowTemplate($a_rowtemplatename, $a_rowtemplatedir = "")
495 {
496 $this->rowtemplatename = $a_rowtemplatename;
497 $this->rowtemplatedir = $a_rowtemplatedir;
498 }
499
500 final public function getNavParameter()
501 {
502 return $this->getBlockType()."_".$this->getBlockId()."_blnav";
503 }
504
505 final public function getDetailParameter()
506 {
507 return $this->getBlockType()."_".$this->getBlockId()."_bldet";
508 }
509
510 final public function getConfigParameter()
511 {
512 return $this->getBlockType()."_".$this->getBlockId()."_blconf";
513 }
514
515 final public function getMoveParameter()
516 {
517 return $this->getBlockType()."_".$this->getBlockId()."_blmove";
518 }
519
526 {
527 return $this->rowtemplatename;
528 }
529
536 {
537 return $this->rowtemplatedir;
538 }
539
546 function addBlockCommand($a_href, $a_text, $a_target = "", $a_img = "", $a_right_aligned = false,
547 $a_checked = false, $a_html = "")
548 {
549 return $this->block_commands[] =
550 array("href" => $a_href,
551 "text" => $a_text, "target" => $a_target, "img" => $a_img,
552 "right" => $a_right_aligned, "checked" => $a_checked, "html" => $a_html);
553 }
554
561 {
563 }
564
571 function addHeaderCommand($a_href, $a_text, $a_as_close = false)
572 {
573 if ($a_as_close)
574 {
575 $this->close_command = $a_href;
576 }
577 else
578 {
579 $this->header_commands[] =
580 array("href" => $a_href,
581 "text" => $a_text);
582 }
583 }
584
591 {
593 }
594
598 function addFooterLink($a_text, $a_href = "", $a_onclick = "", $a_block_id = "",
599 $a_top = false, $a_omit_separator = false, $a_checked = false)
600 {
601 $this->footer_links[] = array(
602 "text" => $a_text,
603 "href" => $a_href,
604 "onclick" => $a_onclick,
605 "block_id" => $a_block_id,
606 "top" => $a_top,
607 "omit_separator" => $a_omit_separator,
608 "checked" => $a_checked);
609 }
610
614 function getFooterLinks()
615 {
616 return $this->footer_links;
617 }
618
623 {
624 $this->footer_links = array();
625 }
626
630 static function getScreenMode()
631 {
632 return IL_SCREEN_SIDE;
633 }
634
639 {
640 global $ilUser, $ilCtrl;
641
642 // set/get detail level
643 if ($this->detail_max > $this->detail_min)
644 {
645 include_once("Services/Block/classes/class.ilBlockSetting.php");
646 if (isset($_GET[$this->getDetailParameter()]))
647 {
649 $ilUser->getId(), $this->block_id);
651 if ((int) $_GET[$this->getDetailParameter()] == 0)
652 {
653 $ilCtrl->redirectByClass("ilcolumngui", "");
654 }
655 }
656 else
657 {
659 $ilUser->getId(), $this->block_id));
660 }
661 }
662 }
663
667/*
668 function handleConfigStatus()
669 {
670 $this->config_mode = false;
671
672 if ($_GET[$this->getConfigParameter()] == "toggle")
673 {
674 if ($_SESSION[$this->getConfigParameter()] == "on")
675 {
676 $_SESSION[$this->getConfigParameter()] = "off";
677 }
678 else
679 {
680 $_SESSION[$this->getConfigParameter()] = "on";
681 }
682 }
683 if ($_SESSION[$this->getConfigParameter()] == "on")
684 {
685 $this->config_mode = true;
686 }
687 }
688*/
689
693 function getHTML()
694 {
695 global $ilCtrl, $lng, $ilAccess, $ilUser;
696
697 if ($this->isRepositoryObject())
698 {
699 if (!$ilAccess->checkAccess("read", "", $this->getRefId()))
700 {
701 return "";
702 }
703 }
704
705 $this->tpl = new ilTemplate("tpl.block.html", true, true, "Services/Block");
706
707// $this->handleConfigStatus();
708
709 $this->fillDataSection();
710
711 if ($this->getRepositoryMode() && $this->isRepositoryObject())
712 {
713 // #10993
714 if ($this->getAdminCommands())
715 {
716 $this->tpl->setCurrentBlock("block_check");
717 $this->tpl->setVariable("BL_REF_ID", $this->getRefId());
718 $this->tpl->parseCurrentBlock();
719 }
720
721 if ($ilAccess->checkAccess("delete", "", $this->getRefId()))
722 {
723 $this->addBlockCommand(
724 "ilias.php?baseClass=ilRepositoryGUI&ref_id=".$_GET["ref_id"]."&cmd=delete".
725 "&item_ref_id=".$this->getRefId(),
726 $lng->txt("delete"));
727
728 // see ilObjectListGUI::insertCutCommand();
729 $this->addBlockCommand(
730 "ilias.php?baseClass=ilRepositoryGUI&ref_id=".$_GET["ref_id"]."&cmd=cut".
731 "&item_ref_id=".$this->getRefId(),
732 $lng->txt("move"));
733 }
734
735 // #14595 - see ilObjectListGUI::insertCopyCommand()
736 if ($ilAccess->checkAccess("copy", "", $this->getRefId()))
737 {
738 global $objDefinition;
739 $parent_type = ilObject::_lookupType($_GET["ref_id"], true);
740 $parent_gui = "ilObj".$objDefinition->getClassName($parent_type)."GUI";
741
742 $ilCtrl->setParameterByClass("ilobjectcopygui", "source_id", $this->getRefId());
743 $copy_cmd = $ilCtrl->getLinkTargetByClass(
744 array("ilrepositorygui", $parent_gui, "ilobjectcopygui"),
745 "initTargetSelection");
746
747 // see ilObjectListGUI::insertCopyCommand();
748 $this->addBlockCommand(
749 $copy_cmd,
750 $lng->txt("copy"));
751 }
752 }
753
754 // footer info
755 if ($this->getFooterInfo() != "")
756 {
757 $this->tpl->setCurrentBlock("footer_information");
758 $this->tpl->setVariable("FOOTER_INFO", $this->getFooterInfo());
759 $this->tpl->setVariable("FICOLSPAN", $this->getColSpan());
760 $this->tpl->parseCurrentBlock();
761 }
762
763 $this->dropdown = array();
764
765 // commands
766 if (count($this->getBlockCommands()) > 0)
767 {
768 $has_block_command = false;
769
770 foreach($this->getBlockCommands() as $command)
771 {
772 if(!$command["img"] && !$command["html"])
773 {
774 $this->dropdown[] = $command;
775 continue;
776 }
777
778 $has_block_command = true;
779
780 if ($command["target"] != "")
781 {
782 $this->tpl->setCurrentBlock("bc_target");
783 $this->tpl->setVariable("CMD_TARGET", $command["target"]);
784 $this->tpl->parseCurrentBlock();
785 }
786
787 if ($command["img"] != "")
788 {
789 $this->tpl->setCurrentBlock("bc_image");
790 $this->tpl->setVariable("SRC_BC", $command["img"]);
791 $this->tpl->setVariable("ALT_BC", $command["text"]);
792 $this->tpl->parseCurrentBlock();
793 $this->tpl->setCurrentBlock("block_command");
794 }
795 else if ($command["html"] != "")
796 {
797 $this->tpl->setCurrentBlock("bc_html");
798 $this->tpl->setVariable("HTML", $command["html"]);
799 $this->tpl->parseCurrentBlock();
800 $this->tpl->setCurrentBlock("block_command");
801 }
802 else
803 {
804 $this->tpl->setCurrentBlock("block_command");
805 $this->tpl->setVariable("CMD_TEXT", $command["text"]);
806 $this->tpl->setVariable("BC_CLASS", 'class="il_ContainerItemCommand"');
807 }
808
809 $this->tpl->setVariable("CMD_HREF", $command["href"]);
810 $this->tpl->parseCurrentBlock();
811 }
812
813 if($has_block_command)
814 {
815 $this->tpl->setCurrentBlock("block_commands");
816 $this->tpl->setVariable("CCOLSPAN", $this->getColSpan());
817 $this->tpl->parseCurrentBlock();
818 }
819 }
820
821 // fill previous next
822 $this->fillPreviousNext();
823
824 // fill footer
825 $this->fillFooter();
826
827 // fill row for setting details
828 $this->fillDetailRow();
829
830 // header links
831 if(count($this->getHeaderLinks()))
832 {
833 $counter = 0;
834 foreach($this->getHeaderLinks() as $command)
835 {
836 if($counter > 0)
837 {
838 $this->tpl->setCurrentBlock('head_delim');
839 $this->tpl->touchBlock('head_delim');
840 $this->tpl->parseCurrentBlock();
841 }
842 if($command['status'] == true)
843 {
844 $this->tpl->setCurrentBlock('head_link');
845 $this->tpl->setVariable('HHREF', $command['href']);
846 $this->tpl->setVariable('HLINK', $command['text']);
847 $this->tpl->parseCurrentBlock();
848 }
849 else
850 {
851 $this->tpl->setCurrentBlock('head_text');
852 $this->tpl->setVariable('HTEXT', $command['text']);
853 $this->tpl->parseCurrentBlock();
854 }
855
856 $this->tpl->setCurrentBlock('head_item');
857 $this->tpl->parseCurrentBlock();
858
859 ++$counter;
860 }
861
862 $this->tpl->setCurrentBlock('header_links');
863 $this->tpl->parseCurrentBlock();
864 }
865
866 // for screen readers we first output the title and the commands
867 // (e.g. close icon afterwards), otherwise we first output the
868 // header commands, since we want to have the close icon top right
869 // and not floated after the title
870 if (is_object($ilUser) && $ilUser->getPref("screen_reader_optimization"))
871 {
872 $this->fillHeaderTitleBlock();
873 $this->fillHeaderCommands();
874 }
875 else
876 {
877 $this->fillHeaderCommands();
878 $this->fillHeaderTitleBlock();
879 }
880
881 $this->tpl->setVariable("COLSPAN", $this->getColSpan());
882 if ($this->getBigMode())
883 {
884 $this->tpl->touchBlock("hclassb");
885 }
886 else
887 {
888 $this->tpl->touchBlock("hclass");
889 }
890
891 if ($ilCtrl->isAsynch())
892 {
893 // return without div wrapper
894 echo $this->tpl->getAsynch();
895 }
896 else
897 {
898 // return incl. wrapping div with id
899 return '<div id="'."block_".$this->getBlockType()."_".$this->block_id.'">'.
900 $this->tpl->get().'</div>';
901 }
902 }
903
908 {
909 global $lng, $ilCtrl;
910
911 // header commands
912 if (count($this->getHeaderCommands()) > 0 ||
913 ($this->detail_max > $this->detail_min && $this->detail_min == 0) ||
914 $this->close_command != "")
915 {
916
917 foreach($this->getHeaderCommands() as $command)
918 {
919 $this->tpl->setCurrentBlock("header_command");
920 $this->tpl->setVariable("HREF_HCOMM", $command["href"]);
921 $this->tpl->setVariable("TXT_HCOMM", $command["text"]);
922 $this->tpl->parseCurrentBlock();
923 }
924
925 // close button
926 if (($this->detail_max > $this->detail_min && $this->detail_min == 0 &&
927 !$this->getRepositoryMode())
928 ||
929 $this->close_command != "")
930 {
931 $alt = $lng->txt("hide");
932 if ($this->close_command != "")
933 {
935 }
936 else
937 {
938 $ilCtrl->setParameterByClass("ilcolumngui",
939 $this->getDetailParameter(), "0");
940 $url = $ilCtrl->getLinkTargetByClass("ilcolumngui", "");
941 $ilCtrl->setParameterByClass("ilcolumngui",
942 $this->getDetailParameter(), "");
943 }
944
945 $this->dropdown[] = array("text" => $alt,
946 "image" => $img,
947 "href" => $url);
948 }
949
950 $this->tpl->setCurrentBlock("header_commands");
951 $this->tpl->parseCurrentBlock();
952 }
953
954 // adv selection gui
955 include_once "Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
957 $dropdown->setUseImages(true);
960 $dropdown->setId("block_dd_".$this->getBlockType()."_".$this->block_id);
961 foreach($this->dropdown as $item)
962 {
963 if($item["href"] || $item["onclick"])
964 {
965 if ($item["checked"])
966 {
967 $item["image"] = ilUtil::getImagePath("icon_checked.svg");
968 }
969 $dropdown->addItem($item["text"], "", $item["href"], $item["image"],
970 $item["text"], "", "", false, $item["onclick"]);
971 }
972 }
973 $dropdown = $dropdown->getHTML();
974 $this->tpl->setCurrentBlock("header_dropdown");
975 $this->tpl->setVariable("ADV_DROPDOWN", $dropdown);
976 $this->tpl->parseCurrentBlock();
977
978 $this->tpl->setCurrentBlock("hitem");
979 $this->tpl->parseCurrentBlock();
980 }
981
982
987 {
988 global $lng;
989
990 // image
991 if ($this->getImage() != "")
992 {
993 $this->tpl->setCurrentBlock("block_img");
994 $this->tpl->setVariable("IMG_BLOCK", $this->getImage());
995 $this->tpl->setVariable("IMID",
996 "block_".$this->getBlockType()."_".$this->block_id);
997 $this->tpl->setVariable("IMG_ALT",
998 str_replace(array("'",'"'), "", strip_tags($lng->txt("icon")." ".$this->getTitle())));
999 $this->tpl->parseCurrentBlock();
1000 }
1001
1002 // header title
1003 $this->tpl->setCurrentBlock("header_title");
1004 $this->tpl->setVariable("BTID",
1005 "block_".$this->getBlockType()."_".$this->block_id);
1006 $this->tpl->setVariable("BLOCK_TITLE",
1007 $this->getTitle());
1008 $this->tpl->setVariable("TXT_BLOCK",
1009 $lng->txt("block"));
1010 $this->tpl->parseCurrentBlock();
1011
1012 $this->tpl->setCurrentBlock("hitem");
1013 $this->tpl->parseCurrentBlock();
1014 }
1015
1016
1020 function setDataSection($a_content)
1021 {
1022 $this->tpl->setCurrentBlock("data_section");
1023 $this->tpl->setVariable("DATA", $a_content);
1024 $this->tpl->parseCurrentBlock();
1025 $this->tpl->setVariable("BLOCK_ROW", "");
1026 }
1027
1033 {
1034 $this->nav_value = (isset($_POST[$this->getNavParameter()]) && $_POST[$this->getNavParameter()] != "")
1035 ? $_POST[$this->getNavParameter()]
1036 : (isset($_GET[$this->getNavParameter()]) ? $_GET[$this->getNavParameter()] : $this->nav_value);
1037 $this->nav_value = ($this->nav_value == "" && isset($_SESSION[$this->getNavParameter()]))
1038 ? $_SESSION[$this->getNavParameter()]
1040
1042
1043 $nav = explode(":", $this->nav_value);
1044 if (isset($nav[2]))
1045 {
1046 $this->setOffset($nav[2]);
1047 }
1048 else
1049 {
1050 $this->setOffset(0);
1051 }
1052
1053 // data
1054 $this->tpl->addBlockFile("BLOCK_ROW", "block_row", $this->getRowTemplateName(),
1055 $this->getRowTemplateDir());
1056
1057 $data = $this->getData();
1058 $this->max_count = count($data);
1059 $this->correctOffset();
1060 $data = array_slice($data, $this->getOffset(), $this->getLimit());
1061
1062 $this->preloadData($data);
1063
1064 foreach($data as $record)
1065 {
1066 $this->tpl->setCurrentBlock("block_row");
1067 $this->fillRowColor();
1068 $this->fillRow($record);
1069 $this->tpl->setCurrentBlock("block_row");
1070 $this->tpl->parseCurrentBlock();
1071 }
1072 }
1073
1074 function fillRow($a_set)
1075 {
1076 foreach ($a_set as $key => $value)
1077 {
1078 $this->tpl->setVariable("VAL_".strtoupper($key), $value);
1079 }
1080 }
1081
1082 function fillFooter()
1083 {
1084 }
1085
1086 final protected function fillRowColor($a_placeholder = "CSS_ROW")
1087 {
1088 $this->css_row = ($this->css_row != "ilBlockRow1")
1089 ? "ilBlockRow1"
1090 : "ilBlockRow2";
1091 $this->tpl->setVariable($a_placeholder, $this->css_row);
1092 }
1093
1098 {
1099 global $lng, $ilCtrl;
1100
1101 $pn = false;
1102
1103 // table pn numinfo
1104 $numinfo = "";
1105 if ($this->getEnableNumInfo() && $this->max_count > 0)
1106 {
1107 $start = $this->getOffset() + 1; // compute num info
1108 $end = $this->getOffset() + $this->getLimit();
1109
1110 if ($end > $this->max_count or $this->getLimit() == 0)
1111 {
1112 $end = $this->max_count;
1113 }
1114
1115 $numinfo = "(".$start."-".$end." ".strtolower($lng->txt("of"))." ".$this->max_count.")";
1116 }
1117
1118 $this->setPreviousNextLinks();
1119 $this->fillFooterLinks(true, $numinfo);
1120
1121 }
1122
1131 {
1132 global $ilCtrl, $lng;
1133
1134 // if more entries then entries per page -> show link bar
1135 if ($this->max_count > $this->getLimit() && ($this->getLimit() != 0))
1136 {
1137 // previous link
1138 if ($this->getOffset() >= 1)
1139 {
1140 $prevoffset = $this->getOffset() - $this->getLimit();
1141
1142 $ilCtrl->setParameterByClass("ilcolumngui",
1143 $this->getNavParameter(), "::".$prevoffset);
1144
1145 // ajax link
1146 $ilCtrl->setParameterByClass("ilcolumngui",
1147 "block_id", "block_".$this->getBlockType()."_".$this->block_id);
1148 $block_id = "block_".$this->getBlockType()."_".$this->block_id;
1149 $onclick = $ilCtrl->getLinkTargetByClass("ilcolumngui",
1150 "updateBlock", "", true);
1151 $ilCtrl->setParameterByClass("ilcolumngui",
1152 "block_id", "");
1153
1154 // normal link
1155 $href = $ilCtrl->getLinkTargetByClass("ilcolumngui", "");
1156 $text = $lng->txt("previous");
1157
1158 $this->addFooterLink($text, $href, $onclick, $block_id, true);
1159 }
1160
1161 // calculate number of pages
1162 $pages = intval($this->max_count / $this->getLimit());
1163
1164 // add a page if a rest remains
1165 if (($this->max_count % $this->getLimit()))
1166 $pages++;
1167
1168 // show next link (if not last page)
1169 if (! ( ($this->getOffset() / $this->getLimit())==($pages-1) ) && ($pages!=1) )
1170 {
1171 $newoffset = $this->getOffset() + $this->getLimit();
1172
1173 $ilCtrl->setParameterByClass("ilcolumngui",
1174 $this->getNavParameter(), "::".$newoffset);
1175
1176 // ajax link
1177 $ilCtrl->setParameterByClass("ilcolumngui",
1178 "block_id", "block_".$this->getBlockType()."_".$this->block_id);
1179 //$this->tpl->setCurrentBlock("pnonclick");
1180 $block_id = "block_".$this->getBlockType()."_".$this->block_id;
1181 $onclick = $ilCtrl->getLinkTargetByClass("ilcolumngui",
1182 "updateBlock", "", true);
1183//echo "-".$onclick."-";
1184 //$this->tpl->parseCurrentBlock();
1185 $ilCtrl->setParameterByClass("ilcolumngui",
1186 "block_id", "");
1187
1188 // normal link
1189 $href = $ilCtrl->getLinkTargetByClass("ilcolumngui", "");
1190 $text = $lng->txt("next");
1191
1192 $this->addFooterLink($text, $href, $onclick, $block_id, true);
1193 }
1194 $ilCtrl->setParameterByClass("ilcolumngui",
1195 $this->getNavParameter(), "");
1196 return true;
1197 }
1198 else
1199 {
1200 return false;
1201 }
1202 }
1203
1209 function fillFooterLinks($a_top = false, $a_numinfo = "")
1210 {
1211 global $ilCtrl, $lng;
1212
1213 $first = true;
1214 $flinks = $this->getFooterLinks();
1215
1216 $prefix = ($a_top) ? "top" : "foot";
1217
1218 $has_link = false;
1219
1220 $omit_separator = false;
1221 foreach($flinks as $flink)
1222 {
1223 if ($flink["top"] != $a_top)
1224 {
1225 continue;
1226 }
1227
1228 if(!$a_top)
1229 {
1230 if($flink["onclick"])
1231 {
1232 $flink["onclick"] = "ilBlockJSHandler('".$flink["block_id"].
1233 "','".$flink["onclick"]."')";
1234 }
1235 $this->dropdown[] = $flink;
1236 continue;
1237 }
1238
1239 $has_link = true;
1240
1241 if (!$first && !$omit_separator)
1242 {
1243 $this->tpl->touchBlock($prefix."_delim");
1244 $this->tpl->touchBlock($prefix."_item");
1245 }
1246
1247 // ajax link
1248 if ($flink["onclick"] != "")
1249 {
1250 $this->tpl->setCurrentBlock($prefix."_onclick");
1251 $this->tpl->setVariable("OC_BLOCK_ID",
1252 $flink["block_id"]);
1253 $this->tpl->setVariable("OC_HREF",
1254 $flink["onclick"]);
1255 $this->tpl->parseCurrentBlock();
1256 }
1257
1258 // normal link
1259 if ($flink["href"] != "")
1260 {
1261 // normal link
1262 $this->tpl->setCurrentBlock($prefix."_link");
1263 $this->tpl->setVariable("FHREF",
1264 $flink["href"]);
1265 $this->tpl->setVariable("FLINK", $flink["text"]);
1266 $this->tpl->parseCurrentBlock();
1267 $this->tpl->touchBlock($prefix."_item");
1268 }
1269 else
1270 {
1271 $this->tpl->setCurrentBlock($prefix."_text");
1272 $this->tpl->setVariable("FTEXT", $flink["text"]);
1273 $this->tpl->parseCurrentBlock();
1274 $this->tpl->touchBlock($prefix."_item");
1275 }
1276
1277 $first = false;
1278 $omit_separator = $flink["omit_separator"];
1279 }
1280
1281 if ($a_numinfo != "" && $has_link)
1282 {
1283 $this->tpl->setVariable("NUMINFO", $a_numinfo);
1284 $first = false;
1285 }
1286
1287 /*
1288 if (!$first)
1289 {
1290 $this->tpl->setVariable("PCOLSPAN", $this->getColSpan());
1291 $this->tpl->setCurrentBlock($prefix."_row");
1292 $this->tpl->parseCurrentBlock();
1293 }
1294 */
1295 }
1296
1300 function fillDetailRow()
1301 {
1302 global $ilCtrl, $lng;
1303
1304 if ($this->enabledetailrow == false)
1305 {
1306 return;
1307 }
1308
1309 $start = ($this->detail_min < 1)
1310 ? $start = 1
1311 : $this->detail_min;
1312
1313 $end = ($this->detail_max < $this->detail_min)
1314 ? $this->detail_min
1315 : $this->detail_max;
1316
1317 $settings = array();
1318 for ($i = $start; $i <= $end; $i++)
1319 {
1320 $settings[] = $i;
1321 }
1322
1323 if ($end > $start)
1324 {
1325 foreach ($settings as $i)
1326 {
1327 if (($i > $start && $i > 1))
1328 {
1329 //$this->tpl->touchBlock("det_delim");
1330 //$this->tpl->touchBlock("det_item");
1331 }
1332// if ($i != $this->getCurrentDetailLevel())
1333// {
1334 $ilCtrl->setParameterByClass("ilcolumngui",
1335 $this->getDetailParameter(), $i);
1336
1337 $onclick = $onclick_id = "";
1338
1339 // ajax link
1340 if ($i > 0)
1341 {
1342 $ilCtrl->setParameterByClass("ilcolumngui",
1343 "block_id", "block_".$this->getBlockType()."_".$this->block_id);
1344 $onclick = $ilCtrl->getLinkTargetByClass("ilcolumngui",
1345 "updateBlock", "", true);
1346 $onclick_id = "block_".$this->getBlockType()."_".$this->block_id;
1347 $ilCtrl->setParameterByClass("ilcolumngui",
1348 "block_id", "");
1349 }
1350
1351 // normal link
1352 //$icon = ilUtil::getImagePath("details".$i.".svg");
1353 $text = $lng->txt("details")." ".$i;
1354 $url = $ilCtrl->getLinkTargetByClass("ilcolumngui", "");
1355
1356 if($onclick)
1357 {
1358 $onclick = "ilBlockJSHandler('".$onclick_id."','".$onclick."')";
1359 }
1360
1361 $checked = ($i == $this->getCurrentDetailLevel());
1362 $this->dropdown[] = array("text" => $text,
1363 "image" => $icon,
1364 "href" => $url,
1365 "onclick" => $onclick,
1366 "checked" => $checked);
1367// }
1368 }
1369
1370 // info + icon in detail row
1371 if ($this->getFooterInfo(true) != "")
1372 {
1373 $this->tpl->setCurrentBlock("det_info");
1374 $this->tpl->setVariable("INFO_TEXT", $this->getFooterInfo(true));
1375 $this->tpl->setVariable("ALT_DET_INFO", $lng->txt("info_short"));
1376 $this->tpl->setVariable("DI_BLOCK_ID", $this->getBlockType()."_".$this->getBlockId());
1377 $this->tpl->setVariable("IMG_DET_INFO", ilUtil::getImagePath("icon_info.svg"));
1378 $this->tpl->parseCurrentBlock();
1379 }
1380
1381 /*
1382 $this->tpl->setCurrentBlock("detail_setting");
1383 $this->tpl->setVariable("TXT_DETAILS", $lng->txt("details"));
1384 $this->tpl->setVariable("DCOLSPAN", $this->getColSpan());
1385 $this->tpl->parseCurrentBlock();
1386 */
1387
1388 $ilCtrl->setParameterByClass("ilcolumngui",
1389 $this->getDetailParameter(), "");
1390 }
1391 }
1392
1397 protected function preloadData(array $data)
1398 {
1399 }
1400}
global $tpl
Definition: ilias.php:8
$_GET["client_id"]
$_SESSION["AccountId"]
const IL_SCREEN_SIDE
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.
getOffset()
Get Offset.
setFooterInfo($a_footerinfo, $a_hide_and_icon=false)
Set Footer Info.
getCurrentDetailLevel()
Get Current Detail Level.
getEnableDetailRow()
Get EnableDetailRow.
getBlockId()
Get Block Id.
getImage()
Get Image.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
setEnableDetailRow($a_enabledetailrow)
Set EnableDetailRow.
setSubtitle($a_subtitle)
Set Subtitle.
static isRepositoryObject()
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.
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.
addBlockCommand($a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
getTitle()
Get Title.
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.
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.
setBigMode($a_bigmode)
Set Big Mode.
getProperty($a_property)
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.
getColSpan()
Get Columns Span.
handleDetailLevel()
Handle read/write current detail level.
getEnableNumInfo()
Get Enable Item Number Info.
setCurrentDetailLevel($a_currentdetaillevel)
Set Current Detail Level.
getLimit()
Get Limit.
getRefId()
Get Ref Id (only used if isRepositoryObject() is true).
fillPreviousNext()
Fill previous/next row.
setGuiObject(&$a_gui_object)
Set GuiObject.
ilBlockGUI()
Constructor.
clearFooterLinks()
Clear footer links.
setProperties($a_properties)
This function is supposed to be used for block type specific properties, that should be inherited thr...
getData()
Get Data.
static getBlockType()
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()
Init YUI Connection module.
$_POST['username']
Definition: cron.php:12
$text
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
$url
Definition: shib_logout.php:72
global $ilUser
Definition: imgupload.php:15