46 public function __construct($a_enable_manage_select_all =
false, $a_enable_multi_download =
false, $a_active_block_ordering =
false, array $a_block_custom_positions = null)
48 $this->enable_manage_select_all = (bool)$a_enable_manage_select_all;
49 $this->enable_multi_download = (bool)$a_enable_multi_download;
50 $this->active_block_ordering = (bool)$a_active_block_ordering;
51 $this->block_custom_pos = $a_block_custom_positions;
67 public function addTypeBlock($a_type, $a_prefix = null, $a_postfix = null)
69 if($a_type !=
"itgr" &&
72 $this->type_blocks[$a_type] = array(
74 ,
"postfix" => $a_postfix
89 return array_key_exists($a_type, $this->type_blocks);
104 $this->custom_blocks[$a_id] = array(
105 "caption" => $a_caption
106 ,
"actions" => $a_actions
121 return array_key_exists($a_id, $this->custom_blocks);
149 $this->hidden_items[] = $a_id;
162 foreach(array_keys($this->items) as $item_id)
164 if(array_pop(explode(self::UNIQUE_SEPARATOR, $item_id)) == $a_id)
166 unset($this->items[$item_id]);
170 foreach($this->block_items as $block_id =>
$items)
172 foreach(
$items as $idx => $item_id)
174 if(array_pop(explode(self::UNIQUE_SEPARATOR, $item_id)) == $a_id)
176 unset($this->block_items[$block_id][$idx]);
177 if(!
sizeof($this->block_items[$block_id]))
179 unset($this->block_items[$block_id]);
195 foreach(array_keys($this->items) as $item_id)
197 if(array_pop(explode(self::UNIQUE_SEPARATOR, $item_id)) == $a_id)
202 return in_array($a_id, $this->hidden_items);
215 public function addItemToBlock($a_block_id, $a_item_type, $a_item_id, $a_item_html, $a_force =
false)
218 $a_item_type !=
"itgr" &&
219 (!$this->
hasItem($a_item_id) || $a_force) &&
223 $uniq_id = $a_block_id.self::UNIQUE_SEPARATOR.$a_item_id;
225 $this->items[$uniq_id] = array(
226 "type" => $a_item_type
227 ,
"html" => $a_item_html
229 $this->block_items[$a_block_id][] = $uniq_id;
244 $this->details[$a_level] = array(
246 ,
"active" => (
bool)$a_active
255 $this->details = array();
273 $this->block_pos[$a_block_id] = $a_pos;
290 if(array_key_exists($block_id, $this->custom_blocks))
298 if(array_key_exists($block_id, $this->type_blocks))
312 return $block_tpl->get();
328 return $block_tpl->get();
344 return $block_tpl->get();
361 if(
sizeof($this->block_custom_pos))
364 $this->block_pos = array();
365 foreach($this->block_custom_pos as $idx => $block_id)
369 $this->block_pos[$block_id] = $idx;
374 if(
sizeof($this->block_pos))
377 $last = max($this->block_pos);
378 foreach(array_keys($tmp) as $block_id)
380 if(!array_key_exists($block_id, $this->block_pos))
382 $this->block_pos[$block_id] = ++$last;
389 $this->block_pos = $tmp;
395 ? max($this->block_pos)
397 foreach(array_keys($this->custom_blocks) as $block_id)
399 if(!array_key_exists($block_id, $this->block_pos))
401 $this->block_pos[$block_id] = ++$last;
404 foreach(array_keys($this->type_blocks) as $block_id)
406 if(!array_key_exists($block_id, $this->block_pos))
408 $this->block_pos[$block_id] = ++$last;
412 asort($this->block_pos);
414 return array_keys($this->block_pos);
429 return $this->
renderHelperGeneric($a_block_tpl, $a_block_id, $this->custom_blocks[$a_block_id], $a_is_single);
446 $block = $this->type_blocks[$a_type];
447 $block[
"type"] = $a_type;
465 if(!in_array($a_block_id, $this->rendered_blocks))
467 $this->rendered_blocks[] = $a_block_id;
469 $block_types = array();
470 if(is_array($this->block_items[$a_block_id]))
472 foreach($this->block_items[$a_block_id] as $item_id)
474 if(isset($this->items[$item_id][
"type"]))
476 $block_types[] = $this->items[$item_id][
"type"];
482 if(is_array($this->block_items[$a_block_id]) ||
483 is_numeric($a_block_id))
489 $this->
addHeaderRow($a_block_tpl, $a_block[
"type"], $a_block[
"caption"], array_unique($block_types), $a_block[
"actions"], $order_id);
491 if($a_block[
"prefix"])
496 if(is_array($this->block_items[$a_block_id]))
498 foreach($this->block_items[$a_block_id] as $item_id)
500 $this->
addStandardRow($a_block_tpl, $this->items[$item_id][
"html"], $item_id);
504 if($a_block[
"postfix"])
524 $this->cur_row_type =
"row_type_1";
526 return new ilTemplate(
"tpl.container_list_block.html",
true,
true,
527 "Services/Container");
540 protected function addHeaderRow(
ilTemplate $a_tpl, $a_type =
"", $a_text =
"", array $a_types_in_block = null, $a_commands_html = null, $a_order_id = null)
544 $a_tpl->
setVariable(
"CB_ID",
' id="bl_cntr_'.(++$this->bl_cnt).
'"');
546 if ($this->enable_manage_select_all)
550 else if ($this->enable_multi_download)
554 $a_types_in_block = array($a_type);
556 foreach($a_types_in_block as $type)
566 if ($a_text ==
"" && $a_type !=
"")
568 if (!$objDefinition->isPlugin($a_type))
570 $title = $lng->txt(
"objs_".$a_type);
574 include_once(
"./Services/Component/classes/class.ilPlugin.php");
583 if ($ilSetting->get(
"icon_position_in_lists") !=
"item_rows" &&
599 $a_tpl->
setVariable(
"BLOCK_HEADER_ORDER_NAME",
"position[blocks][".$a_order_id.
"]");
600 $a_tpl->
setVariable(
"BLOCK_HEADER_ORDER_NUM", (++$this->order_cnt)*10);
603 $a_tpl->
setVariable(
"BLOCK_HEADER_CONTENT", $title);
604 $a_tpl->
setVariable(
"CHR_COMMANDS", $a_commands_html);
622 $this->cur_row_type = ($this->cur_row_type ==
"row_type_1")
629 $a_tpl->
setVariable(
"ROW_ID",
'id="item_row_'.$a_ref_id.
'"');
654 $a_tpl->
setVariable(
"CHECKBOXNAME",
"bl_cb_".$this->bl_cnt);
655 $a_tpl->
setVariable(
"SEL_ALL_PARENT",
"bl_cntr_".$this->bl_cnt);
656 $a_tpl->
setVariable(
"SEL_ALL_PARENT",
"bl_cntr_".$this->bl_cnt);
657 $a_tpl->
setVariable(
"TXT_SELECT_ALL", $lng->txt(
"select_all"));
678 $this->cur_row_type =
"";
688 return array(
"fold",
"file");
700 if(
sizeof($this->details))
703 $a_tpl->
setVariable(
'TXT_DETAILS', $lng->txt(
'details'));