ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilContainerRenderer Class Reference

Class ilContainerRenderer. More...

+ Collaboration diagram for ilContainerRenderer:

Public Member Functions

 __construct ($a_enable_manage_select_all=false, $a_enable_multi_download=false, $a_active_block_ordering=false, array $a_block_custom_positions=null)
 Constructor. More...
 
 addTypeBlock ($a_type, $a_prefix=null, $a_postfix=null)
 Add type block. More...
 
 hasTypeBlock ($a_type)
 Type block already exists? More...
 
 addCustomBlock ($a_id, $a_caption, $a_actions=null)
 Add custom block. More...
 
 hasCustomBlock ($a_id)
 Custom block already exists? More...
 
 isValidBlock ($a_id)
 Any block with id exists? More...
 
 hideItem ($a_id)
 Mark item id as used, but do not render. More...
 
 removeItem ($a_id)
 Remove item (from any block) More...
 
 hasItem ($a_id)
 Item with id exists? More...
 
 addItemToBlock ($a_block_id, $a_item_type, $a_item_id, $a_item_html, $a_force=false)
 Add item to existing block. More...
 
 addDetailsLevel ($a_level, $a_url, $a_active=false)
 Add details level. More...
 
 resetDetails ()
 Reset/remove all detail levels. More...
 
 setBlockPosition ($a_block_id, $a_pos)
 Set block position. More...
 
 getHTML ()
 Get rendered html (of all blocks) More...
 
 renderSingleTypeBlock ($a_type)
 Get rendered html of single type block. More...
 
 renderSingleCustomBlock ($a_id)
 Get rendered html of single custom block. More...
 
 renderDetails (ilTemplate $a_tpl)
 Render detail level. More...
 

Data Fields

const UNIQUE_SEPARATOR = "-"
 

Protected Member Functions

 processBlockPositions ()
 Process block positions. More...
 
 renderHelperCustomBlock (ilTemplate $a_block_tpl, $a_block_id, $a_is_single=false)
 Render custom block. More...
 
 renderHelperTypeBlock (ilTemplate $a_block_tpl, $a_type, $a_is_single=false)
 Render type block. More...
 
 renderHelperGeneric (ilTemplate $a_block_tpl, $a_block_id, array $a_block, $a_is_single=false)
 Render block. More...
 
 initBlockTemplate ()
 Init template. More...
 
 addHeaderRow (ilTemplate $a_tpl, $a_type="", $a_text="", array $a_types_in_block=null, $a_commands_html=null, $a_order_id=null)
 Render block header. More...
 
 addStandardRow (ilTemplate $a_tpl, $a_html, $a_ref_id=0)
 Render item row. More...
 
 renderSelectAllBlock (ilTemplate $a_tpl)
 Render "select all". More...
 
 addSeparatorRow (ilTemplate $a_tpl)
 Render separator row. More...
 
 resetRowType ()
 Reset internal row type. More...
 
 getDownloadableTypes ()
 Get downloadable repository object types. More...
 

Protected Attributes

 $enable_manage_select_all
 
 $enable_multi_download
 
 $active_block_ordering
 
 $type_blocks = array()
 
 $custom_blocks = array()
 
 $items = array()
 
 $hidden_items = array()
 
 $block_items = array()
 
 $details = array()
 
 $rendered_blocks = array()
 
 $bl_cnt = 0
 
 $cur_row_type
 
 $block_pos = array()
 
 $block_custom_pos = array()
 
 $order_cnt = 0
 

Detailed Description

Class ilContainerRenderer.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilContainerGUI.php 52026 2014-08-05 10:22:06Z smeyer

Definition at line 10 of file class.ilContainerRenderer.php.

Constructor & Destructor Documentation

◆ __construct()

ilContainerRenderer::__construct (   $a_enable_manage_select_all = false,
  $a_enable_multi_download = false,
  $a_active_block_ordering = false,
array  $a_block_custom_positions = null 
)

Constructor.

Parameters
bool$a_enable_manage_select_all
bool$a_enable_multi_download
bool$a_active_block_ordering
array$a_block_custom_positions
Returns
self

Definition at line 46 of file class.ilContainerRenderer.php.

47  {
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;
52  }

Member Function Documentation

◆ addCustomBlock()

ilContainerRenderer::addCustomBlock (   $a_id,
  $a_caption,
  $a_actions = null 
)

Add custom block.

