ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
12 abstract 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  {
67  return $this->header_links;
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 
308  function getRepositoryMode()
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  {
339  return $this->footerinfo_icon;
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 
402  function getAdminCommands()
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  {
444  return $this->enabledetailrow;
445  }
446 
447 
453  function setEnableNumInfo($a_enablenuminfo)
454  {
455  $this->enablenuminfo = $a_enablenuminfo;
456  }
457 
463  function getEnableNumInfo()
464  {
465  return $this->enablenuminfo;
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 
535  function getRowTemplateDir()
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)
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);
553  }
554 
560  function getBlockCommands()
561  {
562  return $this->block_commands;
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 
590  function getHeaderCommands()
591  {
592  return $this->header_commands;
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 
622  function clearFooterLinks()
623  {
624  $this->footer_links = array();
625  }
626 
630  static function getScreenMode()
631  {
632  return IL_SCREEN_SIDE;
633  }
634 
638  function handleDetailLevel()
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  }
729 
730  // footer info
731  if ($this->getFooterInfo() != "")
732  {
733  $this->tpl->setCurrentBlock("footer_information");
734  $this->tpl->setVariable("FOOTER_INFO", $this->getFooterInfo());
735  $this->tpl->setVariable("FICOLSPAN", $this->getColSpan());
736  $this->tpl->parseCurrentBlock();
737  }
738 
739  $this->dropdown = array();
740 
741  // commands
742  if (count($this->getBlockCommands()) > 0)
743  {
744  $has_block_command = false;
745 
746  foreach($this->getBlockCommands() as $command)
747  {
748  if(!$command["img"])
749  {
750  $this->dropdown[] = $command;
751  continue;
752  }
753 
754  $has_block_command = true;
755 
756  if ($command["target"] != "")
757  {
758  $this->tpl->setCurrentBlock("bc_target");
759  $this->tpl->setVariable("CMD_TARGET", $command["target"]);
760  $this->tpl->parseCurrentBlock();
761  }
762 
763  if ($command["img"] != "")
764  {
765  $this->tpl->setCurrentBlock("bc_image");
766  $this->tpl->setVariable("SRC_BC", $command["img"]);
767  $this->tpl->setVariable("ALT_BC", $command["text"]);
768  $this->tpl->parseCurrentBlock();
769  $this->tpl->setCurrentBlock("block_command");
770  }
771  else
772  {
773  $this->tpl->setCurrentBlock("block_command");
774  $this->tpl->setVariable("CMD_TEXT", $command["text"]);
775  $this->tpl->setVariable("BC_CLASS", 'class="il_ContainerItemCommand"');
776  }
777 
778  $this->tpl->setVariable("CMD_HREF", $command["href"]);
779  $this->tpl->parseCurrentBlock();
780  }
781 
782  if($has_block_command)
783  {
784  $this->tpl->setCurrentBlock("block_commands");
785  $this->tpl->setVariable("CCOLSPAN", $this->getColSpan());
786  $this->tpl->parseCurrentBlock();
787  }
788  }
789 
790  // fill previous next
791  $this->fillPreviousNext();
792 
793  // fill footer
794  $this->fillFooter();
795 
796  // fill row for setting details
797  $this->fillDetailRow();
798 
799  // header links
800  if(count($this->getHeaderLinks()))
801  {
802  $counter = 0;
803  foreach($this->getHeaderLinks() as $command)
804  {
805  if($counter > 0)
806  {
807  $this->tpl->setCurrentBlock('head_delim');
808  $this->tpl->touchBlock('head_delim');
809  $this->tpl->parseCurrentBlock();
810  }
811  if($command['status'] == true)
812  {
813  $this->tpl->setCurrentBlock('head_link');
814  $this->tpl->setVariable('HHREF', $command['href']);
815  $this->tpl->setVariable('HLINK', $command['text']);
816  $this->tpl->parseCurrentBlock();
817  }
818  else
819  {
820  $this->tpl->setCurrentBlock('head_text');
821  $this->tpl->setVariable('HTEXT', $command['text']);
822  $this->tpl->parseCurrentBlock();
823  }
824 
825  $this->tpl->setCurrentBlock('head_item');
826  $this->tpl->parseCurrentBlock();
827 
828  ++$counter;
829  }
830 
831  $this->tpl->setCurrentBlock('header_links');
832  $this->tpl->parseCurrentBlock();
833  }
834 
835  // for screen readers we first output the title and the commands
836  // (e.g. close icon afterwards), otherwise we first output the
837  // header commands, since we want to have the close icon top right
838  // and not floated after the title
839  if (is_object($ilUser) && $ilUser->getPref("screen_reader_optimization"))
840  {
841  $this->fillHeaderTitleBlock();
842  $this->fillHeaderCommands();
843  }
844  else
845  {
846  $this->fillHeaderCommands();
847  $this->fillHeaderTitleBlock();
848  }
849 
850 
851  // adv selection gui
852  include_once "Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
854  $dropdown->setUseImages(true);
855  $dropdown->setHeaderIcon(ilUtil::getImagePath("icon_sett_s.png"));
856  $dropdown->setId("block_dd_".$this->getBlockType()."_".$this->block_id);
857  foreach($this->dropdown as $item)
858  {
859  if($item["href"] || $item["onclick"])
860  {
861  if ($item["checked"])
862  {
863  $item["image"] = ilUtil::getImagePath("icon_checked_s.png");
864  }
865  $dropdown->addItem($item["text"], "", $item["href"], $item["image"],
866  $item["text"], "", "", false, $item["onclick"]);
867  }
868  }
869  $dropdown = $dropdown->getHTML();
870  $this->tpl->setVariable("ADV_DROPDOWN", $dropdown);
871 
872 
873  $this->tpl->setVariable("COLSPAN", $this->getColSpan());
874  if ($this->getBigMode())
875  {
876  $this->tpl->touchBlock("hclassb");
877  }
878  else
879  {
880  $this->tpl->touchBlock("hclass");
881  }
882 
883  if ($ilCtrl->isAsynch())
884  {
885  // return without div wrapper
886  echo $this->tpl->getAsynch();
887  }
888  else
889  {
890  // return incl. wrapping div with id
891  return '<div id="'."block_".$this->getBlockType()."_".$this->block_id.'">'.
892  $this->tpl->get().'</div>';
893  }
894  }
895 
900  {
901  global $lng, $ilCtrl;
902 
903  // header commands
904  if (count($this->getHeaderCommands()) > 0 ||
905  ($this->detail_max > $this->detail_min && $this->detail_min == 0) ||
906  $this->close_command != "")
907  {
908 
909  foreach($this->getHeaderCommands() as $command)
910  {
911  $this->tpl->setCurrentBlock("header_command");
912  $this->tpl->setVariable("HREF_HCOMM", $command["href"]);
913  $this->tpl->setVariable("TXT_HCOMM", $command["text"]);
914  $this->tpl->parseCurrentBlock();
915  }
916 
917  // close button
918  if (($this->detail_max > $this->detail_min && $this->detail_min == 0 &&
919  !$this->getRepositoryMode())
920  ||
921  $this->close_command != "")
922  {
923  $alt = $lng->txt("hide");
924  if ($this->close_command != "")
925  {
926  $url = $this->close_command;
927  }
928  else
929  {
930  $ilCtrl->setParameterByClass("ilcolumngui",
931  $this->getDetailParameter(), "0");
932  $url = $ilCtrl->getLinkTargetByClass("ilcolumngui", "");
933  $ilCtrl->setParameterByClass("ilcolumngui",
934  $this->getDetailParameter(), "");
935  }
936 
937  $this->dropdown[] = array("text" => $alt,
938  "image" => $img,
939  "href" => $url);
940  }
941 
942  $this->tpl->setCurrentBlock("header_commands");
943  $this->tpl->parseCurrentBlock();
944  }
945 
946  $this->tpl->setCurrentBlock("hitem");
947  $this->tpl->parseCurrentBlock();
948  }
949 
950 
955  {
956  global $lng;
957 
958  // image
959  if ($this->getImage() != "")
960  {
961  $this->tpl->setCurrentBlock("block_img");
962  $this->tpl->setVariable("IMG_BLOCK", $this->getImage());
963  $this->tpl->setVariable("IMID",
964  "block_".$this->getBlockType()."_".$this->block_id);
965  $this->tpl->setVariable("IMG_ALT",
966  str_replace(array("'",'"'), "", strip_tags($lng->txt("icon")." ".$this->getTitle())));
967  $this->tpl->parseCurrentBlock();
968  }
969 
970  // header title
971  $this->tpl->setCurrentBlock("header_title");
972  $this->tpl->setVariable("BTID",
973  "block_".$this->getBlockType()."_".$this->block_id);
974  $this->tpl->setVariable("BLOCK_TITLE",
975  $this->getTitle());
976  $this->tpl->setVariable("TXT_BLOCK",
977  $lng->txt("block"));
978  $this->tpl->parseCurrentBlock();
979 
980  $this->tpl->setCurrentBlock("hitem");
981  $this->tpl->parseCurrentBlock();
982  }
983 
984 
988  function setDataSection($a_content)
989  {
990  $this->tpl->setCurrentBlock("data_section");
991  $this->tpl->setVariable("DATA", $a_content);
992  $this->tpl->parseCurrentBlock();
993  }
994 
999  function fillDataSection()
1000  {
1001  $this->nav_value = (isset($_POST[$this->getNavParameter()]) && $_POST[$this->getNavParameter()] != "")
1002  ? $_POST[$this->getNavParameter()]
1003  : (isset($_GET[$this->getNavParameter()]) ? $_GET[$this->getNavParameter()] : $this->nav_value);
1004  $this->nav_value = ($this->nav_value == "" && isset($_SESSION[$this->getNavParameter()]))
1005  ? $_SESSION[$this->getNavParameter()]
1006  : $this->nav_value;
1007 
1009 
1010  $nav = explode(":", $this->nav_value);
1011  if (isset($nav[2]))
1012  {
1013  $this->setOffset($nav[2]);
1014  }
1015  else
1016  {
1017  $this->setOffset(0);
1018  }
1019 
1020  // data
1021  $this->tpl->addBlockFile("BLOCK_ROW", "block_row", $this->getRowTemplateName(),
1022  $this->getRowTemplateDir());
1023 
1024  $data = $this->getData();
1025  $this->max_count = count($data);
1026  $this->correctOffset();
1027  $data = array_slice($data, $this->getOffset(), $this->getLimit());
1028 
1029  $this->preloadData($data);
1030 
1031  foreach($data as $record)
1032  {
1033  $this->tpl->setCurrentBlock("block_row");
1034  $this->fillRowColor();
1035  $this->fillRow($record);
1036  $this->tpl->setCurrentBlock("block_row");
1037  $this->tpl->parseCurrentBlock();
1038  }
1039  }
1040 
1041  function fillRow($a_set)
1042  {
1043  foreach ($a_set as $key => $value)
1044  {
1045  $this->tpl->setVariable("VAL_".strtoupper($key), $value);
1046  }
1047  }
1048 
1049  function fillFooter()
1050  {
1051  }
1052 
1053  final protected function fillRowColor($a_placeholder = "CSS_ROW")
1054  {
1055  $this->css_row = ($this->css_row != "ilBlockRow1")
1056  ? "ilBlockRow1"
1057  : "ilBlockRow2";
1058  $this->tpl->setVariable($a_placeholder, $this->css_row);
1059  }
1060 
1064  function fillPreviousNext()
1065  {
1066  global $lng, $ilCtrl;
1067 
1068  $pn = false;
1069 
1070  // table pn numinfo
1071  $numinfo = "";
1072  if ($this->getEnableNumInfo() && $this->max_count > 0)
1073  {
1074  $start = $this->getOffset() + 1; // compute num info
1075  $end = $this->getOffset() + $this->getLimit();
1076 
1077  if ($end > $this->max_count or $this->getLimit() == 0)
1078  {
1079  $end = $this->max_count;
1080  }
1081 
1082  $numinfo = "(".$start."-".$end." ".strtolower($lng->txt("of"))." ".$this->max_count.")";
1083  }
1084 
1085  $this->setPreviousNextLinks();
1086  $this->fillFooterLinks(true, $numinfo);
1087 
1088  }
1089 
1098  {
1099  global $ilCtrl, $lng;
1100 
1101  // if more entries then entries per page -> show link bar
1102  if ($this->max_count > $this->getLimit() && ($this->getLimit() != 0))
1103  {
1104  // previous link
1105  if ($this->getOffset() >= 1)
1106  {
1107  $prevoffset = $this->getOffset() - $this->getLimit();
1108 
1109  $ilCtrl->setParameterByClass("ilcolumngui",
1110  $this->getNavParameter(), "::".$prevoffset);
1111 
1112  // ajax link
1113  $ilCtrl->setParameterByClass("ilcolumngui",
1114  "block_id", "block_".$this->getBlockType()."_".$this->block_id);
1115  $block_id = "block_".$this->getBlockType()."_".$this->block_id;
1116  $onclick = $ilCtrl->getLinkTargetByClass("ilcolumngui",
1117  "updateBlock", "", true);
1118  $ilCtrl->setParameterByClass("ilcolumngui",
1119  "block_id", "");
1120 
1121  // normal link
1122  $href = $ilCtrl->getLinkTargetByClass("ilcolumngui", "");
1123  $text = $lng->txt("previous");
1124 
1125  $this->addFooterLink($text, $href, $onclick, $block_id, true);
1126  }
1127 
1128  // calculate number of pages
1129  $pages = intval($this->max_count / $this->getLimit());
1130 
1131  // add a page if a rest remains
1132  if (($this->max_count % $this->getLimit()))
1133  $pages++;
1134 
1135  // show next link (if not last page)
1136  if (! ( ($this->getOffset() / $this->getLimit())==($pages-1) ) && ($pages!=1) )
1137  {
1138  $newoffset = $this->getOffset() + $this->getLimit();
1139 
1140  $ilCtrl->setParameterByClass("ilcolumngui",
1141  $this->getNavParameter(), "::".$newoffset);
1142 
1143  // ajax link
1144  $ilCtrl->setParameterByClass("ilcolumngui",
1145  "block_id", "block_".$this->getBlockType()."_".$this->block_id);
1146  //$this->tpl->setCurrentBlock("pnonclick");
1147  $block_id = "block_".$this->getBlockType()."_".$this->block_id;
1148  $onclick = $ilCtrl->getLinkTargetByClass("ilcolumngui",
1149  "updateBlock", "", true);
1150 //echo "-".$onclick."-";
1151  //$this->tpl->parseCurrentBlock();
1152  $ilCtrl->setParameterByClass("ilcolumngui",
1153  "block_id", "");
1154 
1155  // normal link
1156  $href = $ilCtrl->getLinkTargetByClass("ilcolumngui", "");
1157  $text = $lng->txt("next");
1158 
1159  $this->addFooterLink($text, $href, $onclick, $block_id, true);
1160  }
1161  $ilCtrl->setParameterByClass("ilcolumngui",
1162  $this->getNavParameter(), "");
1163  return true;
1164  }
1165  else
1166  {
1167  return false;
1168  }
1169  }
1170 
1176  function fillFooterLinks($a_top = false, $a_numinfo = "")
1177  {
1178  global $ilCtrl, $lng;
1179 
1180  $first = true;
1181  $flinks = $this->getFooterLinks();
1182 
1183  $prefix = ($a_top) ? "top" : "foot";
1184 
1185  $has_link = false;
1186 
1187  $omit_separator = false;
1188  foreach($flinks as $flink)
1189  {
1190  if ($flink["top"] != $a_top)
1191  {
1192  continue;
1193  }
1194 
1195  if(!$a_top)
1196  {
1197  if($flink["onclick"])
1198  {
1199  $flink["onclick"] = "ilBlockJSHandler('".$flink["block_id"].
1200  "','".$flink["onclick"]."')";
1201  }
1202  $this->dropdown[] = $flink;
1203  continue;
1204  }
1205 
1206  $has_link = true;
1207 
1208  if (!$first && !$omit_separator)
1209  {
1210  $this->tpl->touchBlock($prefix."_delim");
1211  $this->tpl->touchBlock($prefix."_item");
1212  }
1213 
1214  // ajax link
1215  if ($flink["onclick"] != "")
1216  {
1217  $this->tpl->setCurrentBlock($prefix."_onclick");
1218  $this->tpl->setVariable("OC_BLOCK_ID",
1219  $flink["block_id"]);
1220  $this->tpl->setVariable("OC_HREF",
1221  $flink["onclick"]);
1222  $this->tpl->parseCurrentBlock();
1223  }
1224 
1225  // normal link
1226  if ($flink["href"] != "")
1227  {
1228  // normal link
1229  $this->tpl->setCurrentBlock($prefix."_link");
1230  $this->tpl->setVariable("FHREF",
1231  $flink["href"]);
1232  $this->tpl->setVariable("FLINK", $flink["text"]);
1233  $this->tpl->parseCurrentBlock();
1234  $this->tpl->touchBlock($prefix."_item");
1235  }
1236  else
1237  {
1238  $this->tpl->setCurrentBlock($prefix."_text");
1239  $this->tpl->setVariable("FTEXT", $flink["text"]);
1240  $this->tpl->parseCurrentBlock();
1241  $this->tpl->touchBlock($prefix."_item");
1242  }
1243 
1244  $first = false;
1245  $omit_separator = $flink["omit_separator"];
1246  }
1247 
1248  if ($a_numinfo != "" && $has_link)
1249  {
1250  $this->tpl->setVariable("NUMINFO", $a_numinfo);
1251  $first = false;
1252  }
1253 
1254  /*
1255  if (!$first)
1256  {
1257  $this->tpl->setVariable("PCOLSPAN", $this->getColSpan());
1258  $this->tpl->setCurrentBlock($prefix."_row");
1259  $this->tpl->parseCurrentBlock();
1260  }
1261  */
1262  }
1263 
1267  function fillDetailRow()
1268  {
1269  global $ilCtrl, $lng;
1270 
1271  if ($this->enabledetailrow == false)
1272  {
1273  return;
1274  }
1275 
1276  $start = ($this->detail_min < 1)
1277  ? $start = 1
1278  : $this->detail_min;
1279 
1280  $end = ($this->detail_max < $this->detail_min)
1281  ? $this->detail_min
1282  : $this->detail_max;
1283 
1284  $settings = array();
1285  for ($i = $start; $i <= $end; $i++)
1286  {
1287  $settings[] = $i;
1288  }
1289 
1290  if ($end > $start)
1291  {
1292  foreach ($settings as $i)
1293  {
1294  if (($i > $start && $i > 1))
1295  {
1296  //$this->tpl->touchBlock("det_delim");
1297  //$this->tpl->touchBlock("det_item");
1298  }
1299 // if ($i != $this->getCurrentDetailLevel())
1300 // {
1301  $ilCtrl->setParameterByClass("ilcolumngui",
1302  $this->getDetailParameter(), $i);
1303 
1304  $onclick = $onclick_id = "";
1305 
1306  // ajax link
1307  if ($i > 0)
1308  {
1309  $ilCtrl->setParameterByClass("ilcolumngui",
1310  "block_id", "block_".$this->getBlockType()."_".$this->block_id);
1311  $onclick = $ilCtrl->getLinkTargetByClass("ilcolumngui",
1312  "updateBlock", "", true);
1313  $onclick_id = "block_".$this->getBlockType()."_".$this->block_id;
1314  $ilCtrl->setParameterByClass("ilcolumngui",
1315  "block_id", "");
1316  }
1317 
1318  // normal link
1319  //$icon = ilUtil::getImagePath("details".$i.".png");
1320  $text = $lng->txt("details")." ".$i;
1321  $url = $ilCtrl->getLinkTargetByClass("ilcolumngui", "");
1322 
1323  if($onclick)
1324  {
1325  $onclick = "ilBlockJSHandler('".$onclick_id."','".$onclick."')";
1326  }
1327 
1328  $checked = ($i == $this->getCurrentDetailLevel());
1329  $this->dropdown[] = array("text" => $text,
1330  "image" => $icon,
1331  "href" => $url,
1332  "onclick" => $onclick,
1333  "checked" => $checked);
1334 // }
1335  }
1336 
1337  // info + icon in detail row
1338  if ($this->getFooterInfo(true) != "")
1339  {
1340  $this->tpl->setCurrentBlock("det_info");
1341  $this->tpl->setVariable("INFO_TEXT", $this->getFooterInfo(true));
1342  $this->tpl->setVariable("ALT_DET_INFO", $lng->txt("info_short"));
1343  $this->tpl->setVariable("DI_BLOCK_ID", $this->getBlockType()."_".$this->getBlockId());
1344  $this->tpl->setVariable("IMG_DET_INFO", ilUtil::getImagePath("icon_info_s.png"));
1345  $this->tpl->parseCurrentBlock();
1346  }
1347 
1348  /*
1349  $this->tpl->setCurrentBlock("detail_setting");
1350  $this->tpl->setVariable("TXT_DETAILS", $lng->txt("details"));
1351  $this->tpl->setVariable("DCOLSPAN", $this->getColSpan());
1352  $this->tpl->parseCurrentBlock();
1353  */
1354 
1355  $ilCtrl->setParameterByClass("ilcolumngui",
1356  $this->getDetailParameter(), "");
1357  }
1358  }
1359 
1364  protected function preloadData(array $data)
1365  {
1366  }
1367 }