ILIAS  Release_4_1_x_branch Revision 61804
 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 
46  function ilBlockGUI()
47  {
48  global $ilUser, $tpl, $ilCtrl;
49 
50  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
52  $tpl->addJavaScript("./Services/Block/js/ilblockcallback.js");
53 
54  $this->setLimit($ilUser->getPref("hits_per_page"));
55  }
56 
57  public function addHeaderLink($a_href, $a_text, $status = true)
58  {
59  $this->header_links[] =
60  array('href' => $a_href, 'text' => $a_text, 'status' => (bool)$status);
61  }
62 
63  public function getHeaderLinks()
64  {
65  return $this->header_links;
66  }
67 
73  function setData($a_data)
74  {
75  $this->data = $a_data;
76  }
77 
83  function getData()
84  {
85  return $this->data;
86  }
87 
93  function setBigMode($a_bigmode)
94  {
95  $this->bigmode = $a_bigmode;
96  }
97 
103  function getBigMode()
104  {
105  return $this->bigmode;
106  }
107 
113  function setBlockId($a_block_id = 0)
114  {
115  $this->block_id = $a_block_id;
116  }
117 
123  function getBlockId()
124  {
125  return $this->block_id;
126  }
127 
134  function setAvailableDetailLevels($a_max, $a_min = 0)
135  {
136  $this->detail_min = $a_min;
137  $this->detail_max = $a_max;
138  $this->handleDetailLevel();
139  }
140 
146  function setCurrentDetailLevel($a_currentdetaillevel)
147  {
148  $this->currentdetaillevel = $a_currentdetaillevel;
149  }
150 
158  public function setGuiObject(&$a_gui_object)
159  {
160  $this->gui_object = $a_gui_object;
161  }
162 
168  public function getGuiObject()
169  {
170  return $this->gui_object;
171  }
172 
179  {
180  return $this->currentdetaillevel;
181  }
182 
188  function setTitle($a_title)
189  {
190  $this->title = $a_title;
191  }
192 
198  function getTitle()
199  {
200  return $this->title;
201  }
202 
208  function setImage($a_image)
209  {
210  $this->image = $a_image;
211  }
212 
218  function getImage()
219  {
220  return $this->image;
221  }
222 
228  function setOffset($a_offset)
229  {
230  $this->offset = $a_offset;
231  }
232 
238  function getOffset()
239  {
240  return $this->offset;
241  }
242 
243  function correctOffset()
244  {
245  if (!($this->offset < $this->max_count))
246  {
247  $this->setOffset(0);
248  }
249  }
250 
256  function setLimit($a_limit)
257  {
258  $this->limit = $a_limit;
259  }
260 
266  function getLimit()
267  {
268  return $this->limit;
269  }
270 
276  function setEnableEdit($a_enableedit)
277  {
278  $this->enableedit = $a_enableedit;
279  }
280 
286  function getEnableEdit()
287  {
288  return $this->enableedit;
289  }
290 
296  function setRepositoryMode($a_repositorymode)
297  {
298  $this->repositorymode = $a_repositorymode;
299  }
300 
306  function getRepositoryMode()
307  {
308  return $this->repositorymode;
309  }
310 
316  function setFooterInfo($a_footerinfo, $a_hide_and_icon = false)
317  {
318  if ($a_hide_and_icon)
319  {
320  $this->footerinfo_icon = $a_footerinfo;
321  }
322  else
323  {
324  $this->footerinfo = $a_footerinfo;
325  }
326  }
327 
333  function getFooterInfo($a_hide_and_icon = false)
334  {
335  if ($a_hide_and_icon)
336  {
337  return $this->footerinfo_icon;
338  }
339  else
340  {
341  return $this->footerinfo;
342  }
343  }
344 
350  function setSubtitle($a_subtitle)
351  {
352  $this->subtitle = $a_subtitle;
353  }
354 
360  function getSubtitle()
361  {
362  return $this->subtitle;
363  }
364 
370  function setRefId($a_refid)
371  {
372  $this->refid = $a_refid;
373  }
374 
380  function getRefId()
381  {
382  return $this->refid;
383  }
384 
390  function setAdminCommands($a_admincommands)
391  {
392  $this->admincommands = $a_admincommands;
393  }
394 
400  function getAdminCommands()
401  {
402  return $this->admincommands;
403  }
404 
410  function setColSpan($a_colspan)
411  {
412  $this->colspan = $a_colspan;
413  }
414 
420  function getColSpan()
421  {
422  return $this->colspan;
423  }
424 
430  function setEnableDetailRow($a_enabledetailrow)
431  {
432  $this->enabledetailrow = $a_enabledetailrow;
433  }
434 
441  {
442  return $this->enabledetailrow;
443  }
444 
445 
451  function setEnableNumInfo($a_enablenuminfo)
452  {
453  $this->enablenuminfo = $a_enablenuminfo;
454  }
455 
461  function getEnableNumInfo()
462  {
463  return $this->enablenuminfo;
464  }
465 
472  function setProperties($a_properties)
473  {
474  $this->property = $a_properties;
475  }
476 
477  function getProperty($a_property)
478  {
479  return $this->property[$a_property];
480  }
481 
482  function setProperty($a_property, $a_value)
483  {
484  $this->property[$a_property] = $a_value;
485  }
486 
492  function setRowTemplate($a_rowtemplatename, $a_rowtemplatedir = "")
493  {
494  $this->rowtemplatename = $a_rowtemplatename;
495  $this->rowtemplatedir = $a_rowtemplatedir;
496  }
497 
498  final public function getNavParameter()
499  {
500  return $this->getBlockType()."_".$this->getBlockId()."_blnav";
501  }
502 
503  final public function getDetailParameter()
504  {
505  return $this->getBlockType()."_".$this->getBlockId()."_bldet";
506  }
507 
508  final public function getConfigParameter()
509  {
510  return $this->getBlockType()."_".$this->getBlockId()."_blconf";
511  }
512 
513  final public function getMoveParameter()
514  {
515  return $this->getBlockType()."_".$this->getBlockId()."_blmove";
516  }
517 
524  {
525  return $this->rowtemplatename;
526  }
527 
533  function getRowTemplateDir()
534  {
535  return $this->rowtemplatedir;
536  }
537 
544  function addBlockCommand($a_href, $a_text, $a_target = "", $a_img = "", $a_right_aligned = false)
545  {
546  return $this->block_commands[] =
547  array("href" => $a_href,
548  "text" => $a_text, "target" => $a_target, "img" => $a_img,
549  "right" => $a_right_aligned);
550  }
551 
557  function getBlockCommands()
558  {
559  return $this->block_commands;
560  }
561 
568  function addHeaderCommand($a_href, $a_text, $a_as_close = false)
569  {
570  if ($a_as_close)
571  {
572  $this->close_command = $a_href;
573  }
574  else
575  {
576  $this->header_commands[] =
577  array("href" => $a_href,
578  "text" => $a_text);
579  }
580  }
581 
587  function getHeaderCommands()
588  {
589  return $this->header_commands;
590  }
591 
595  function addFooterLink($a_text, $a_href = "", $a_onclick = "", $a_block_id = "",
596  $a_top = false, $a_omit_separator = false)
597  {
598  $this->footer_links[] = array(
599  "text" => $a_text,
600  "href" => $a_href,
601  "onclick" => $a_onclick,
602  "block_id" => $a_block_id,
603  "top" => $a_top,
604  "omit_separator" => $a_omit_separator);
605  }
606 
610  function getFooterLinks()
611  {
612  return $this->footer_links;
613  }
614 
618  function clearFooterLinks()
619  {
620  $this->footer_links = array();
621  }
622 
626  static function getScreenMode()
627  {
628  return IL_SCREEN_SIDE;
629  }
630 
634  function handleDetailLevel()
635  {
636  global $ilUser;
637 
638  // set/get detail level
639  if ($this->detail_max > $this->detail_min)
640  {
641  include_once("Services/Block/classes/class.ilBlockSetting.php");
642  if (isset($_GET[$this->getDetailParameter()]))
643  {
645  $ilUser->getId(), $this->block_id);
647  }
648  else
649  {
651  $ilUser->getId(), $this->block_id));
652  }
653  }
654  }
655 
659 /*
660  function handleConfigStatus()
661  {
662  $this->config_mode = false;
663 
664  if ($_GET[$this->getConfigParameter()] == "toggle")
665  {
666  if ($_SESSION[$this->getConfigParameter()] == "on")
667  {
668  $_SESSION[$this->getConfigParameter()] = "off";
669  }
670  else
671  {
672  $_SESSION[$this->getConfigParameter()] = "on";
673  }
674  }
675  if ($_SESSION[$this->getConfigParameter()] == "on")
676  {
677  $this->config_mode = true;
678  }
679  }
680 */
681 
687  function setConfigMode($a_configmode)
688  {
689  $this->config_mode = $a_configmode;
690  }
691 
697  function getConfigMode()
698  {
699  return $this->config_mode;
700  }
701 
705  function getHTML()
706  {
707  global $ilCtrl, $lng, $ilAccess, $ilUser;
708 
709  if ($this->isRepositoryObject())
710  {
711  if (!$ilAccess->checkAccess("visible", "", $this->getRefId()))
712  {
713  return "";
714  }
715  }
716 
717  $this->tpl = new ilTemplate("tpl.block.html", true, true, "Services/Block");
718 
719 // $this->handleConfigStatus();
720 
721  $this->fillDataSection();
722 
723  if ($this->getRepositoryMode() && $this->isRepositoryObject()
724  && $this->getAdminCommands())
725  {
726  $this->tpl->setCurrentBlock("block_check");
727  $this->tpl->setVariable("BL_REF_ID", $this->getRefId());
728  $this->tpl->parseCurrentBlock();
729 
730  if ($ilAccess->checkAccess("delete", "", $this->getRefId()))
731  {
732  $this->addBlockCommand(
733  "repository.php?ref_id=".$_GET["ref_id"]."&cmd=delete".
734  "&item_ref_id=".$this->getRefId(),
735  $lng->txt("delete"));
736  }
737  }
738 
739  // footer info
740  if ($this->getFooterInfo() != "")
741  {
742  $this->tpl->setCurrentBlock("footer_information");
743  $this->tpl->setVariable("FOOTER_INFO", $this->getFooterInfo());
744  $this->tpl->setVariable("FICOLSPAN", $this->getColSpan());
745  $this->tpl->parseCurrentBlock();
746  }
747 
748  // commands
749  if (count($this->getBlockCommands()) > 0)
750  {
751 
752  foreach($this->getBlockCommands() as $command)
753  {
754  if ($command["target"] != "")
755  {
756  $this->tpl->setCurrentBlock("bc_target");
757  $this->tpl->setVariable("CMD_TARGET", $command["target"]);
758  $this->tpl->parseCurrentBlock();
759  }
760 
761  if ($command["img"] != "")
762  {
763  $this->tpl->setCurrentBlock("bc_image");
764  $this->tpl->setVariable("SRC_BC", $command["img"]);
765  $this->tpl->setVariable("ALT_BC", $command["text"]);
766  $this->tpl->parseCurrentBlock();
767  $this->tpl->setCurrentBlock("block_command");
768  }
769  else
770  {
771  $this->tpl->setCurrentBlock("block_command");
772  $this->tpl->setVariable("CMD_TEXT", $command["text"]);
773  $this->tpl->setVariable("BC_CLASS", 'class="il_ContainerItemCommand"');
774  }
775 
776  $this->tpl->setVariable("CMD_HREF", $command["href"]);
777  $this->tpl->parseCurrentBlock();
778  }
779  $this->tpl->setCurrentBlock("block_commands");
780  $this->tpl->setVariable("CCOLSPAN", $this->getColSpan());
781  $this->tpl->parseCurrentBlock();
782  }
783 
784  // fill previous next
785  $this->fillPreviousNext();
786 
787  // fill footer
788  $this->fillFooter();
789 
790  // fill row for setting details
791  $this->fillDetailRow();
792 
793  // fill row for setting details
794  if ($this->allow_moving)
795  {
796  $this->fillMoveRow();
797  }
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  $this->tpl->setVariable("COLSPAN", $this->getColSpan());
851  if ($this->getBigMode())
852  {
853  $this->tpl->touchBlock("hclassb");
854  }
855  else
856  {
857  $this->tpl->touchBlock("hclass");
858  }
859 
860  if ($ilCtrl->isAsynch())
861  {
862  // return without div wrapper
863  echo $this->tpl->getAsynch();
864  }
865  else
866  {
867  // return incl. wrapping div with id
868  return '<div id="'."block_".$this->getBlockType()."_".$this->block_id.'">'.
869  $this->tpl->get().'</div>';
870  }
871  }
872 
877  {
878  global $lng, $ilCtrl;
879 
880  // header commands
881  if (count($this->getHeaderCommands()) > 0 ||
882  ($this->detail_max > $this->detail_min && $this->detail_min == 0) ||
883  $this->close_command != "" || $this->allow_moving)
884  {
885 
886  foreach($this->getHeaderCommands() as $command)
887  {
888  $this->tpl->setCurrentBlock("header_command");
889  $this->tpl->setVariable("HREF_HCOMM", $command["href"]);
890  $this->tpl->setVariable("TXT_HCOMM", $command["text"]);
891  $this->tpl->parseCurrentBlock();
892  }
893 
894  // close button
895  if (($this->detail_max > $this->detail_min && $this->detail_min == 0 &&
896  !$this->getRepositoryMode())
897  ||
898  $this->close_command != "")
899  {
900  $this->tpl->setCurrentBlock("header_close");
901  $this->tpl->setVariable("ALT_CLOSE",
902  strip_tags(str_replace(array("'",'"'), "", $this->getTitle())).
903  " (".$lng->txt("block")."): ".$lng->txt("close")
904  );
905  if ($this->getBigMode())
906  {
907  $this->tpl->setVariable("IMG_CLOSE", ilUtil::getImagePath("icon_close2.gif"));
908  }
909  else
910  {
911  $this->tpl->setVariable("IMG_CLOSE", ilUtil::getImagePath("icon_close2_s.gif"));
912  }
913  if ($this->close_command != "")
914  {
915  $this->tpl->setVariable("HREF_CLOSE",
916  $this->close_command);
917  }
918  else
919  {
920  $ilCtrl->setParameterByClass("ilcolumngui",
921  $this->getDetailParameter(), "0");
922  $this->tpl->setVariable("HREF_CLOSE",
923  $ilCtrl->getLinkTargetByClass("ilcolumngui",
924  ""));
925  $ilCtrl->setParameterByClass("ilcolumngui",
926  $this->getDetailParameter(), "");
927  }
928  $this->tpl->parseCurrentBlock();
929  }
930 
931  $this->tpl->setCurrentBlock("header_commands");
932  $this->tpl->parseCurrentBlock();
933  }
934 
935  $this->tpl->setCurrentBlock("hitem");
936  $this->tpl->parseCurrentBlock();
937  }
938 
939 
944  {
945  global $lng;
946 
947  // image
948  if ($this->getImage() != "")
949  {
950  $this->tpl->setCurrentBlock("block_img");
951  $this->tpl->setVariable("IMG_BLOCK", $this->getImage());
952  $this->tpl->setVariable("IMID",
953  "block_".$this->getBlockType()."_".$this->block_id);
954  $this->tpl->setVariable("IMG_ALT",
955  str_replace(array("'",'"'), "", strip_tags($lng->txt("icon")." ".$this->getTitle())));
956  $this->tpl->parseCurrentBlock();
957  }
958 
959  // header title
960  $this->tpl->setCurrentBlock("header_title");
961  $this->tpl->setVariable("BTID",
962  "block_".$this->getBlockType()."_".$this->block_id);
963  $this->tpl->setVariable("BLOCK_TITLE",
964  $this->getTitle());
965  $this->tpl->setVariable("TXT_BLOCK",
966  $lng->txt("block"));
967  $this->tpl->parseCurrentBlock();
968 
969  $this->tpl->setCurrentBlock("hitem");
970  $this->tpl->parseCurrentBlock();
971  }
972 
973 
977  function setDataSection($a_content)
978  {
979  $this->tpl->setCurrentBlock("data_section");
980  $this->tpl->setVariable("DATA", $a_content);
981  $this->tpl->parseCurrentBlock();
982  }
983 
988  function fillDataSection()
989  {
990  $this->nav_value = (isset($_POST[$this->getNavParameter()]) && $_POST[$this->getNavParameter()] != "")
991  ? $_POST[$this->getNavParameter()]
992  : (isset($_GET[$this->getNavParameter()]) ? $_GET[$this->getNavParameter()] : $this->nav_value);
993  $this->nav_value = ($this->nav_value == "" && isset($_SESSION[$this->getNavParameter()]))
994  ? $_SESSION[$this->getNavParameter()]
996 
998 
999  $nav = explode(":", $this->nav_value);
1000  if (isset($nav[2]))
1001  {
1002  $this->setOffset($nav[2]);
1003  }
1004  else
1005  {
1006  $this->setOffset(0);
1007  }
1008 
1009  // data
1010  $this->tpl->addBlockFile("BLOCK_ROW", "block_row", $this->getRowTemplateName(),
1011  $this->getRowTemplateDir());
1012 
1013  $data = $this->getData();
1014  $this->max_count = count($data);
1015  $this->correctOffset();
1016  $data = array_slice($data, $this->getOffset(), $this->getLimit());
1017 
1018  foreach($data as $record)
1019  {
1020  $this->tpl->setCurrentBlock("block_row");
1021  $this->fillRowColor();
1022  $this->fillRow($record);
1023  $this->tpl->setCurrentBlock("block_row");
1024  $this->tpl->parseCurrentBlock();
1025  }
1026  }
1027 
1028  function fillRow($a_set)
1029  {
1030  foreach ($a_set as $key => $value)
1031  {
1032  $this->tpl->setVariable("VAL_".strtoupper($key), $value);
1033  }
1034  }
1035 
1036  function fillFooter()
1037  {
1038  }
1039 
1040  final protected function fillRowColor($a_placeholder = "CSS_ROW")
1041  {
1042  $this->css_row = ($this->css_row != "ilBlockRow1")
1043  ? "ilBlockRow1"
1044  : "ilBlockRow2";
1045  $this->tpl->setVariable($a_placeholder, $this->css_row);
1046  }
1047 
1051  function fillPreviousNext()
1052  {
1053  global $lng, $ilCtrl;
1054 
1055  $pn = false;
1056 
1057  // table pn numinfo
1058  $numinfo = "";
1059  if ($this->getEnableNumInfo() && $this->max_count > 0)
1060  {
1061  $start = $this->getOffset() + 1; // compute num info
1062  $end = $this->getOffset() + $this->getLimit();
1063 
1064  if ($end > $this->max_count or $this->getLimit() == 0)
1065  {
1066  $end = $this->max_count;
1067  }
1068 
1069  $numinfo = "(".$start."-".$end." ".strtolower($lng->txt("of"))." ".$this->max_count.")";
1070  }
1071 
1072  $this->setPreviousNextLinks();
1073  $this->fillFooterLinks(true, $numinfo);
1074 
1075  }
1076 
1085  {
1086  global $ilCtrl, $lng;
1087 
1088  // if more entries then entries per page -> show link bar
1089  if ($this->max_count > $this->getLimit() && ($this->getLimit() != 0))
1090  {
1091  // previous link
1092  if ($this->getOffset() >= 1)
1093  {
1094  $prevoffset = $this->getOffset() - $this->getLimit();
1095 
1096  $ilCtrl->setParameterByClass("ilcolumngui",
1097  $this->getNavParameter(), "::".$prevoffset);
1098 
1099  // ajax link
1100  $ilCtrl->setParameterByClass("ilcolumngui",
1101  "block_id", "block_".$this->getBlockType()."_".$this->block_id);
1102  $block_id = "block_".$this->getBlockType()."_".$this->block_id;
1103  $onclick = $ilCtrl->getLinkTargetByClass("ilcolumngui",
1104  "updateBlock", "", true);
1105  $ilCtrl->setParameterByClass("ilcolumngui",
1106  "block_id", "");
1107 
1108  // normal link
1109  $href = $ilCtrl->getLinkTargetByClass("ilcolumngui", "");
1110  $text = $lng->txt("previous");
1111 
1112  $this->addFooterLink($text, $href, $onclick, $block_id, true);
1113  }
1114 
1115  // calculate number of pages
1116  $pages = intval($this->max_count / $this->getLimit());
1117 
1118  // add a page if a rest remains
1119  if (($this->max_count % $this->getLimit()))
1120  $pages++;
1121 
1122  // show next link (if not last page)
1123  if (! ( ($this->getOffset() / $this->getLimit())==($pages-1) ) && ($pages!=1) )
1124  {
1125  $newoffset = $this->getOffset() + $this->getLimit();
1126 
1127  $ilCtrl->setParameterByClass("ilcolumngui",
1128  $this->getNavParameter(), "::".$newoffset);
1129 
1130  // ajax link
1131  $ilCtrl->setParameterByClass("ilcolumngui",
1132  "block_id", "block_".$this->getBlockType()."_".$this->block_id);
1133  //$this->tpl->setCurrentBlock("pnonclick");
1134  $block_id = "block_".$this->getBlockType()."_".$this->block_id;
1135  $onclick = $ilCtrl->getLinkTargetByClass("ilcolumngui",
1136  "updateBlock", "", true);
1137 //echo "-".$onclick."-";
1138  //$this->tpl->parseCurrentBlock();
1139  $ilCtrl->setParameterByClass("ilcolumngui",
1140  "block_id", "");
1141 
1142  // normal link
1143  $href = $ilCtrl->getLinkTargetByClass("ilcolumngui", "");
1144  $text = $lng->txt("next");
1145 
1146  $this->addFooterLink($text, $href, $onclick, $block_id, true);
1147  }
1148  $ilCtrl->setParameterByClass("ilcolumngui",
1149  $this->getNavParameter(), "");
1150  return true;
1151  }
1152  else
1153  {
1154  return false;
1155  }
1156  }
1157 
1163  function fillFooterLinks($a_top = false, $a_numinfo = "")
1164  {
1165  global $ilCtrl, $lng;
1166 
1167  $first = true;
1168  $flinks = $this->getFooterLinks();
1169 
1170  $prefix = ($a_top) ? "top" : "foot";
1171 
1172  $omit_separator = false;
1173  foreach($flinks as $flink)
1174  {
1175  if ($flink["top"] != $a_top)
1176  {
1177  continue;
1178  }
1179 
1180  if (!$first && !$omit_separator)
1181  {
1182  $this->tpl->touchBlock($prefix."_delim");
1183  $this->tpl->touchBlock($prefix."_item");
1184  }
1185 
1186  // ajax link
1187  if ($flink["onclick"] != "")
1188  {
1189  $this->tpl->setCurrentBlock($prefix."_onclick");
1190  $this->tpl->setVariable("OC_BLOCK_ID",
1191  $flink["block_id"]);
1192  $this->tpl->setVariable("OC_HREF",
1193  $flink["onclick"]);
1194  $this->tpl->parseCurrentBlock();
1195  }
1196 
1197  // normal link
1198  if ($flink["href"] != "")
1199  {
1200  // normal link
1201  $this->tpl->setCurrentBlock($prefix."_link");
1202  $this->tpl->setVariable("FHREF",
1203  $flink["href"]);
1204  $this->tpl->setVariable("FLINK", $flink["text"]);
1205  $this->tpl->parseCurrentBlock();
1206  $this->tpl->touchBlock($prefix."_item");
1207  }
1208  else
1209  {
1210  $this->tpl->setCurrentBlock($prefix."_text");
1211  $this->tpl->setVariable("FTEXT", $flink["text"]);
1212  $this->tpl->parseCurrentBlock();
1213  $this->tpl->touchBlock($prefix."_item");
1214  }
1215  $first = false;
1216  $omit_separator = $flink["omit_separator"];
1217  }
1218 
1219  if ($a_numinfo != "")
1220  {
1221  $this->tpl->setVariable("NUMINFO", $a_numinfo);
1222  $first = false;
1223  }
1224 
1225  if (!$first)
1226  {
1227  $this->tpl->setVariable("PCOLSPAN", $this->getColSpan());
1228  $this->tpl->setCurrentBlock($prefix."_row");
1229  $this->tpl->parseCurrentBlock();
1230  }
1231  }
1232 
1236  function fillDetailRow()
1237  {
1238  global $ilCtrl, $lng;
1239 
1240  if ($this->enabledetailrow == false)
1241  {
1242  return;
1243  }
1244 
1245  $start = ($this->detail_min < 1)
1246  ? $start = 1
1247  : $this->detail_min;
1248 
1249  $end = ($this->detail_max < $this->detail_min)
1250  ? $this->detail_min
1251  : $this->detail_max;
1252 
1253  $settings = array();
1254  for ($i = $start; $i <= $end; $i++)
1255  {
1256  $settings[] = $i;
1257  }
1258 
1259  if ($end > $start)
1260  {
1261  foreach ($settings as $i)
1262  {
1263  if (($i > $start && $i > 1))
1264  {
1265  //$this->tpl->touchBlock("det_delim");
1266  //$this->tpl->touchBlock("det_item");
1267  }
1268  if ($i != $this->getCurrentDetailLevel())
1269  {
1270  $ilCtrl->setParameterByClass("ilcolumngui",
1271  $this->getDetailParameter(), $i);
1272 
1273  // ajax link
1274  if ($i > 0)
1275  {
1276  $ilCtrl->setParameterByClass("ilcolumngui",
1277  "block_id", "block_".$this->getBlockType()."_".$this->block_id);
1278  $this->tpl->setCurrentBlock("onclick");
1279  $this->tpl->setVariable("OC_BLOCK_ID",
1280  "block_".$this->getBlockType()."_".$this->block_id);
1281  $this->tpl->setVariable("OC_HREF",
1282  $ilCtrl->getLinkTargetByClass("ilcolumngui",
1283  "updateBlock", "", true));
1284  $this->tpl->parseCurrentBlock();
1285  $ilCtrl->setParameterByClass("ilcolumngui",
1286  "block_id", "");
1287  }
1288 
1289  // normal link
1290  $this->tpl->setCurrentBlock("det_link");
1291  //$this->tpl->setVariable("DLINK", $i);
1292  $this->tpl->setVariable("SRC_LINK",
1293  ilUtil::getImagePath("details".$i.".gif"));
1294  $this->tpl->setVariable("ALT_LINK",
1295  strip_tags(str_replace(array("'",'"'), "", $this->getTitle())).
1296  " (".$lng->txt("block")."): ".$lng->txt("details")." ".$i
1297  );
1298  $this->tpl->setVariable("DHREF",
1299  $ilCtrl->getLinkTargetByClass("ilcolumngui",
1300  ""));
1301  $this->tpl->parseCurrentBlock();
1302  $this->tpl->touchBlock("det_item");
1303  }
1304  else
1305  {
1306  $this->tpl->setCurrentBlock("det_text");
1307  //$this->tpl->setVariable("DTEXT", $i);
1308  $this->tpl->setVariable("ALT_NO_LINK",
1309  strip_tags(str_replace(array("'",'"'), "", $this->getTitle())).
1310  " (".$lng->txt("block")."): ".$lng->txt("details")." ".$i.
1311  " (".$lng->txt("selected").")");
1312  $this->tpl->setVariable("SRC_NO_LINK",
1313  ilUtil::getImagePath("details".$i."off.gif"));
1314  $this->tpl->parseCurrentBlock();
1315  $this->tpl->touchBlock("det_item");
1316  }
1317  }
1318 
1319  // info + icon in detail row
1320  if ($this->getFooterInfo(true) != "")
1321  {
1322  $this->tpl->setCurrentBlock("det_info");
1323  $this->tpl->setVariable("INFO_TEXT", $this->getFooterInfo(true));
1324  $this->tpl->setVariable("ALT_DET_INFO", $lng->txt("info_short"));
1325  $this->tpl->setVariable("DI_BLOCK_ID", $this->getBlockType()."_".$this->getBlockId());
1326  $this->tpl->setVariable("IMG_DET_INFO", ilUtil::getImagePath("icon_info_s.gif"));
1327  $this->tpl->parseCurrentBlock();
1328  }
1329 
1330  $this->tpl->setCurrentBlock("detail_setting");
1331  $this->tpl->setVariable("TXT_DETAILS", $lng->txt("details"));
1332  $this->tpl->setVariable("DCOLSPAN", $this->getColSpan());
1333  $this->tpl->parseCurrentBlock();
1334 
1335  $ilCtrl->setParameterByClass("ilcolumngui",
1336  $this->getDetailParameter(), "");
1337  }
1338  }
1339 
1343  function fillMoveRow()
1344  {
1345  global $ilCtrl, $lng;
1346 
1347  if ($this->config_mode)
1348  {
1349  if ($this->getAllowMove("left"))
1350  {
1351  $this->fillMoveLink("left", "icon_left_s.gif", $lng->txt("move_left"));
1352  }
1353  if ($this->getAllowMove("up"))
1354  {
1355  $this->fillMoveLink("up", "icon_up_s.gif", $lng->txt("move_up"));
1356  }
1357  if ($this->getAllowMove("down"))
1358  {
1359  $this->fillMoveLink("down", "icon_down_s.gif", $lng->txt("move_down"));
1360  }
1361  if ($this->getAllowMove("right"))
1362  {
1363  $this->fillMoveLink("right", "icon_right_s.gif", $lng->txt("move_right"));
1364  }
1365  $ilCtrl->setParameter($this, $this->getMoveParameter(), "");
1366 
1367  $this->tpl->setCurrentBlock("move");
1368  $this->tpl->parseCurrentBlock();
1369  }
1370  }
1371 
1372  function getAllowMove($a_direction)
1373  {
1374  return $this->move[$a_direction];
1375  }
1376 
1377  function setAllowMove($a_direction, $a_allow = true)
1378  {
1379  $this->move[$a_direction] = $a_allow;
1380 //var_dump($this->move);
1381  }
1382 
1383  function fillMoveLink($a_value, $a_img, $a_txt)
1384  {
1385  global $ilCtrl, $lng;
1386 
1387  $ilCtrl->setParameterByClass("ilcolumngui", "block_id",
1388  $this->getBlockType()."_".$this->getBlockId());
1389  $ilCtrl->setParameterByClass("ilcolumngui", "move_dir",
1390  $a_value);
1391  $this->tpl->setCurrentBlock("move_link");
1392  $this->tpl->setVariable("IMG_MOVE", ilUtil::getImagePath($a_img));
1393  $this->tpl->setVariable("ALT_MOVE", $a_txt);
1394  $this->tpl->setVariable("HREF_MOVE",
1395  $ilCtrl->getLinkTargetByClass("ilcolumngui",
1396  "moveBlock"));
1397  $this->tpl->parseCurrentBlock();
1398  }
1399 }