Parameters
mixed$a_id
string$a_caption
string$a_actionshtml snippet
Returns
boolean

Definition at line 100 of file class.ilContainerRenderer.php.

References hasCustomBlock().

101  {
102  if(!$this->hasCustomBlock($a_id))
103  {
104  $this->custom_blocks[$a_id] = array(
105  "caption" => $a_caption
106  ,"actions" => $a_actions
107  );
108  return true;
109  }
110  return false;
111  }
hasCustomBlock($a_id)
Custom block already exists?
+ Here is the call graph for this function:

◆ addDetailsLevel()

ilContainerRenderer::addDetailsLevel (   $a_level,
  $a_url,
  $a_active = false 
)

Add details level.

Parameters
int$a_level
string$a_url
bool$a_active

Definition at line 242 of file class.ilContainerRenderer.php.

243  {
244  $this->details[$a_level] = array(
245  "url" => $a_url
246  ,"active" => (bool)$a_active
247  );
248  }

◆ addHeaderRow()

ilContainerRenderer::addHeaderRow ( ilTemplate  $a_tpl,
  $a_type = "",
  $a_text = "",
array  $a_types_in_block = null,
  $a_commands_html = null,
  $a_order_id = null 
)
protected

Render block header.

Parameters
ilTemplate$a_tpl
string$a_type
string$a_text
array$a_types_in_block
string$a_commands_html
int$a_order_id

Definition at line 540 of file class.ilContainerRenderer.php.

References $ilSetting, $lng, getDownloadableTypes(), ilUtil\getImagePath(), ilPlugin\lookupTxt(), ilTemplate\parseCurrentBlock(), renderSelectAllBlock(), resetRowType(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilTemplate\touchBlock().

Referenced by renderHelperGeneric().

541  {
542  global $lng, $ilSetting, $objDefinition;
543 
544  $a_tpl->setVariable("CB_ID", ' id="bl_cntr_'.(++$this->bl_cnt).'"');
545 
546  if ($this->enable_manage_select_all)
547  {
548  $this->renderSelectAllBlock($a_tpl);
549  }
550  else if ($this->enable_multi_download)
551  {
552  if ($a_type)
553  {
554  $a_types_in_block = array($a_type);
555  }
556  foreach($a_types_in_block as $type)
557  {
558  if (in_array($type, $this->getDownloadableTypes()))
559  {
560  $this->renderSelectAllBlock($a_tpl);
561  break;
562  }
563  }
564  }
565 
566  if ($a_text == "" && $a_type != "")
567  {
568  if (!$objDefinition->isPlugin($a_type))
569  {
570  $title = $lng->txt("objs_".$a_type);
571  }
572  else
573  {
574  include_once("./Services/Component/classes/class.ilPlugin.php");
575  $title = ilPlugin::lookupTxt("rep_robj", $a_type, "objs_".$a_type);
576  }
577  }
578  else
579  {
580  $title = $a_text;
581  }
582 
583  if ($ilSetting->get("icon_position_in_lists") != "item_rows" &&
584  $a_type != "")
585  {
586  $icon = ilUtil::getImagePath("icon_".$a_type.".svg");
587 
588  $a_tpl->setCurrentBlock("container_header_row_image");
589  $a_tpl->setVariable("HEADER_IMG", $icon);
590  $a_tpl->setVariable("HEADER_ALT", $title);
591  }
592  else
593  {
594  $a_tpl->setCurrentBlock("container_header_row");
595  }
596 
597  if($a_order_id)
598  {
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);
601  }
602 
603  $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
604  $a_tpl->setVariable("CHR_COMMANDS", $a_commands_html);
605  $a_tpl->parseCurrentBlock();
606 
607  $a_tpl->touchBlock("container_row");
608 
609  $this->resetRowType();
610  }
getDownloadableTypes()
Get downloadable repository object types.
static lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
Lookup language text.
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:626
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
touchBlock($block)
overwrites ITX::touchBlock.
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
global $ilSetting
Definition: privfeed.php:40
global $lng
Definition: privfeed.php:40
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt public...
resetRowType()
Reset internal row type.
renderSelectAllBlock(ilTemplate $a_tpl)
Render "select all".
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addItemToBlock()

ilContainerRenderer::addItemToBlock (   $a_block_id,
  $a_item_type,
  $a_item_id,
  $a_item_html,
  $a_force = false 
)

Add item to existing block.

