contributions/page.blocks/controller/base/templated.parameterized.block.cls.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * A block that renders itself from a template and can be passed parameters 00004 * 00005 * The block instance is available as $block within the template. So you may change title or 00006 * name like this: 00007 * 00008 * @code 00009 * $block->set_title('New title'); 00010 * $block->set_name('newname'); 00011 * @endcode 00012 * 00013 * @ingroup Blocks 00014 * @author Gerd Riesselmann 00015 */ 00016 class TemplatedParameterizedBlock extends TemplatedBlock { 00017 protected $params = array(); 00018 00019 /** 00020 * Constructor 00021 * 00022 * @param string $name The name of this block. Used as class, too 00023 * @param string $title The title of the block. Displayed as heading, e.g. 00024 * @param string $template The template to render 00025 * @param array $params Assoziative array that gets passed to the view 00026 * @param integer $index The block's index. A block with lowest index will be displayed first 00027 * @param enum $position Where the block is to be displayed. 00028 */ 00029 public function __construct($name, $title, $template, $params, $index = 1000, $position = self::LEFT) { 00030 $this->params = $params; 00031 parent::__construct($name, $title, $template, $index, $position); 00032 } 00033 00034 /** 00035 * Configure the view 00036 * 00037 * @param IView $view 00038 */ 00039 protected function configure_view($view) { 00040 $view->assign_array($this->params); 00041 } 00042 }