/** * Show blocks. */ function showBlocks() { global $ilCtrl, $lng, $ilUser, $ilBench; $i = 1; $sum_moveable = count($this->blocks[$this->getSide()]); foreach ($this->blocks[$this->getSide()] as $block) { if ($ilCtrl->getContextObjType() != "user" || ilBlockSetting::_lookupDetailLevel($block["type"], $ilUser->getId(), $block["id"]) > 0) { $gui_class = $block["class"]; $block_class = substr($block["class"], 0, strlen($block["class"]) - 3); // get block gui class include_once "./" . self::$locations[$gui_class] . "classes/" . "class." . $gui_class . ".php"; $ilBench->start("Column", "instantiate-" . $block["type"]); $block_gui = new $gui_class(); $ilBench->stop("Column", "instantiate-" . $block["type"]); if (isset($this->block_property[$block["type"]])) { $block_gui->setProperties($this->block_property[$block["type"]]); } $block_gui->setRepositoryMode($this->getRepositoryMode()); $block_gui->setEnableEdit($this->getEnableEdit()); $block_gui->setAdminCommands($this->getAdminCommands()); // get block for custom blocks if ($block["custom"]) { include_once "./" . self::$locations[$gui_class] . "classes/" . "class." . $block_class . ".php"; $app_block = new $block_class($block["id"]); $block_gui->setBlock($app_block); if (isset($block["ref_id"])) { $block_gui->setRefId($block["ref_id"]); } } $ilCtrl->setParameter($this, "block_type", $block_gui->getBlockType()); $this->tpl->setCurrentBlock("col_block"); $ilBench->start("Column", "showBlocks-" . $block_gui->getBlockType()); $html = $ilCtrl->getHTML($block_gui); $ilBench->stop("Column", "showBlocks-" . $block_gui->getBlockType()); // dummy block, if non visible, but movement is ongoing if ($html == "" && $this->getRepositoryMode() && $this->getMovementMode()) { include_once "./Services/Block/classes/class.ilDummyBlockGUI.php"; $bl = new ilDummyBlockGUI(); $bl->setBlockId($block["id"]); $bl->setBlockType($block["type"]); $bl->setTitle($lng->txt("invisible_block")); $bl->setConfigMode($this->getMovementMode()); $html = $bl->getHTML(); } // don't render a block if it's empty if ($html != "") { $this->tpl->setVariable("BLOCK", $html); $this->tpl->parseCurrentBlock(); $ilCtrl->setParameter($this, "block_type", ""); } // count (moveable) blocks if ($block["type"] != "pdsysmess" && $block["type"] != "pdfeedb" && $block["type"] != "news") { $i++; } else { $sum_moveable--; } } } }
/** * Set block type * * @return string Block type. */ static function setBlockType($a_type) { self::$block_type = $a_type; }