Parameters
mixed$a_block_id
string$a_item_typerepository object type
mixed$a_item_id
string$a_item_htmlhtml snippet
bool$a_forceenable multiple rendering
Returns
boolean

Definition at line 215 of file class.ilContainerRenderer.php.

References hasItem(), and isValidBlock().

216  {
217  if($this->isValidBlock($a_block_id) &&
218  $a_item_type != "itgr" &&
219  (!$this->hasItem($a_item_id) || $a_force) &&
220  trim($a_item_html))
221  {
222  // #16563 - item_id (== ref_id) is NOT unique, adding parent block id
223  $uniq_id = $a_block_id.self::UNIQUE_SEPARATOR.$a_item_id;
224 
225  $this->items[$uniq_id] = array(
226  "type" => $a_item_type
227  ,"html" => $a_item_html
228  );
229  $this->block_items[$a_block_id][] = $uniq_id;
230  return true;
231  }
232  return false;
233  }
hasItem($a_id)
Item with id exists?
isValidBlock($a_id)
Any block with id exists?
+ Here is the call graph for this function:

◆ addSeparatorRow()

ilContainerRenderer::addSeparatorRow ( ilTemplate  $a_tpl)
protected

Render separator row.

Parameters
ilTemplate$a_tpl

Definition at line 666 of file class.ilContainerRenderer.php.

References ilTemplate\parseCurrentBlock(), and ilTemplate\setCurrentBlock().

Referenced by getHTML().

667  {
668  $a_tpl->setCurrentBlock("container_block");
669  $a_tpl->parseCurrentBlock();
670  }
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt public...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addStandardRow()

ilContainerRenderer::addStandardRow ( ilTemplate  $a_tpl,
  $a_html,
  $a_ref_id = 0 
)
protected

Render item row.

Parameters
ilTemplate$a_tpl
string$a_html
int$a_ref_id

Definition at line 619 of file class.ilContainerRenderer.php.

References ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilTemplate\touchBlock().

Referenced by renderHelperGeneric().

620  {
621  // :TODO: obsolete?
622  $this->cur_row_type = ($this->cur_row_type == "row_type_1")
623  ? "row_type_2"
624  : "row_type_1";
625 
626  if ($a_ref_id > 0)
627  {
628  $a_tpl->setCurrentBlock($this->cur_row_type);
629  $a_tpl->setVariable("ROW_ID", 'id="item_row_'.$a_ref_id.'"');
630  $a_tpl->parseCurrentBlock();
631  }
632  else
633  {
634  $a_tpl->touchBlock($this->cur_row_type);
635  }
636 
637  $a_tpl->setCurrentBlock("container_standard_row");
638  $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
639  $a_tpl->parseCurrentBlock();
640 
641  $a_tpl->touchBlock("container_row");
642  }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:626
touchBlock($block)
overwrites ITX::touchBlock.
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt public...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addTypeBlock()

ilContainerRenderer::addTypeBlock (   $a_type,
  $a_prefix = null,
  $a_postfix = null 
)

Add type block.

Parameters
string$a_typerepository object type
string$a_prefixhtml snippet
string$a_postfixhtml snippet
Returns
boolean

Definition at line 67 of file class.ilContainerRenderer.php.

References hasTypeBlock().

68  {
69  if($a_type != "itgr" &&
70  !$this->hasTypeBlock($a_type))
71  {
72  $this->type_blocks[$a_type] = array(
73  "prefix" => $a_prefix
74  ,"postfix" => $a_postfix
75  );
76  return true;
77  }
78  return false;
79  }
hasTypeBlock($a_type)
Type block already exists?
+ Here is the call graph for this function:

◆ getDownloadableTypes()

ilContainerRenderer::getDownloadableTypes ( )
protected

Get downloadable repository object types.

Returns
array

Definition at line 686 of file class.ilContainerRenderer.php.

Referenced by addHeaderRow().

687  {
688  return array("fold", "file");
689  }
+ Here is the caller graph for this function:

◆ getHTML()

ilContainerRenderer::getHTML ( )

Get rendered html (of all blocks)

Returns
string

Definition at line 282 of file class.ilContainerRenderer.php.

References $valid, addSeparatorRow(), initBlockTemplate(), processBlockPositions(), renderDetails(), renderHelperCustomBlock(), and renderHelperTypeBlock().

