File indexing completed on 2024-06-23 05:55:51

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Tool
0017  * @subpackage Framework
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 /**
0024  * @see Zend_Tool_Project_Context_Filesystem_File
0025  */
0026 // require_once 'Zend/Tool/Project/Context/Filesystem/File.php';
0027 
0028 /**
0029  * This class is the front most class for utilizing Zend_Tool_Project
0030  *
0031  * A profile is a hierarchical set of resources that keep track of
0032  * items within a specific project.
0033  *
0034  * @category   Zend
0035  * @package    Zend_Tool
0036  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0037  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0038  */
0039 class Zend_Tool_Project_Context_Zf_LayoutScriptFile extends Zend_Tool_Project_Context_Filesystem_File
0040 {
0041 
0042     /**
0043      * @var string
0044      */
0045     protected $_filesystemName = 'layout.phtml';
0046 
0047     /**
0048      * @var string
0049      */
0050     protected $_layoutName = null;
0051 
0052     /**
0053      * getName()
0054      *
0055      * @return string
0056      */
0057     public function getName()
0058     {
0059         return 'LayoutScriptFile';
0060     }
0061 
0062     /**
0063      * init()
0064      *
0065      * @return Zend_Tool_Project_Context_Zf_ViewScriptFile
0066      */
0067     public function init()
0068     {
0069         if ($layoutName = $this->_resource->getAttribute('layoutName')) {
0070             $this->_layoutName = $layoutName;
0071         } else {
0072             throw new Exception('Either a forActionName or scriptName is required.');
0073         }
0074 
0075         parent::init();
0076         return $this;
0077     }
0078 
0079     /**
0080      * getPersistentAttributes()
0081      *
0082      * @return unknown
0083      */
0084     public function getPersistentAttributes()
0085     {
0086         $attributes = array();
0087 
0088         if ($this->_layoutName) {
0089             $attributes['layoutName'] = $this->_layoutName;
0090         }
0091 
0092         return $attributes;
0093     }
0094 
0095     /**
0096      * getContents()
0097      *
0098      * @return string
0099      */
0100     public function getContents()
0101     {
0102         $contents = <<<EOS
0103 <?php echo \$this->layout()->content; ?>
0104 EOS;
0105 
0106         return $contents;
0107     }
0108 
0109 }