|
1 <?php |
|
2 /** |
|
3 * Zend Framework |
|
4 * |
|
5 * LICENSE |
|
6 * |
|
7 * This source file is subject to the new BSD license that is bundled |
|
8 * with this package in the file LICENSE.txt. |
|
9 * It is also available through the world-wide-web at this URL: |
|
10 * http://framework.zend.com/license/new-bsd |
|
11 * If you did not receive a copy of the license and are unable to |
|
12 * obtain it through the world-wide-web, please send an email |
|
13 * to license@zend.com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_Tool |
|
17 * @subpackage Framework |
|
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
20 * @version $Id: LayoutScriptFile.php 20785 2010-01-31 09:43:03Z mikaelkael $ |
|
21 */ |
|
22 |
|
23 /** |
|
24 * @see Zend_Tool_Project_Context_Filesystem_File |
|
25 */ |
|
26 require_once 'Zend/Tool/Project/Context/Filesystem/File.php'; |
|
27 |
|
28 /** |
|
29 * This class is the front most class for utilizing Zend_Tool_Project |
|
30 * |
|
31 * A profile is a hierarchical set of resources that keep track of |
|
32 * items within a specific project. |
|
33 * |
|
34 * @category Zend |
|
35 * @package Zend_Tool |
|
36 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
37 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
38 */ |
|
39 class Zend_Tool_Project_Context_Zf_LayoutScriptFile extends Zend_Tool_Project_Context_Filesystem_File |
|
40 { |
|
41 |
|
42 /** |
|
43 * @var string |
|
44 */ |
|
45 protected $_filesystemName = 'layout.phtml'; |
|
46 |
|
47 /** |
|
48 * @var string |
|
49 */ |
|
50 protected $_layoutName = null; |
|
51 |
|
52 /** |
|
53 * getName() |
|
54 * |
|
55 * @return string |
|
56 */ |
|
57 public function getName() |
|
58 { |
|
59 return 'LayoutScriptFile'; |
|
60 } |
|
61 |
|
62 /** |
|
63 * init() |
|
64 * |
|
65 * @return Zend_Tool_Project_Context_Zf_ViewScriptFile |
|
66 */ |
|
67 public function init() |
|
68 { |
|
69 if ($layoutName = $this->_resource->getAttribute('layoutName')) { |
|
70 $this->_layoutName = $layoutName; |
|
71 } else { |
|
72 throw new Exception('Either a forActionName or scriptName is required.'); |
|
73 } |
|
74 |
|
75 parent::init(); |
|
76 return $this; |
|
77 } |
|
78 |
|
79 /** |
|
80 * getPersistentAttributes() |
|
81 * |
|
82 * @return unknown |
|
83 */ |
|
84 public function getPersistentAttributes() |
|
85 { |
|
86 $attributes = array(); |
|
87 |
|
88 if ($this->_layoutName) { |
|
89 $attributes['layoutName'] = $this->_layoutName; |
|
90 } |
|
91 |
|
92 return $attributes; |
|
93 } |
|
94 |
|
95 /** |
|
96 * getContents() |
|
97 * |
|
98 * @return string |
|
99 */ |
|
100 public function getContents() |
|
101 { |
|
102 $contents = <<<EOS |
|
103 <?php echo \$this->layout()->content; ?> |
|
104 EOS; |
|
105 |
|
106 return $contents; |
|
107 } |
|
108 |
|
109 } |