283  {
284  $valid = false;
285 
286  $block_tpl = $this->initBlockTemplate();
287 
288  foreach($this->processBlockPositions() as $block_id)
289  {
290  if(array_key_exists($block_id, $this->custom_blocks))
291  {
292  if($this->renderHelperCustomBlock($block_tpl, $block_id))
293  {
294  $this->addSeparatorRow($block_tpl);
295  $valid = true;
296  }
297  }
298  if(array_key_exists($block_id, $this->type_blocks))
299  {
300  if($this->renderHelperTypeBlock($block_tpl, $block_id))
301  {
302  $this->addSeparatorRow($block_tpl);
303  $valid = true;
304  }
305  }
306  }
307 
308  if($valid)
309  {
310  $this->renderDetails($block_tpl);
311 
312  return $block_tpl->get();
313  }
314  }
$valid
addSeparatorRow(ilTemplate $a_tpl)
Render separator row.
renderDetails(ilTemplate $a_tpl)
Render detail level.
renderHelperCustomBlock(ilTemplate $a_block_tpl, $a_block_id, $a_is_single=false)
Render custom block.
renderHelperTypeBlock(ilTemplate $a_block_tpl, $a_type, $a_is_single=false)
Render type block.
processBlockPositions()
Process block positions.
+ Here is the call graph for this function:

◆ hasCustomBlock()

ilContainerRenderer::hasCustomBlock (   $a_id)

Custom block already exists?

Parameters
mixede$a_id
Returns
bool

Definition at line 119 of file class.ilContainerRenderer.php.

Referenced by addCustomBlock(), isValidBlock(), and renderHelperCustomBlock().

120  {
121  return array_key_exists($a_id, $this->custom_blocks);
122  }
+ Here is the caller graph for this function:

◆ hasItem()

ilContainerRenderer::hasItem (   $a_id)

Item with id exists?

Parameters
mixed$a_id
Returns
bool

Definition at line 193 of file class.ilContainerRenderer.php.

Referenced by addItemToBlock().

194  {
195  foreach(array_keys($this->items) as $item_id)
196  {
197  if(array_pop(explode(self::UNIQUE_SEPARATOR, $item_id)) == $a_id)
198  {
199  return true;
200  }
201  }
202  return in_array($a_id, $this->hidden_items);
203  }
+ Here is the caller graph for this function:

◆ hasTypeBlock()

ilContainerRenderer::hasTypeBlock (   $a_type)

Type block already exists?

Parameters
string$a_typerepository object type
Returns
bool

Definition at line 87 of file class.ilContainerRenderer.php.

Referenced by addTypeBlock(), isValidBlock(), and renderHelperTypeBlock().

88  {
89  return array_key_exists($a_type, $this->type_blocks);
90  }
+ Here is the caller graph for this function:

◆ hideItem()

ilContainerRenderer::hideItem (   $a_id)

Mark item id as used, but do not render.

Parameters
mixed$a_id

Definition at line 146 of file class.ilContainerRenderer.php.

147  {
148  // see hasItem();
149  $this->hidden_items[] = $a_id;
150 
151  // #16629 - do not remove hidden items from other blocks
152  // $this->removeItem($a_id);
153  }

◆ initBlockTemplate()

ilContainerRenderer::initBlockTemplate ( )
protected

Init template.

Returns
ilTemplate

Definition at line 521 of file class.ilContainerRenderer.php.

Referenced by getHTML(), renderSingleCustomBlock(), and renderSingleTypeBlock().

522  {
523  // :TODO: obsolete?
524  $this->cur_row_type = "row_type_1";
525 
526  return new ilTemplate("tpl.container_list_block.html", true, true,
527  "Services/Container");
528  }
special template class to simplify handling of ITX/PEAR
+ Here is the caller graph for this function:

◆ isValidBlock()

ilContainerRenderer::isValidBlock (   $a_id)

Any block with id exists?

Parameters
mixed$a_id
Returns
bool

Definition at line 130 of file class.ilContainerRenderer.php.

References hasCustomBlock(), and hasTypeBlock().

Referenced by addItemToBlock(), processBlockPositions(), and setBlockPosition().

131  {
132  return ($this->hasTypeBlock($a_id) ||
133  $this->hasCustomBlock($a_id));
134  }
hasTypeBlock($a_type)
Type block already exists?
hasCustomBlock($a_id)
Custom block already exists?
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processBlockPositions()

ilContainerRenderer::processBlockPositions ( )
protected

Process block positions.

Returns
array block ids

