00001 <?php
00002
00003
00004
00005
00006
00007
00008 class RendererChain implements IRenderer {
00009
00010
00011
00012
00013
00014 protected $page_data = null;
00015
00016
00017
00018
00019
00020
00021 protected $chain_root = null;
00022
00023
00024
00025
00026
00027
00028
00029 public function __construct($page_data, $arr_decorators) {
00030 $this->page_data = $page_data;
00031 $this->chain_root = new RenderDecoratorBase();
00032 foreach($arr_decorators as $decorator) {
00033 if ($decorator instanceof IRenderDecorator) {
00034 $this->chain_root->append($decorator);
00035 }
00036 }
00037 }
00038
00039
00040
00041
00042
00043
00044
00045 public function render($policy = self::NONE) {
00046 $this->chain_root->initialize($this->page_data);
00047 return $this->chain_root->render_page($this->page_data, $this->chain_root, $policy);
00048 }
00049 }