ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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()
 
 $item_ids = 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 11 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 48 of file class.ilContainerRenderer.php.

49  {
50  $this->enable_manage_select_all = (bool)$a_enable_manage_select_all;
51  $this->enable_multi_download = (bool)$a_enable_multi_download;
52  $this->active_block_ordering = (bool)$a_active_block_ordering;
53  $this->block_custom_pos = $a_block_custom_positions;
54  }

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 102 of file class.ilContainerRenderer.php.

References array, and hasCustomBlock().

103  {
104  if(!$this->hasCustomBlock($a_id))
105  {
106  $this->custom_blocks[$a_id] = array(
107  "caption" => $a_caption
108  ,"actions" => $a_actions
109  );
110  return true;
111  }
112  return false;
113  }
Create styles array
The data for the language used.
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 250 of file class.ilContainerRenderer.php.

References array.

251  {
252  $this->details[$a_level] = array(
253  "url" => $a_url
254  ,"active" => (bool)$a_active
255  );
256  }
Create styles array
The data for the language used.

◆ 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 548 of file class.ilContainerRenderer.php.

References $a_type, $ilSetting, $lng, $title, array, getDownloadableTypes(), ilUtil\getImagePath(), ilObjectPlugin\getRepoPluginObjectByType(), ilTemplate\parseCurrentBlock(), renderSelectAllBlock(), resetRowType(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilTemplate\touchBlock().

Referenced by renderHelperGeneric().

549  {
550  global $lng, $ilSetting, $objDefinition;
551 
552  $a_tpl->setVariable("CB_ID", ' id="bl_cntr_'.(++$this->bl_cnt).'"');
553 
554  if ($this->enable_manage_select_all)
555  {
556  $this->renderSelectAllBlock($a_tpl);
557  }
558  else if ($this->enable_multi_download)
559  {
560  if ($a_type)
561  {
562  $a_types_in_block = array($a_type);
563  }
564  foreach($a_types_in_block as $type)
565  {
566  if (in_array($type, $this->getDownloadableTypes()))
567  {
568  $this->renderSelectAllBlock($a_tpl);
569  break;
570  }
571  }
572  }
573 
574  if ($a_text == "" && $a_type != "")
575  {
576  if (!$objDefinition->isPlugin($a_type))
577  {
578  $title = $lng->txt("objs_".$a_type);
579  }
580  else
581  {
582  include_once("./Services/Component/classes/class.ilPlugin.php");
584  $title= $pl->txt("objs_".$a_type);
585  }
586  }
587  else
588  {
589  $title = $a_text;
590  }
591 
592  if ($ilSetting->get("icon_position_in_lists") != "item_rows" &&
593  $a_type != "")
594  {
595  $icon = ilUtil::getImagePath("icon_".$a_type.".svg");
596 
597  $a_tpl->setCurrentBlock("container_header_row_image");
598  $a_tpl->setVariable("HEADER_IMG", $icon);
599  $a_tpl->setVariable("HEADER_ALT", $title);
600  }
601  else
602  {
603  $a_tpl->setCurrentBlock("container_header_row");
604  }
605 
606  if($a_order_id)
607  {
608  $a_tpl->setVariable("BLOCK_HEADER_ORDER_NAME", "position[blocks][".$a_order_id."]");
609  $a_tpl->setVariable("BLOCK_HEADER_ORDER_NUM", (++$this->order_cnt)*10);
610  }
611 
612  $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
613  $a_tpl->setVariable("CHR_COMMANDS", $a_commands_html);
614  $a_tpl->parseCurrentBlock();
615 
616  $a_tpl->touchBlock("container_row");
617 
618  $this->resetRowType();
619  }
getDownloadableTypes()
Get downloadable repository object types.
$a_type
Definition: workflow.php:93
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:613
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
touchBlock($block)
overwrites ITX::touchBlock.
static getRepoPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin...
Create styles array
The data for the language used.
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
global $ilSetting
Definition: privfeed.php:17
global $lng
Definition: privfeed.php:17
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 219 of file class.ilContainerRenderer.php.

References array, hasItem(), and isValidBlock().

220  {
221  if($this->isValidBlock($a_block_id) &&
222  $a_item_type != "itgr" &&
223  (!$this->hasItem($a_item_id) || $a_force) &&
224  trim($a_item_html))
225  {
226  // #16563 - item_id (== ref_id) is NOT unique, adding parent block id
227  $uniq_id = $a_block_id.self::UNIQUE_SEPARATOR.$a_item_id;
228 
229  $this->items[$uniq_id] = array(
230  "type" => $a_item_type
231  ,"html" => $a_item_html
232  );
233 
234  // #18326
235  $this->item_ids[$a_item_id] = true;
236 
237  $this->block_items[$a_block_id][] = $uniq_id;
238  return true;
239  }
240  return false;
241  }
hasItem($a_id)
Item with id exists?
Create styles array
The data for the language used.
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 675 of file class.ilContainerRenderer.php.

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

Referenced by getHTML().

676  {
677  $a_tpl->setCurrentBlock("container_block");
678  $a_tpl->parseCurrentBlock();
679  }
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 628 of file class.ilContainerRenderer.php.

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

Referenced by renderHelperGeneric().

629  {
630  // :TODO: obsolete?
631  $this->cur_row_type = ($this->cur_row_type == "row_type_1")
632  ? "row_type_2"
633  : "row_type_1";
634 
635  if ($a_ref_id > 0)
636  {
637  $a_tpl->setCurrentBlock($this->cur_row_type);
638  $a_tpl->setVariable("ROW_ID", 'id="item_row_'.$a_ref_id.'"');
639  $a_tpl->parseCurrentBlock();
640  }
641  else
642  {
643  $a_tpl->touchBlock($this->cur_row_type);
644  }
645 
646  $a_tpl->setCurrentBlock("container_standard_row");
647  $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
648  $a_tpl->parseCurrentBlock();
649 
650  $a_tpl->touchBlock("container_row");
651  }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:613
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 69 of file class.ilContainerRenderer.php.

References $a_type, array, and hasTypeBlock().

70  {
71  if($a_type != "itgr" &&
72  !$this->hasTypeBlock($a_type))
73  {
74  $this->type_blocks[$a_type] = array(
75  "prefix" => $a_prefix
76  ,"postfix" => $a_postfix
77  );
78  return true;
79  }
80  return false;
81  }
$a_type
Definition: workflow.php:93
Create styles array
The data for the language used.
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 695 of file class.ilContainerRenderer.php.

References array.

Referenced by addHeaderRow().

696  {
697  return array("fold", "file");
698  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getHTML()

ilContainerRenderer::getHTML ( )

Get rendered html (of all blocks)

Returns
string

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

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

291  {
292  $valid = false;
293 
294  $block_tpl = $this->initBlockTemplate();
295 
296  foreach($this->processBlockPositions() as $block_id)
297  {
298  if(array_key_exists($block_id, $this->custom_blocks))
299  {
300  if($this->renderHelperCustomBlock($block_tpl, $block_id))
301  {
302  $this->addSeparatorRow($block_tpl);
303  $valid = true;
304  }
305  }
306  if(array_key_exists($block_id, $this->type_blocks))
307  {
308  if($this->renderHelperTypeBlock($block_tpl, $block_id))
309  {
310  $this->addSeparatorRow($block_tpl);
311  $valid = true;
312  }
313  }
314  }
315 
316  if($valid)
317  {
318  $this->renderDetails($block_tpl);
319 
320  return $block_tpl->get();
321  }
322  }
$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 121 of file class.ilContainerRenderer.php.

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

122  {
123  return array_key_exists($a_id, $this->custom_blocks);
124  }
+ 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 203 of file class.ilContainerRenderer.php.

Referenced by addItemToBlock(), and removeItem().

204  {
205  return (array_key_exists($a_id, $this->item_ids) ||
206  array_key_exists($a_id, $this->hidden_items));
207  }
+ 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 89 of file class.ilContainerRenderer.php.

References $a_type.

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

90  {
91  return array_key_exists($a_type, $this->type_blocks);
92  }
$a_type
Definition: workflow.php:93
+ 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 148 of file class.ilContainerRenderer.php.

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

◆ initBlockTemplate()

ilContainerRenderer::initBlockTemplate ( )
protected

Init template.

Returns
ilTemplate

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

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

530  {
531  // :TODO: obsolete?
532  $this->cur_row_type = "row_type_1";
533 
534  return new ilTemplate("tpl.container_list_block.html", true, true,
535  "Services/Container");
536  }
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 132 of file class.ilContainerRenderer.php.

References hasCustomBlock(), and hasTypeBlock().

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

133  {
134  return ($this->hasTypeBlock($a_id) ||
135  $this->hasCustomBlock($a_id));
136  }
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 366 of file class.ilContainerRenderer.php.

References $block_pos, array, and isValidBlock().

Referenced by getHTML().

367  {
368  // manual order
369  if(sizeof($this->block_custom_pos))
370  {
371  $tmp = $this->block_pos;
372  $this->block_pos = array();
373  foreach($this->block_custom_pos as $idx => $block_id)
374  {
375  if($this->isValidBlock($block_id))
376  {
377  $this->block_pos[$block_id] = $idx;
378  }
379  }
380 
381  // at least some manual are valid
382  if(sizeof($this->block_pos))
383  {
384  // append missing blocks from default order
385  $last = max($this->block_pos);
386  foreach(array_keys($tmp) as $block_id)
387  {
388  if(!array_key_exists($block_id, $this->block_pos))
389  {
390  $this->block_pos[$block_id] = ++$last;
391  }
392  }
393  }
394  // all manual invalid, use default
395  else
396  {
397  $this->block_pos = $tmp;
398  }
399  }
400 
401  // add missing blocks to order
402  $last = sizeof($this->block_pos)
403  ? max($this->block_pos)
404  : 0;
405  foreach(array_keys($this->custom_blocks) as $block_id)
406  {
407  if(!array_key_exists($block_id, $this->block_pos))
408  {
409  $this->block_pos[$block_id] = ++$last;
410  }
411  }
412  foreach(array_keys($this->type_blocks) as $block_id)
413  {
414  if(!array_key_exists($block_id, $this->block_pos))
415  {
416  $this->block_pos[$block_id] = ++$last;
417  }
418  }
419 
420  asort($this->block_pos);
421 
422  return array_keys($this->block_pos);
423  }
Create styles array
The data for the language used.
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 162 of file class.ilContainerRenderer.php.

References $items, and hasItem().

163  {
164  if(!$this->hasItem($a_id))
165  {
166  return;
167  }
168 
169  unset($this->item_ids[$a_id]);
170  unset($this->hidden_items[$a_id]);
171 
172  foreach(array_keys($this->items) as $item_id)
173  {
174  if(array_pop(explode(self::UNIQUE_SEPARATOR, $item_id)) == $a_id)
175  {
176  unset($this->items[$item_id]);
177  }
178  }
179 
180  foreach($this->block_items as $block_id => $items)
181  {
182  foreach($items as $idx => $item_id)
183  {
184  if(array_pop(explode(self::UNIQUE_SEPARATOR, $item_id)) == $a_id)
185  {
186  unset($this->block_items[$block_id][$idx]);
187  if(!sizeof($this->block_items[$block_id]))
188  {
189  unset($this->block_items[$block_id]);
190  }
191  break;
192  }
193  }
194  }
195  }
hasItem($a_id)
Item with id exists?
+ Here is the call graph for this function:

◆ renderDetails()

ilContainerRenderer::renderDetails ( ilTemplate  $a_tpl)

Render detail level.

Parameters
ilTemplate$a_tpl

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

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

Referenced by getHTML().

706  {
707  global $lng;
708 
709  if(sizeof($this->details))
710  {
711  $a_tpl->setCurrentBlock('container_details_row');
712  $a_tpl->setVariable('TXT_DETAILS', $lng->txt('details'));
713  $a_tpl->parseCurrentBlock();
714  }
715  }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:613
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
global $lng
Definition: privfeed.php:17
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 433 of file class.ilContainerRenderer.php.

References hasCustomBlock(), and renderHelperGeneric().

Referenced by getHTML(), and renderSingleCustomBlock().

434  {
435  if($this->hasCustomBlock($a_block_id))
436  {
437  return $this->renderHelperGeneric($a_block_tpl, $a_block_id, $this->custom_blocks[$a_block_id], $a_is_single);
438  }
439  return false;
440  }
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 471 of file class.ilContainerRenderer.php.

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

Referenced by renderHelperCustomBlock(), and renderHelperTypeBlock().

472  {
473  if(!in_array($a_block_id, $this->rendered_blocks))
474  {
475  $this->rendered_blocks[] = $a_block_id;
476 
477  $block_types = array();
478  if(is_array($this->block_items[$a_block_id]))
479  {
480  foreach($this->block_items[$a_block_id] as $item_id)
481  {
482  if(isset($this->items[$item_id]["type"]))
483  {
484  $block_types[] = $this->items[$item_id]["type"];
485  }
486  }
487  }
488 
489  // #14610 - manage empty item groups
490  if(is_array($this->block_items[$a_block_id]) ||
491  is_numeric($a_block_id))
492  {
493 
494  $order_id = (!$a_is_single && $this->active_block_ordering)
495  ? $a_block_id
496  : null;
497  $this->addHeaderRow($a_block_tpl, $a_block["type"], $a_block["caption"], array_unique($block_types), $a_block["actions"], $order_id);
498 
499  if($a_block["prefix"])
500  {
501  $this->addStandardRow($a_block_tpl, $a_block["prefix"]);
502  }
503 
504  if(is_array($this->block_items[$a_block_id]))
505  {
506  foreach($this->block_items[$a_block_id] as $item_id)
507  {
508  $this->addStandardRow($a_block_tpl, $this->items[$item_id]["html"], $item_id);
509  }
510  }
511 
512  if($a_block["postfix"])
513  {
514  $this->addStandardRow($a_block_tpl, $a_block["postfix"]);
515  }
516 
517  return true;
518  }
519  }
520 
521  return false;
522  }
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.
Create styles array
The data for the language used.
+ 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 450 of file class.ilContainerRenderer.php.

References $a_type, hasTypeBlock(), and renderHelperGeneric().

Referenced by getHTML(), and renderSingleTypeBlock().

451  {
452  if($this->hasTypeBlock($a_type))
453  {
454  $block = $this->type_blocks[$a_type];
455  $block["type"] = $a_type;
456 
457  return $this->renderHelperGeneric($a_block_tpl, $a_type, $block, $a_is_single);
458  }
459  return false;
460  }
$a_type
Definition: workflow.php:93
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 658 of file class.ilContainerRenderer.php.

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

Referenced by addHeaderRow().

659  {
660  global $lng;
661 
662  $a_tpl->setCurrentBlock("select_all_row");
663  $a_tpl->setVariable("CHECKBOXNAME", "bl_cb_".$this->bl_cnt);
664  $a_tpl->setVariable("SEL_ALL_PARENT", "bl_cntr_".$this->bl_cnt);
665  $a_tpl->setVariable("SEL_ALL_PARENT", "bl_cntr_".$this->bl_cnt);
666  $a_tpl->setVariable("TXT_SELECT_ALL", $lng->txt("select_all"));
667  $a_tpl->parseCurrentBlock();
668  }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:613
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
global $lng
Definition: privfeed.php:17
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 346 of file class.ilContainerRenderer.php.

References initBlockTemplate(), and renderHelperCustomBlock().

347  {
348  $block_tpl = $this->initBlockTemplate();
349 
350  if($this->renderHelperCustomBlock($block_tpl, $a_id, true))
351  {
352  return $block_tpl->get();
353  }
354  }
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 330 of file class.ilContainerRenderer.php.

References $a_type, initBlockTemplate(), and renderHelperTypeBlock().

331  {
332  $block_tpl = $this->initBlockTemplate();
333 
334  if($this->renderHelperTypeBlock($block_tpl, $a_type, true))
335  {
336  return $block_tpl->get();
337  }
338  }
$a_type
Definition: workflow.php:93
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 261 of file class.ilContainerRenderer.php.

References array.

262  {
263  $this->details = array();
264  }
Create styles array
The data for the language used.

◆ resetRowType()

ilContainerRenderer::resetRowType ( )
protected

Reset internal row type.

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

Referenced by addHeaderRow().

685  {
686  // :TODO: obsolete?
687  $this->cur_row_type = "";
688  }
+ 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 277 of file class.ilContainerRenderer.php.

References isValidBlock().

278  {
279  if($this->isValidBlock($a_block_id))
280  {
281  $this->block_pos[$a_block_id] = $a_pos;
282  }
283  }
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 16 of file class.ilContainerRenderer.php.

Referenced by renderHelperGeneric().

◆ $bl_cnt

ilContainerRenderer::$bl_cnt = 0
protected

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

◆ $block_custom_pos

ilContainerRenderer::$block_custom_pos = array()
protected

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

◆ $block_items

ilContainerRenderer::$block_items = array()
protected

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

◆ $block_pos

ilContainerRenderer::$block_pos = array()
protected

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

Referenced by processBlockPositions().

◆ $cur_row_type

ilContainerRenderer::$cur_row_type
protected

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

◆ $custom_blocks

ilContainerRenderer::$custom_blocks = array()
protected

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

◆ $details

ilContainerRenderer::$details = array()
protected

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

◆ $enable_manage_select_all

ilContainerRenderer::$enable_manage_select_all
protected

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

◆ $enable_multi_download

ilContainerRenderer::$enable_multi_download
protected

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

◆ $hidden_items

ilContainerRenderer::$hidden_items = array()
protected

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

◆ $item_ids

ilContainerRenderer::$item_ids = array()
protected

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

◆ $items

ilContainerRenderer::$items = array()
protected

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

Referenced by removeItem().

◆ $order_cnt

ilContainerRenderer::$order_cnt = 0
protected

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

◆ $rendered_blocks

ilContainerRenderer::$rendered_blocks = array()
protected

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

◆ $type_blocks

ilContainerRenderer::$type_blocks = array()
protected

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

◆ UNIQUE_SEPARATOR

const ilContainerRenderer::UNIQUE_SEPARATOR = "-"

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


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