Definition at line 358 of file class.ilContainerRenderer.php.

References $block_pos, and isValidBlock().

Referenced by getHTML().

359  {
360  // manual order
361  if(sizeof($this->block_custom_pos))
362  {
363  $tmp = $this->block_pos;
364  $this->block_pos = array();
365  foreach($this->block_custom_pos as $idx => $block_id)
366  {
367  if($this->isValidBlock($block_id))
368  {
369  $this->block_pos[$block_id] = $idx;
370  }
371  }
372 
373  // at least some manual are valid
374  if(sizeof($this->block_pos))
375  {
376  // append missing blocks from default order
377  $last = max($this->block_pos);
378  foreach(array_keys($tmp) as $block_id)
379  {
380  if(!array_key_exists($block_id, $this->block_pos))
381  {
382  $this->block_pos[$block_id] = ++$last;
383  }
384  }
385  }
386  // all manual invalid, use default
387  else
388  {
389  $this->block_pos = $tmp;
390  }
391  }
392 
393  // add missing blocks to order
394  $last = sizeof($this->block_pos)
395  ? max($this->block_pos)
396  : 0;
397  foreach(array_keys($this->custom_blocks) as $block_id)
398  {
399  if(!array_key_exists($block_id, $this->block_pos))
400  {
401  $this->block_pos[$block_id] = ++$last;
402  }
403  }
404  foreach(array_keys($this->type_blocks) as $block_id)
405  {
406  if(!array_key_exists($block_id, $this->block_pos))
407  {
408  $this->block_pos[$block_id] = ++$last;
409  }
410  }
411 
412  asort($this->block_pos);
413 
414  return array_keys($this->block_pos);
415  }
isValidBlock($a_id)
Any block with id exists?
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeItem()

ilContainerRenderer::removeItem (   $a_id)

Remove item (from any block)

Parameters
mixed$a_id

Definition at line 160 of file class.ilContainerRenderer.php.

References $items.

161  {
162  foreach(array_keys($this->items) as $item_id)
163  {
164  if(array_pop(explode(self::UNIQUE_SEPARATOR, $item_id)) == $a_id)
165  {
166  unset($this->items[$item_id]);
167  }
168  }
169 
170  foreach($this->block_items as $block_id => $items)
171  {
172  foreach($items as $idx => $item_id)
173  {
174  if(array_pop(explode(self::UNIQUE_SEPARATOR, $item_id)) == $a_id)
175  {
176  unset($this->block_items[$block_id][$idx]);
177  if(!sizeof($this->block_items[$block_id]))
178  {
179  unset($this->block_items[$block_id]);
180  }
181  break;
182  }
183  }
184  }
185  }

◆ renderDetails()

ilContainerRenderer::renderDetails ( ilTemplate  $a_tpl)

Render detail level.

Parameters
ilTemplate$a_tpl

Definition at line 696 of file class.ilContainerRenderer.php.

References $lng, ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

Referenced by getHTML().

697  {
698  global $lng;
699 
700  if(sizeof($this->details))
701  {
702  $a_tpl->setCurrentBlock('container_details_row');
703  $a_tpl->setVariable('TXT_DETAILS', $lng->txt('details'));
704  $a_tpl->parseCurrentBlock();
705  }
706  }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:626
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
global $lng
Definition: privfeed.php:40
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt public...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderHelperCustomBlock()

ilContainerRenderer::renderHelperCustomBlock ( ilTemplate  $a_block_tpl,
  $a_block_id,
  $a_is_single = false 
)
protected

Render custom block.

Parameters
ilTemplate$a_block_tpl
mixed$a_block_id
bool$a_is_single
Returns
boolean

Definition at line 425 of file class.ilContainerRenderer.php.

References hasCustomBlock(), and renderHelperGeneric().

Referenced by getHTML(), and renderSingleCustomBlock().

426  {
427  if($this->hasCustomBlock($a_block_id))
428  {
429  return $this->renderHelperGeneric($a_block_tpl, $a_block_id, $this->custom_blocks[$a_block_id], $a_is_single);
430  }
431  return false;
432  }
hasCustomBlock($a_id)
Custom block already exists?
renderHelperGeneric(ilTemplate $a_block_tpl, $a_block_id, array $a_block, $a_is_single=false)
Render block.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderHelperGeneric()

ilContainerRenderer::renderHelperGeneric ( ilTemplate  $a_block_tpl,
  $a_block_id,
array  $a_block,
  $a_is_single = false 
)
protected

