* @package projBop.Ethna * @version $Id$ */ /** * Layoutに対応したViewClass * * @author BoBpp < bobpp@users.sourceforge.jp > * @package projBop.Ethna * @version 0.1 */ class projBop_Layout_ViewClass extends Ethna_ViewClass { /** @var string 使用するLayout名 */ var $_layout = null; /** @var string Layoutがあるディレクトリ */ var $_layout_dir = null; /** * Layoutファイルがあるディレクトリを指定する * * @access public * @param string $dir ディレクトリ名 */ function setLayoutDirectory($dir) { $this->_layout_dir = $dir; } /** * Layoutファイルがあるディレクトリを取得する * * @access private * @return string ディレクトリ */ function _getLayoutDirectory() { // メソッドによる指定が無い場合 if ($this->_layout_dir === null) { $c =& Ethna_Controller::getInstance(); $this->_layout_dir = $c->getTemplatedir() . "/layout/"; } return $this->_layout_dir; } /** * Layoutを指定する * * @access public * @param string $name レイアウト名 */ function setLayout($name) { $this->_layout = $name; } /** * Layoutのパスを取得する * * @access private * @return string パス */ function _getLayoutPath() { return $this->_getLayoutDirectory() . $this->_layout . ".tpl"; } /** * Layoutを用いて遷移名に対応した画面を出力する * * @access public */ function forward() { // Layout利用時 if ($this->_layout !== null) { $this->af->setApp('contents_tpl_path', $this->forward_path); $this->forward_path = $this->_getLayoutPath(); } // Ethna_ViewClass による出力処理 parent::forward(); } } ?>