3require_once(
'./Services/Repository/classes/class.ilObjectPlugin.php');
 
   82    public function __construct($a_enable_manage_select_all = 
false, $a_enable_multi_download = 
false, $a_active_block_ordering = 
false, $a_block_custom_positions, $container_gui_obj, $a_view_mode =
 
   87        $this->lng = 
$DIC->language();
 
   89        $this->ui = 
$DIC->ui();
 
   90        $this->obj_definition = 
$DIC[
"objDefinition"];
 
   91        $this->enable_manage_select_all = (bool) $a_enable_manage_select_all;
 
   92        $this->enable_multi_download = (bool) $a_enable_multi_download;
 
   93        $this->active_block_ordering = (bool) $a_active_block_ordering;
 
   94        $this->block_custom_pos = $a_block_custom_positions;
 
   95        $this->view_mode = $a_view_mode;
 
   96        $this->container_gui = $container_gui_obj;
 
   97        $this->ctrl = 
$DIC->ctrl();
 
  124            $this->type_blocks[
$a_type] = array(
 
  125                "prefix" => $a_prefix
 
  126                ,
"postfix" => $a_postfix
 
  141        return array_key_exists(
$a_type, $this->type_blocks);
 
  152    public function addCustomBlock($a_id, $a_caption, $a_actions = 
null, $a_data = array())
 
  155            $this->custom_blocks[$a_id] = array(
 
  156                "caption" => $a_caption
 
  157                ,
"actions" => $a_actions
 
  173        return array_key_exists($a_id, $this->custom_blocks);
 
  201        $this->hidden_items[$a_id] = 
true;
 
  218        unset($this->item_ids[$a_id]);
 
  219        unset($this->hidden_items[$a_id]);
 
  221        foreach (array_keys($this->items) as $item_id) {
 
  222            if (array_pop(explode(self::UNIQUE_SEPARATOR, $item_id)) == $a_id) {
 
  223                unset($this->items[$item_id]);
 
  227        foreach ($this->block_items as $block_id => 
$items) {
 
  228            foreach (
$items as $idx => $item_id) {
 
  229                if (array_pop(explode(self::UNIQUE_SEPARATOR, $item_id)) == $a_id) {
 
  230                    unset($this->block_items[$block_id][$idx]);
 
  231                    if (!
sizeof($this->block_items[$block_id])) {
 
  232                        unset($this->block_items[$block_id]);
 
  248        return (array_key_exists($a_id, $this->item_ids) ||
 
  249            array_key_exists($a_id, $this->hidden_items));
 
  262    public function addItemToBlock($a_block_id, $a_item_type, $a_item_id, $a_item_html, $a_force = 
false)
 
  265            $a_item_type != 
"itgr" &&
 
  266            (!$this->
hasItem($a_item_id) || $a_force)) {
 
  267            if (is_string($a_item_html) && trim($a_item_html) == 
"") {
 
  276            $uniq_id = $a_block_id . self::UNIQUE_SEPARATOR . $a_item_id;
 
  278            $this->items[$uniq_id] = array(
 
  279                "type" => $a_item_type
 
  280                ,
"html" => $a_item_html
 
  284            $this->item_ids[$a_item_id] = 
true;
 
  286            $this->block_items[$a_block_id][] = $uniq_id;
 
  297        $this->show_more[] = $a_block_id;
 
  309        $this->details[$a_level] = array(
 
  311            ,
"active" => (
bool) $a_active
 
  320        $this->details = array();
 
  337            $this->block_pos[$a_block_id] = $a_pos;
 
  353            if (array_key_exists($block_id, $this->custom_blocks)) {
 
  359            if (array_key_exists($block_id, $this->type_blocks)) {
 
  370            return $block_tpl->get();
 
  385            return $block_tpl->get();
 
  400            return $block_tpl->get();
 
  417        if (is_array($this->block_custom_pos) && 
sizeof($this->block_custom_pos)) {
 
  419            $this->block_pos = array();
 
  420            foreach ($this->block_custom_pos as $idx => $block_id) {
 
  422                    $this->block_pos[$block_id] = $idx;
 
  427            if (
sizeof($this->block_pos)) {
 
  429                $last = max($this->block_pos);
 
  430                foreach (array_keys($tmp) as $block_id) {
 
  431                    if (!array_key_exists($block_id, $this->block_pos)) {
 
  432                        $this->block_pos[$block_id] = ++$last;
 
  438                $this->block_pos = $tmp;
 
  444            ? max($this->block_pos)
 
  446        foreach (array_keys($this->custom_blocks) as $block_id) {
 
  447            if (!array_key_exists($block_id, $this->block_pos)) {
 
  448                $this->block_pos[$block_id] = ++$last;
 
  451        foreach (array_keys($this->type_blocks) as $block_id) {
 
  452            if (!array_key_exists($block_id, $this->block_pos)) {
 
  453                $this->block_pos[$block_id] = ++$last;
 
  457        asort($this->block_pos);
 
  459        return array_keys($this->block_pos);
 
  473            return $this->
renderHelperGeneric($a_block_tpl, $a_block_id, $this->custom_blocks[$a_block_id], $a_is_single);
 
  489            $block = $this->type_blocks[
$a_type];
 
  508        if (!in_array($a_block_id, $this->rendered_blocks)) {
 
  509            $this->rendered_blocks[] = $a_block_id;
 
  511            $block_types = array();
 
  512            if (is_array($this->block_items[$a_block_id])) {
 
  513                foreach ($this->block_items[$a_block_id] as $item_id) {
 
  514                    if (isset($this->items[$item_id][
"type"])) {
 
  515                        $block_types[] = $this->items[$item_id][
"type"];
 
  521            if (is_array($this->block_items[$a_block_id]) ||
 
  522                is_numeric($a_block_id)) {
 
  528                $this->
addHeaderRow($a_block_tpl, $a_block[
"type"], $a_block[
"caption"], array_unique($block_types), $a_block[
"actions"], $order_id, $a_block[
"data"]);
 
  531                    if ($a_block[
"prefix"]) {
 
  536                if (is_array($this->block_items[$a_block_id])) {
 
  537                    foreach ($this->block_items[$a_block_id] as $item_id) {
 
  539                            $this->
addStandardRow($a_block_tpl, $this->items[$item_id][
"html"], $item_id);
 
  541                            $cards[] = $this->items[$item_id][
"html"];
 
  547                    if ($a_block[
"postfix"]) {
 
  553                    $f = $this->ui->factory();
 
  554                    $renderer = $this->ui->renderer();
 
  557                    $deck = 
$f->deck($cards)->withNormalCardsSize();
 
  561                    $html = $renderer->render($deck);
 
  568                if (in_array($a_block_id, $this->show_more)) {
 
  571                    $ctrl->setParameter($this->container_gui, 
"type", $a_block_id);
 
  572                    $url = 
$ctrl->getLinkTarget($this->container_gui, 
"renderBlockAsynch", 
"", 
true);
 
  573                    $ctrl->setParameter($this->container_gui, 
"type", 
"");
 
  575                    $f = $this->ui->factory();
 
  576                    $renderer = $this->ui->renderer();
 
  577                    $button = 
$f->button()->standard($this->lng->txt(
"cont_show_more"), 
"")
 
  578                        ->withLoadingAnimationOnClick(
true)
 
  579                        ->withOnLoadCode(
function (
$id) use ($a_block_id, 
$url) {
 
  580                            return "il.Container.initShowMore('$id', '$a_block_id', '" . 
$url . 
"');";
 
  582                    if (
$ctrl->isAsynch()) {
 
  583                        $a_block_tpl->
setVariable(
"SHOW_MORE_BUTTON", $renderer->renderAsync($button));
 
  585                        $a_block_tpl->
setVariable(
"SHOW_MORE_BUTTON", $renderer->render($button));
 
  607        $this->cur_row_type = 
"row_type_1";
 
  609        return new ilTemplate(
"tpl.container_list_block.html", 
true, 
true, 
"Services/Container");
 
  622    protected function addHeaderRow(
ilTemplate $a_tpl, 
$a_type = 
"", $a_text = 
"", array $a_types_in_block = 
null, $a_commands_html = 
null, $a_order_id = 
null, $a_data = array())
 
  628        $a_tpl->
setVariable(
"CB_ID", 
' id="bl_cntr_' . (++$this->bl_cnt) . 
'"');
 
  630        if ($this->enable_manage_select_all) {
 
  632        } elseif ($this->enable_multi_download) {
 
  634                $a_types_in_block = array(
$a_type);
 
  636            foreach ($a_types_in_block as 
$type) {
 
  644        if ($a_text == 
"" && 
$a_type != 
"") {
 
  645            if (!$objDefinition->isPlugin(
$a_type)) {
 
  648                include_once(
"./Services/Component/classes/class.ilPlugin.php");
 
  656        include_once(
"./Modules/ItemGroup/classes/class.ilItemGroupBehaviour.php");
 
  657        if (is_array($a_data)) {
 
  658            foreach ($a_data as $k => $v) {
 
  670        if (
$ilSetting->get(
"icon_position_in_lists") != 
"item_rows" &&
 
  682            $a_tpl->
setVariable(
"BLOCK_HEADER_ORDER_NAME", 
"position[blocks][" . $a_order_id . 
"]");
 
  683            $a_tpl->
setVariable(
"BLOCK_HEADER_ORDER_NUM", (++$this->order_cnt) * 10);
 
  687        $a_tpl->
setVariable(
"CHR_COMMANDS", $a_commands_html);
 
  705        $this->cur_row_type = ($this->cur_row_type == 
"row_type_1")
 
  711            $a_tpl->
setVariable(
"ROW_ID", 
'id="item_row_' . $a_ref_id . 
'"');
 
  732        $a_tpl->
setVariable(
"CHECKBOXNAME", 
"bl_cb_" . $this->bl_cnt);
 
  733        $a_tpl->
setVariable(
"SEL_ALL_PARENT", 
"bl_cntr_" . $this->bl_cnt);
 
  734        $a_tpl->
setVariable(
"SEL_ALL_PARENT", 
"bl_cntr_" . $this->bl_cnt);
 
  756        $this->cur_row_type = 
"";
 
  766        return array(
"fold", 
"file");
 
  778        if (
sizeof($this->details)) {
 
An exception for terminatinating execution or to throw for unit testing.
setVariable($variable, $value='')
Sets a variable value.
Class ilContainerRenderer.
removeItem($a_id)
Remove item (from any block)
$enable_manage_select_all
getDownloadableTypes()
Get downloadable repository object types.
renderHelperGeneric(ilTemplate $a_block_tpl, $a_block_id, array $a_block, $a_is_single=false)
Render block.
renderHelperTypeBlock(ilTemplate $a_block_tpl, $a_type, $a_is_single=false)
Render type block.
resetRowType()
Reset internal row type.
addTypeBlock($a_type, $a_prefix=null, $a_postfix=null)
Add type block.
addItemToBlock($a_block_id, $a_item_type, $a_item_id, $a_item_html, $a_force=false)
Add item to existing block.
initBlockTemplate()
Init template.
renderSingleCustomBlock($a_id)
Get rendered html of single custom block.
addDetailsLevel($a_level, $a_url, $a_active=false)
Add details level.
hideItem($a_id)
Mark item id as used, but do not render.
getViewMode()
Get view mode.
getHTML()
Get rendered html (of all blocks)
addHeaderRow(ilTemplate $a_tpl, $a_type="", $a_text="", array $a_types_in_block=null, $a_commands_html=null, $a_order_id=null, $a_data=array())
Render block header.
hasCustomBlock($a_id)
Custom block already exists?
hasTypeBlock($a_type)
Type block already exists?
renderHelperCustomBlock(ilTemplate $a_block_tpl, $a_block_id, $a_is_single=false)
Render custom block.
addStandardRow(ilTemplate $a_tpl, $a_html, $a_ref_id=0)
Render item row.
addShowMoreButton($a_block_id)
Add show more button to a block.
hasItem($a_id)
Item with id exists?
renderSingleTypeBlock($a_type)
Get rendered html of single type block.
renderSelectAllBlock(ilTemplate $a_tpl)
Render "select all".
setBlockPosition($a_block_id, $a_pos)
Set block position.
addSeparatorRow(ilTemplate $a_tpl)
Render separator row.
processBlockPositions()
Process block positions.
resetDetails()
Reset/remove all detail levels.
renderDetails(ilTemplate $a_tpl)
Render detail level.
isValidBlock($a_id)
Any block with id exists?
addCustomBlock($a_id, $a_caption, $a_actions=null, $a_data=array())
Add custom block.
__construct($a_enable_manage_select_all=false, $a_enable_multi_download=false, $a_active_block_ordering=false, $a_block_custom_positions, $container_gui_obj, $a_view_mode=ilContainerContentGUI::VIEW_MODE_LIST)
Constructor.
static getPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin.
special template class to simplify handling of ITX/PEAR
touchBlock($block)
overwrites ITX::touchBlock.
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt @access public.
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
if(!array_key_exists('StateId', $_REQUEST)) $id