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");
649 $ilCtrl->redirectByClass(
"ilcolumngui",
"");
693 $this->config_mode = $a_configmode;
703 return $this->config_mode;
715 if (!$ilAccess->checkAccess(
"visible",
"", $this->getRefId()))
721 $this->tpl =
new ilTemplate(
"tpl.block.html",
true,
true,
"Services/Block");
730 $this->tpl->setCurrentBlock(
"block_check");
731 $this->tpl->setVariable(
"BL_REF_ID", $this->
getRefId());
732 $this->tpl->parseCurrentBlock();
734 if ($ilAccess->checkAccess(
"delete",
"", $this->getRefId()))
737 "repository.php?ref_id=".
$_GET[
"ref_id"].
"&cmd=delete".
739 $lng->txt(
"delete"));
746 $this->tpl->setCurrentBlock(
"footer_information");
747 $this->tpl->setVariable(
"FOOTER_INFO", $this->
getFooterInfo());
748 $this->tpl->setVariable(
"FICOLSPAN", $this->
getColSpan());
749 $this->tpl->parseCurrentBlock();
758 if ($command[
"target"] !=
"")
760 $this->tpl->setCurrentBlock(
"bc_target");
761 $this->tpl->setVariable(
"CMD_TARGET", $command[
"target"]);
762 $this->tpl->parseCurrentBlock();
765 if ($command[
"img"] !=
"")
767 $this->tpl->setCurrentBlock(
"bc_image");
768 $this->tpl->setVariable(
"SRC_BC", $command[
"img"]);
769 $this->tpl->setVariable(
"ALT_BC", $command[
"text"]);
770 $this->tpl->parseCurrentBlock();
771 $this->tpl->setCurrentBlock(
"block_command");
775 $this->tpl->setCurrentBlock(
"block_command");
776 $this->tpl->setVariable(
"CMD_TEXT", $command[
"text"]);
777 $this->tpl->setVariable(
"BC_CLASS",
'class="il_ContainerItemCommand"');
780 $this->tpl->setVariable(
"CMD_HREF", $command[
"href"]);
781 $this->tpl->parseCurrentBlock();
783 $this->tpl->setCurrentBlock(
"block_commands");
784 $this->tpl->setVariable(
"CCOLSPAN", $this->
getColSpan());
785 $this->tpl->parseCurrentBlock();
798 if ($this->allow_moving)
811 $this->tpl->setCurrentBlock(
'head_delim');
812 $this->tpl->touchBlock(
'head_delim');
813 $this->tpl->parseCurrentBlock();
815 if($command[
'status'] ==
true)
817 $this->tpl->setCurrentBlock(
'head_link');
818 $this->tpl->setVariable(
'HHREF', $command[
'href']);
819 $this->tpl->setVariable(
'HLINK', $command[
'text']);
820 $this->tpl->parseCurrentBlock();
824 $this->tpl->setCurrentBlock(
'head_text');
825 $this->tpl->setVariable(
'HTEXT', $command[
'text']);
826 $this->tpl->parseCurrentBlock();
829 $this->tpl->setCurrentBlock(
'head_item');
830 $this->tpl->parseCurrentBlock();
835 $this->tpl->setCurrentBlock(
'header_links');
836 $this->tpl->parseCurrentBlock();
843 if (is_object($ilUser) && $ilUser->getPref(
"screen_reader_optimization"))
854 $this->tpl->setVariable(
"COLSPAN", $this->
getColSpan());
857 $this->tpl->touchBlock(
"hclassb");
861 $this->tpl->touchBlock(
"hclass");
864 if ($ilCtrl->isAsynch())
867 echo $this->tpl->getAsynch();
872 return '<div id="'.
"block_".$this->
getBlockType().
"_".$this->block_id.
'">'.
873 $this->tpl->get().
'</div>';
886 ($this->detail_max > $this->detail_min && $this->detail_min == 0) ||
887 $this->close_command !=
"" || $this->allow_moving)
892 $this->tpl->setCurrentBlock(
"header_command");
893 $this->tpl->setVariable(
"HREF_HCOMM", $command[
"href"]);
894 $this->tpl->setVariable(
"TXT_HCOMM", $command[
"text"]);
895 $this->tpl->parseCurrentBlock();
899 if (($this->detail_max > $this->detail_min && $this->detail_min == 0 &&
902 $this->close_command !=
"")
904 $this->tpl->setCurrentBlock(
"header_close");
905 $this->tpl->setVariable(
"ALT_CLOSE",
906 strip_tags(str_replace(array(
"'",
'"'),
"", $this->
getTitle())).
907 " (".$lng->txt(
"block").
"): ".$lng->txt(
"close")
917 if ($this->close_command !=
"")
919 $this->tpl->setVariable(
"HREF_CLOSE",
920 $this->close_command);
924 $ilCtrl->setParameterByClass(
"ilcolumngui",
926 $this->tpl->setVariable(
"HREF_CLOSE",
927 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
929 $ilCtrl->setParameterByClass(
"ilcolumngui",
932 $this->tpl->parseCurrentBlock();
935 $this->tpl->setCurrentBlock(
"header_commands");
936 $this->tpl->parseCurrentBlock();
939 $this->tpl->setCurrentBlock(
"hitem");
940 $this->tpl->parseCurrentBlock();
954 $this->tpl->setCurrentBlock(
"block_img");
955 $this->tpl->setVariable(
"IMG_BLOCK", $this->
getImage());
956 $this->tpl->setVariable(
"IMID",
958 $this->tpl->setVariable(
"IMG_ALT",
959 str_replace(array(
"'",
'"'),
"", strip_tags($lng->txt(
"icon").
" ".$this->
getTitle())));
960 $this->tpl->parseCurrentBlock();
964 $this->tpl->setCurrentBlock(
"header_title");
965 $this->tpl->setVariable(
"BTID",
967 $this->tpl->setVariable(
"BLOCK_TITLE",
969 $this->tpl->setVariable(
"TXT_BLOCK",
971 $this->tpl->parseCurrentBlock();
973 $this->tpl->setCurrentBlock(
"hitem");
974 $this->tpl->parseCurrentBlock();
983 $this->tpl->setCurrentBlock(
"data_section");
984 $this->tpl->setVariable(
"DATA", $a_content);
985 $this->tpl->parseCurrentBlock();
1003 $nav = explode(
":", $this->nav_value);
1018 $this->max_count = count(
$data);
1022 foreach(
$data as $record)
1024 $this->tpl->setCurrentBlock(
"block_row");
1027 $this->tpl->setCurrentBlock(
"block_row");
1028 $this->tpl->parseCurrentBlock();
1034 foreach ($a_set as $key => $value)
1036 $this->tpl->setVariable(
"VAL_".strtoupper($key), $value);
1046 $this->css_row = ($this->css_row !=
"ilBlockRow1")
1049 $this->tpl->setVariable($a_placeholder, $this->css_row);
1068 if ($end > $this->max_count or $this->
getLimit() == 0)
1073 $numinfo =
"(".$start.
"-".$end.
" ".strtolower($lng->txt(
"of")).
" ".$this->max_count.
")";
1100 $ilCtrl->setParameterByClass(
"ilcolumngui",
1104 $ilCtrl->setParameterByClass(
"ilcolumngui",
1105 "block_id",
"block_".$this->
getBlockType().
"_".$this->block_id);
1107 $onclick = $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
1108 "updateBlock",
"",
true);
1109 $ilCtrl->setParameterByClass(
"ilcolumngui",
1113 $href = $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"");
1114 $text = $lng->txt(
"previous");
1120 $pages = intval($this->max_count / $this->
getLimit());
1123 if (($this->max_count % $this->
getLimit()))
1131 $ilCtrl->setParameterByClass(
"ilcolumngui",
1135 $ilCtrl->setParameterByClass(
"ilcolumngui",
1136 "block_id",
"block_".$this->
getBlockType().
"_".$this->block_id);
1139 $onclick = $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
1140 "updateBlock",
"",
true);
1143 $ilCtrl->setParameterByClass(
"ilcolumngui",
1147 $href = $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"");
1148 $text = $lng->txt(
"next");
1152 $ilCtrl->setParameterByClass(
"ilcolumngui",
1174 $prefix = ($a_top) ?
"top" :
"foot";
1176 $omit_separator =
false;
1177 foreach($flinks as $flink)
1179 if ($flink[
"top"] != $a_top)
1184 if (!$first && !$omit_separator)
1186 $this->tpl->touchBlock($prefix.
"_delim");
1187 $this->tpl->touchBlock($prefix.
"_item");
1191 if ($flink[
"onclick"] !=
"")
1193 $this->tpl->setCurrentBlock($prefix.
"_onclick");
1194 $this->tpl->setVariable(
"OC_BLOCK_ID",
1195 $flink[
"block_id"]);
1196 $this->tpl->setVariable(
"OC_HREF",
1198 $this->tpl->parseCurrentBlock();
1202 if ($flink[
"href"] !=
"")
1205 $this->tpl->setCurrentBlock($prefix.
"_link");
1206 $this->tpl->setVariable(
"FHREF",
1208 $this->tpl->setVariable(
"FLINK", $flink[
"text"]);
1209 $this->tpl->parseCurrentBlock();
1210 $this->tpl->touchBlock($prefix.
"_item");
1214 $this->tpl->setCurrentBlock($prefix.
"_text");
1215 $this->tpl->setVariable(
"FTEXT", $flink[
"text"]);
1216 $this->tpl->parseCurrentBlock();
1217 $this->tpl->touchBlock($prefix.
"_item");
1220 $omit_separator = $flink[
"omit_separator"];
1223 if ($a_numinfo !=
"")
1225 $this->tpl->setVariable(
"NUMINFO", $a_numinfo);
1231 $this->tpl->setVariable(
"PCOLSPAN", $this->
getColSpan());
1232 $this->tpl->setCurrentBlock($prefix.
"_row");
1233 $this->tpl->parseCurrentBlock();
1244 if ($this->enabledetailrow ==
false)
1249 $start = ($this->detail_min < 1)
1251 : $this->detail_min;
1255 : $this->detail_max;
1257 $settings = array();
1258 for ($i = $start; $i <= $end; $i++)
1265 foreach ($settings as $i)
1267 if (($i > $start && $i > 1))
1274 $ilCtrl->setParameterByClass(
"ilcolumngui",
1280 $ilCtrl->setParameterByClass(
"ilcolumngui",
1281 "block_id",
"block_".$this->
getBlockType().
"_".$this->block_id);
1282 $this->tpl->setCurrentBlock(
"onclick");
1283 $this->tpl->setVariable(
"OC_BLOCK_ID",
1285 $this->tpl->setVariable(
"OC_HREF",
1286 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
1287 "updateBlock",
"",
true));
1288 $this->tpl->parseCurrentBlock();
1289 $ilCtrl->setParameterByClass(
"ilcolumngui",
1294 $this->tpl->setCurrentBlock(
"det_link");
1296 $this->tpl->setVariable(
"SRC_LINK",
1298 $this->tpl->setVariable(
"ALT_LINK",
1299 strip_tags(str_replace(array(
"'",
'"'),
"", $this->
getTitle())).
1300 " (".$lng->txt(
"block").
"): ".$lng->txt(
"details").
" ".$i
1302 $this->tpl->setVariable(
"DHREF",
1303 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
1305 $this->tpl->parseCurrentBlock();
1306 $this->tpl->touchBlock(
"det_item");
1310 $this->tpl->setCurrentBlock(
"det_text");
1312 $this->tpl->setVariable(
"ALT_NO_LINK",
1313 strip_tags(str_replace(array(
"'",
'"'),
"", $this->
getTitle())).
1314 " (".$lng->txt(
"block").
"): ".$lng->txt(
"details").
" ".$i.
1315 " (".$lng->txt(
"selected").
")");
1316 $this->tpl->setVariable(
"SRC_NO_LINK",
1318 $this->tpl->parseCurrentBlock();
1319 $this->tpl->touchBlock(
"det_item");
1326 $this->tpl->setCurrentBlock(
"det_info");
1327 $this->tpl->setVariable(
"INFO_TEXT", $this->
getFooterInfo(
true));
1328 $this->tpl->setVariable(
"ALT_DET_INFO", $lng->txt(
"info_short"));
1331 $this->tpl->parseCurrentBlock();
1334 $this->tpl->setCurrentBlock(
"detail_setting");
1335 $this->tpl->setVariable(
"TXT_DETAILS", $lng->txt(
"details"));
1336 $this->tpl->setVariable(
"DCOLSPAN", $this->
getColSpan());
1337 $this->tpl->parseCurrentBlock();
1339 $ilCtrl->setParameterByClass(
"ilcolumngui",
1351 if ($this->config_mode)
1355 $this->
fillMoveLink(
"left",
"icon_left_s.gif", $lng->txt(
"move_left"));
1359 $this->
fillMoveLink(
"up",
"icon_up_s.gif", $lng->txt(
"move_up"));
1363 $this->
fillMoveLink(
"down",
"icon_down_s.gif", $lng->txt(
"move_down"));
1367 $this->
fillMoveLink(
"right",
"icon_right_s.gif", $lng->txt(
"move_right"));
1371 $this->tpl->setCurrentBlock(
"move");
1372 $this->tpl->parseCurrentBlock();
1378 return $this->move[$a_direction];
1383 $this->move[$a_direction] = $a_allow;
1391 $ilCtrl->setParameterByClass(
"ilcolumngui",
"block_id",
1393 $ilCtrl->setParameterByClass(
"ilcolumngui",
"move_dir",
1395 $this->tpl->setCurrentBlock(
"move_link");
1397 $this->tpl->setVariable(
"ALT_MOVE", $a_txt);
1398 $this->tpl->setVariable(
"HREF_MOVE",
1399 $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
1401 $this->tpl->parseCurrentBlock();