function Render() { $result = ''; $item = $this->first; while ($item) { $renderer = new ContentRenderer($item, $this->tree); $result .= $renderer->Render(); $item = $this->tree->NextOf($item); } return $result; }
/** * Creates a new content renderer * @param mixed $item The tree item * @param IContentTreeProvider $tree */ function __construct($item, IContentTreeProvider $tree) { $this->item = $item; $this->tree = $tree; $this->content = $tree->ContentByItem($item); }
/** * Sets tree and tree item * @param IContentTreeProvider $tree * @param mixed $item The tree item containing the render content */ public function SetTreeItem(IContentTreeProvider $tree, $item) { $this->tree = $tree; $this->item = $item; $this->content = $this->tree->ContentByItem($item); }