Render block.

Parameters
ilTemplate$a_block_tpl
mixed$a_block_id
array$a_blockblock properties
bool$a_is_single
Returns
boolean

Definition at line 463 of file class.ilContainerRenderer.php.

References $active_block_ordering, addHeaderRow(), and addStandardRow().

Referenced by renderHelperCustomBlock(), and renderHelperTypeBlock().

464  {
465  if(!in_array($a_block_id, $this->rendered_blocks))
466  {
467  $this->rendered_blocks[] = $a_block_id;
468 
469  $block_types = array();
470  if(is_array($this->block_items[$a_block_id]))
471  {
472  foreach($this->block_items[$a_block_id] as $item_id)
473  {
474  if(isset($this->items[$item_id]["type"]))
475  {
476  $block_types[] = $this->items[$item_id]["type"];
477  }
478  }
479  }
480 
481  // #14610 - manage empty item groups
482  if(is_array($this->block_items[$a_block_id]) ||
483  is_numeric($a_block_id))
484  {
485 
486  $order_id = (!$a_is_single && $this->active_block_ordering)
487  ? $a_block_id
488  : null;
489  $this->addHeaderRow($a_block_tpl, $a_block["type"], $a_block["caption"], array_unique($block_types), $a_block["actions"], $order_id);
490 
491  if($a_block["prefix"])
492  {
493  $this->addStandardRow($a_block_tpl, $a_block["prefix"]);
494  }
495 
496  if(is_array($this->block_items[$a_block_id]))
497  {
498  foreach($this->block_items[$a_block_id] as $item_id)
499  {
500  $this->addStandardRow($a_block_tpl, $this->items[$item_id]["html"], $item_id);
501  }
502  }
503 
504  if($a_block["postfix"])
505  {
506  $this->addStandardRow($a_block_tpl, $a_block["postfix"]);
507  }
508 
509  return true;
510  }
511  }
512 
513  return false;
514  }
addStandardRow(ilTemplate $a_tpl, $a_html, $a_ref_id=0)
Render item row.
addHeaderRow(ilTemplate $a_tpl, $a_type="", $a_text="", array $a_types_in_block=null, $a_commands_html=null, $a_order_id=null)
Render block header.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderHelperTypeBlock()

ilContainerRenderer::renderHelperTypeBlock ( ilTemplate  $a_block_tpl,
  $a_type,
  $a_is_single = false 
)
protected

Render type block.

Parameters
ilTemplate$a_block_tpl
string$a_typerepository object type
bool$a_is_single
Returns
boolean

Definition at line 442 of file class.ilContainerRenderer.php.

References hasTypeBlock(), and renderHelperGeneric().

Referenced by getHTML(), and renderSingleTypeBlock().

443  {
444  if($this->hasTypeBlock($a_type))
445  {
446  $block = $this->type_blocks[$a_type];
447  $block["type"] = $a_type;
448 
449  return $this->renderHelperGeneric($a_block_tpl, $a_type, $block, $a_is_single);
450  }
451  return false;
452  }
hasTypeBlock($a_type)
Type block already exists?
renderHelperGeneric(ilTemplate $a_block_tpl, $a_block_id, array $a_block, $a_is_single=false)
Render block.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderSelectAllBlock()

ilContainerRenderer::renderSelectAllBlock ( ilTemplate  $a_tpl)
protected

Render "select all".

ilTemplate $lng

Definition at line 649 of file class.ilContainerRenderer.php.

References $lng, ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

Referenced by addHeaderRow().

650  {
651  global $lng;
652 
653  $a_tpl->setCurrentBlock("select_all_row");
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"));
658  $a_tpl->parseCurrentBlock();
659  }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:626
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
global $lng
Definition: privfeed.php:40
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt public...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderSingleCustomBlock()

ilContainerRenderer::renderSingleCustomBlock (   $a_id)

Get rendered html of single custom block.

Parameters
mixed$a_id
Returns
html

Definition at line 338 of file class.ilContainerRenderer.php.

References initBlockTemplate(), and renderHelperCustomBlock().

339  {
340  $block_tpl = $this->initBlockTemplate();
341 
342  if($this->renderHelperCustomBlock($block_tpl, $a_id, true))
343  {
344  return $block_tpl->get();
345  }
346  }
renderHelperCustomBlock(ilTemplate $a_block_tpl, $a_block_id, $a_is_single=false)
Render custom block.
+ Here is the call graph for this function:

