28 protected $move = array(
"left" =>
false,
"right" =>
false,
"up" =>
false,
"down" =>
false);
50 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
52 $tpl->addJavaScript(
"./Services/Block/js/ilblockcallback.js");
54 $this->
setLimit($ilUser->getPref(
"hits_per_page"));
59 $this->header_links[] =
60 array(
'href' => $a_href,
'text' => $a_text,
'status' => (
bool)$status);
75 $this->data = $a_data;
95 $this->bigmode = $a_bigmode;
115 $this->block_id = $a_block_id;
136 $this->detail_min = $a_min;
137 $this->detail_max = $a_max;
148 $this->currentdetaillevel = $a_currentdetaillevel;
160 $this->gui_object = $a_gui_object;
170 return $this->gui_object;
180 return $this->currentdetaillevel;
190 $this->title = $a_title;
210 $this->image = $a_image;
230 $this->offset = $a_offset;
240 return $this->offset;
245 if (!($this->offset < $this->max_count))
258 $this->limit = $a_limit;
278 $this->enableedit = $a_enableedit;
288 return $this->enableedit;
298 $this->repositorymode = $a_repositorymode;
308 return $this->repositorymode;
318 if ($a_hide_and_icon)
320 $this->footerinfo_icon = $a_footerinfo;
324 $this->footerinfo = $a_footerinfo;
335 if ($a_hide_and_icon)
352 $this->subtitle = $a_subtitle;
362 return $this->subtitle;
372 $this->refid = $a_refid;
392 $this->admincommands = $a_admincommands;
402 return $this->admincommands;
412 $this->colspan = $a_colspan;
432 $this->enabledetailrow = $a_enabledetailrow;
453 $this->enablenuminfo = $a_enablenuminfo;
474 $this->
property = $a_properties;
479 return $this->
property[$a_property];
484 $this->
property[$a_property] = $a_value;
494 $this->rowtemplatename = $a_rowtemplatename;
495 $this->rowtemplatedir = $a_rowtemplatedir;
525 return $this->rowtemplatename;
535 return $this->rowtemplatedir;
544 function addBlockCommand($a_href, $a_text, $a_target =
"", $a_img =
"", $a_right_aligned =
false)
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);
572 $this->close_command = $a_href;
576 $this->header_commands[] =
577 array(
"href" => $a_href,
595 function addFooterLink($a_text, $a_href =
"", $a_onclick =
"", $a_block_id =
"",
596 $a_top =
false, $a_omit_separator =
false)
598 $this->footer_links[] = array(
601 "onclick" => $a_onclick,
602 "block_id" => $a_block_id,
604 "omit_separator" => $a_omit_separator);
620 $this->footer_links = array();
639 if ($this->detail_max > $this->detail_min)
641 include_once(
"Services/Block/classes/class.ilBlockSetting.php");
689 $this->config_mode = $a_configmode;
699 return $this->config_mode;
711 if (!$ilAccess->checkAccess(
"visible",
"", $this->getRefId()))
717 $this->tpl =
new ilTemplate(
"tpl.block.html",
true,
true,
"Services/Block");
726 $this->tpl->setCurrentBlock(
"block_check");
727 $this->tpl->setVariable(
"BL_REF_ID", $this->
getRefId());
728 $this->tpl->parseCurrentBlock();
730 if ($ilAccess->checkAccess(
"delete",
"", $this->getRefId()))
733 "repository.php?ref_id=".
$_GET[
"ref_id"].
"&cmd=delete".
735 $lng->txt(
"delete"));
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();
754 if ($command[
"target"] !=
"")
756 $this->tpl->setCurrentBlock(
"bc_target");
757 $this->tpl->setVariable(
"CMD_TARGET", $command[
"target"]);
758 $this->tpl->parseCurrentBlock();
761 if ($command[
"img"] !=
"")
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");
771 $this->tpl->setCurrentBlock(
"block_command");
772 $this->tpl->setVariable(
"CMD_TEXT", $command[
"text"]);
773 $this->tpl->setVariable(
"BC_CLASS",
'class="il_ContainerItemCommand"');
776 $this->tpl->setVariable(
"CMD_HREF", $command[
"href"]);
777 $this->tpl->parseCurrentBlock();
779 $this->tpl->setCurrentBlock(
"block_commands");
780 $this->tpl->setVariable(
"CCOLSPAN", $this->
getColSpan());
781 $this->tpl->parseCurrentBlock();
794 if ($this->allow_moving)
807 $this->tpl->setCurrentBlock(
'head_delim');
808 $this->tpl->touchBlock(
'head_delim');
809 $this->tpl->parseCurrentBlock();
811 if($command[
'status'] ==
true)
813 $this->tpl->setCurrentBlock(
'head_link');
814 $this->tpl->setVariable(
'HHREF', $command[
'href']);
815 $this->tpl->setVariable(
'HLINK', $command[
'text']);
816 $this->tpl->parseCurrentBlock();
820 $this->tpl->setCurrentBlock(
'head_text');
821 $this->tpl->setVariable(
'HTEXT', $command[
'text']);
822 $this->tpl->parseCurrentBlock();
825 $this->tpl->setCurrentBlock(
'head_item');
826 $this->tpl->parseCurrentBlock();
831 $this->tpl->setCurrentBlock(
'header_links');
832 $this->tpl->parseCurrentBlock();
839 if (is_object($ilUser) && $ilUser->getPref(
"screen_reader_optimization"))
850 $this->tpl->setVariable(
"COLSPAN", $this->
getColSpan());
853 $this->tpl->touchBlock(
"hclassb");
857 $this->tpl->touchBlock(
"hclass");
860 if ($ilCtrl->isAsynch())
863 echo $this->tpl->getAsynch();
868 return '<div id="'.
"block_".$this->
getBlockType().
"_".$this->block_id.
'">'.
869 $this->tpl->get().
'</div>';
882 ($this->detail_max > $this->detail_min && $this->detail_min == 0) ||
883 $this->close_command !=
"" || $this->allow_moving)
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();
895 if (($this->detail_max > $this->detail_min && $this->detail_min == 0 &&
898 $this->close_command !=
"")
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")
913 if ($this->close_command !=
"")
915 $this->tpl->setVariable(
"HREF_CLOSE",
916 $this->close_command);
920 $ilCtrl->setParameterByClass(
"ilcolumngui",
922 $this->tpl->setVariable(
"HREF_CLOSE",
923 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
925 $ilCtrl->setParameterByClass(
"ilcolumngui",
928 $this->tpl->parseCurrentBlock();
931 $this->tpl->setCurrentBlock(
"header_commands");
932 $this->tpl->parseCurrentBlock();
935 $this->tpl->setCurrentBlock(
"hitem");
936 $this->tpl->parseCurrentBlock();
950 $this->tpl->setCurrentBlock(
"block_img");
951 $this->tpl->setVariable(
"IMG_BLOCK", $this->
getImage());
952 $this->tpl->setVariable(
"IMID",
954 $this->tpl->setVariable(
"IMG_ALT",
955 str_replace(array(
"'",
'"'),
"", strip_tags($lng->txt(
"icon").
" ".$this->
getTitle())));
956 $this->tpl->parseCurrentBlock();
960 $this->tpl->setCurrentBlock(
"header_title");
961 $this->tpl->setVariable(
"BTID",
963 $this->tpl->setVariable(
"BLOCK_TITLE",
965 $this->tpl->setVariable(
"TXT_BLOCK",
967 $this->tpl->parseCurrentBlock();
969 $this->tpl->setCurrentBlock(
"hitem");
970 $this->tpl->parseCurrentBlock();
979 $this->tpl->setCurrentBlock(
"data_section");
980 $this->tpl->setVariable(
"DATA", $a_content);
981 $this->tpl->parseCurrentBlock();
999 $nav = explode(
":", $this->nav_value);
1014 $this->max_count = count(
$data);
1018 foreach(
$data as $record)
1020 $this->tpl->setCurrentBlock(
"block_row");
1023 $this->tpl->setCurrentBlock(
"block_row");
1024 $this->tpl->parseCurrentBlock();
1030 foreach ($a_set as $key => $value)
1032 $this->tpl->setVariable(
"VAL_".strtoupper($key), $value);
1042 $this->css_row = ($this->css_row !=
"ilBlockRow1")
1045 $this->tpl->setVariable($a_placeholder, $this->css_row);
1064 if ($end > $this->max_count or $this->
getLimit() == 0)
1069 $numinfo =
"(".$start.
"-".$end.
" ".strtolower($lng->txt(
"of")).
" ".$this->max_count.
")";
1096 $ilCtrl->setParameterByClass(
"ilcolumngui",
1100 $ilCtrl->setParameterByClass(
"ilcolumngui",
1101 "block_id",
"block_".$this->
getBlockType().
"_".$this->block_id);
1103 $onclick = $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
1104 "updateBlock",
"",
true);
1105 $ilCtrl->setParameterByClass(
"ilcolumngui",
1109 $href = $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"");
1110 $text = $lng->txt(
"previous");
1116 $pages = intval($this->max_count / $this->
getLimit());
1119 if (($this->max_count % $this->
getLimit()))
1127 $ilCtrl->setParameterByClass(
"ilcolumngui",
1131 $ilCtrl->setParameterByClass(
"ilcolumngui",
1132 "block_id",
"block_".$this->
getBlockType().
"_".$this->block_id);
1135 $onclick = $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
1136 "updateBlock",
"",
true);
1139 $ilCtrl->setParameterByClass(
"ilcolumngui",
1143 $href = $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"");
1144 $text = $lng->txt(
"next");
1148 $ilCtrl->setParameterByClass(
"ilcolumngui",
1170 $prefix = ($a_top) ?
"top" :
"foot";
1172 $omit_separator =
false;
1173 foreach($flinks as $flink)
1175 if ($flink[
"top"] != $a_top)
1180 if (!$first && !$omit_separator)
1182 $this->tpl->touchBlock($prefix.
"_delim");
1183 $this->tpl->touchBlock($prefix.
"_item");
1187 if ($flink[
"onclick"] !=
"")
1189 $this->tpl->setCurrentBlock($prefix.
"_onclick");
1190 $this->tpl->setVariable(
"OC_BLOCK_ID",
1191 $flink[
"block_id"]);
1192 $this->tpl->setVariable(
"OC_HREF",
1194 $this->tpl->parseCurrentBlock();
1198 if ($flink[
"href"] !=
"")
1201 $this->tpl->setCurrentBlock($prefix.
"_link");
1202 $this->tpl->setVariable(
"FHREF",
1204 $this->tpl->setVariable(
"FLINK", $flink[
"text"]);
1205 $this->tpl->parseCurrentBlock();
1206 $this->tpl->touchBlock($prefix.
"_item");
1210 $this->tpl->setCurrentBlock($prefix.
"_text");
1211 $this->tpl->setVariable(
"FTEXT", $flink[
"text"]);
1212 $this->tpl->parseCurrentBlock();
1213 $this->tpl->touchBlock($prefix.
"_item");
1216 $omit_separator = $flink[
"omit_separator"];
1219 if ($a_numinfo !=
"")
1221 $this->tpl->setVariable(
"NUMINFO", $a_numinfo);
1227 $this->tpl->setVariable(
"PCOLSPAN", $this->
getColSpan());
1228 $this->tpl->setCurrentBlock($prefix.
"_row");
1229 $this->tpl->parseCurrentBlock();
1240 if ($this->enabledetailrow ==
false)
1245 $start = ($this->detail_min < 1)
1247 : $this->detail_min;
1251 : $this->detail_max;
1253 $settings = array();
1254 for ($i = $start; $i <= $end; $i++)
1261 foreach ($settings as $i)
1263 if (($i > $start && $i > 1))
1270 $ilCtrl->setParameterByClass(
"ilcolumngui",
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",
1281 $this->tpl->setVariable(
"OC_HREF",
1282 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
1283 "updateBlock",
"",
true));
1284 $this->tpl->parseCurrentBlock();
1285 $ilCtrl->setParameterByClass(
"ilcolumngui",
1290 $this->tpl->setCurrentBlock(
"det_link");
1292 $this->tpl->setVariable(
"SRC_LINK",
1294 $this->tpl->setVariable(
"ALT_LINK",
1295 strip_tags(str_replace(array(
"'",
'"'),
"", $this->
getTitle())).
1296 " (".$lng->txt(
"block").
"): ".$lng->txt(
"details").
" ".$i
1298 $this->tpl->setVariable(
"DHREF",
1299 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
1301 $this->tpl->parseCurrentBlock();
1302 $this->tpl->touchBlock(
"det_item");
1306 $this->tpl->setCurrentBlock(
"det_text");
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",
1314 $this->tpl->parseCurrentBlock();
1315 $this->tpl->touchBlock(
"det_item");
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"));
1327 $this->tpl->parseCurrentBlock();
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();
1335 $ilCtrl->setParameterByClass(
"ilcolumngui",
1347 if ($this->config_mode)
1351 $this->
fillMoveLink(
"left",
"icon_left_s.gif", $lng->txt(
"move_left"));
1355 $this->
fillMoveLink(
"up",
"icon_up_s.gif", $lng->txt(
"move_up"));
1359 $this->
fillMoveLink(
"down",
"icon_down_s.gif", $lng->txt(
"move_down"));
1363 $this->
fillMoveLink(
"right",
"icon_right_s.gif", $lng->txt(
"move_right"));
1367 $this->tpl->setCurrentBlock(
"move");
1368 $this->tpl->parseCurrentBlock();
1374 return $this->move[$a_direction];
1379 $this->move[$a_direction] = $a_allow;
1387 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
1389 $ilCtrl->setParameterByClass(
"ilcolumngui",
"move_dir",
1391 $this->tpl->setCurrentBlock(
"move_link");
1393 $this->tpl->setVariable(
"ALT_MOVE", $a_txt);
1394 $this->tpl->setVariable(
"HREF_MOVE",
1395 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
1397 $this->tpl->parseCurrentBlock();