◆ renderSingleTypeBlock()

ilContainerRenderer::renderSingleTypeBlock (   $a_type)

Get rendered html of single type block.

Parameters
string$a_typerepository object type
Returns
html

Definition at line 322 of file class.ilContainerRenderer.php.

References initBlockTemplate(), and renderHelperTypeBlock().

323  {
324  $block_tpl = $this->initBlockTemplate();
325 
326  if($this->renderHelperTypeBlock($block_tpl, $a_type, true))
327  {
328  return $block_tpl->get();
329  }
330  }
renderHelperTypeBlock(ilTemplate $a_block_tpl, $a_type, $a_is_single=false)
Render type block.
+ Here is the call graph for this function:

◆ resetDetails()

ilContainerRenderer::resetDetails ( )

Reset/remove all detail levels.

Definition at line 253 of file class.ilContainerRenderer.php.

254  {
255  $this->details = array();
256  }

◆ resetRowType()

ilContainerRenderer::resetRowType ( )
protected

Reset internal row type.

Definition at line 675 of file class.ilContainerRenderer.php.

Referenced by addHeaderRow().

676  {
677  // :TODO: obsolete?
678  $this->cur_row_type = "";
679  }
+ Here is the caller graph for this function:

◆ setBlockPosition()

ilContainerRenderer::setBlockPosition (   $a_block_id,
  $a_pos 
)

Set block position.

Parameters
mixed$a_block_id
int$a_pos

Definition at line 269 of file class.ilContainerRenderer.php.

References isValidBlock().

270  {
271  if($this->isValidBlock($a_block_id))
272  {
273  $this->block_pos[$a_block_id] = $a_pos;
274  }
275  }
isValidBlock($a_id)
Any block with id exists?
+ Here is the call graph for this function:

Field Documentation

◆ $active_block_ordering

ilContainerRenderer::$active_block_ordering
protected

Definition at line 15 of file class.ilContainerRenderer.php.

Referenced by renderHelperGeneric().

◆ $bl_cnt

ilContainerRenderer::$bl_cnt = 0
protected

Definition at line 27 of file class.ilContainerRenderer.php.

◆ $block_custom_pos

ilContainerRenderer::$block_custom_pos = array()
protected

Definition at line 32 of file class.ilContainerRenderer.php.

◆ $block_items

ilContainerRenderer::$block_items = array()
protected

Definition at line 22 of file class.ilContainerRenderer.php.

◆ $block_pos

ilContainerRenderer::$block_pos = array()
protected

Definition at line 31 of file class.ilContainerRenderer.php.

Referenced by processBlockPositions().

◆ $cur_row_type

ilContainerRenderer::$cur_row_type
protected

Definition at line 28 of file class.ilContainerRenderer.php.

◆ $custom_blocks

ilContainerRenderer::$custom_blocks = array()
protected

Definition at line 19 of file class.ilContainerRenderer.php.

◆ $details

ilContainerRenderer::$details = array()
protected

Definition at line 23 of file class.ilContainerRenderer.php.

◆ $enable_manage_select_all

ilContainerRenderer::$enable_manage_select_all
protected

Definition at line 13 of file class.ilContainerRenderer.php.

◆ $enable_multi_download

ilContainerRenderer::$enable_multi_download
protected

Definition at line 14 of file class.ilContainerRenderer.php.

◆ $hidden_items

ilContainerRenderer::$hidden_items = array()
protected

Definition at line 21 of file class.ilContainerRenderer.php.

◆ $items

ilContainerRenderer::$items = array()
protected

Definition at line 20 of file class.ilContainerRenderer.php.

Referenced by removeItem().

◆ $order_cnt

ilContainerRenderer::$order_cnt = 0
protected

Definition at line 33 of file class.ilContainerRenderer.php.

◆ $rendered_blocks

ilContainerRenderer::$rendered_blocks = array()
protected

Definition at line 26 of file class.ilContainerRenderer.php.

◆ $type_blocks

ilContainerRenderer::$type_blocks = array()
protected

Definition at line 18 of file class.ilContainerRenderer.php.

◆ UNIQUE_SEPARATOR

const ilContainerRenderer::UNIQUE_SEPARATOR = "-"

Definition at line 35 of file class.ilContainerRenderer.php.


The documentation for this class was generated from the following file: