equal
deleted
inserted
replaced
13 * to license@zend.com so we can send you a copy immediately. |
13 * to license@zend.com so we can send you a copy immediately. |
14 * |
14 * |
15 * @category Zend |
15 * @category Zend |
16 * @package Zend_Tool |
16 * @package Zend_Tool |
17 * @subpackage Framework |
17 * @subpackage Framework |
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
20 * @version $Id: ViewScriptFile.php 23343 2010-11-15 15:33:22Z ramon $ |
20 * @version $Id: ViewScriptFile.php 24593 2012-01-05 20:35:02Z matthew $ |
21 */ |
21 */ |
22 |
22 |
23 /** |
23 /** |
24 * @see Zend_Tool_Project_Context_Filesystem_File |
24 * @see Zend_Tool_Project_Context_Filesystem_File |
25 */ |
25 */ |
47 * A profile is a hierarchical set of resources that keep track of |
47 * A profile is a hierarchical set of resources that keep track of |
48 * items within a specific project. |
48 * items within a specific project. |
49 * |
49 * |
50 * @category Zend |
50 * @category Zend |
51 * @package Zend_Tool |
51 * @package Zend_Tool |
52 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
52 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
53 * @license http://framework.zend.com/license/new-bsd New BSD License |
53 * @license http://framework.zend.com/license/new-bsd New BSD License |
54 */ |
54 */ |
55 class Zend_Tool_Project_Context_Zf_ViewScriptFile extends Zend_Tool_Project_Context_Filesystem_File |
55 class Zend_Tool_Project_Context_Zf_ViewScriptFile extends Zend_Tool_Project_Context_Filesystem_File |
56 { |
56 { |
57 |
57 |
128 */ |
128 */ |
129 public function getContents() |
129 public function getContents() |
130 { |
130 { |
131 $contents = ''; |
131 $contents = ''; |
132 |
132 |
|
133 $controllerName = $this->_resource->getParentResource()->getAttribute('forControllerName'); |
|
134 |
|
135 $viewsDirectoryResource = $this->_resource |
|
136 ->getParentResource() // view script |
|
137 ->getParentResource() // view controller dir |
|
138 ->getParentResource(); // views dir |
|
139 if ($viewsDirectoryResource->getParentResource()->getName() == 'ModuleDirectory') { |
|
140 $moduleName = $viewsDirectoryResource->getParentResource()->getModuleName(); |
|
141 } else { |
|
142 $moduleName = 'default'; |
|
143 } |
|
144 |
133 if ($this->_filesystemName == 'error.phtml') { // should also check that the above directory is forController=error |
145 if ($this->_filesystemName == 'error.phtml') { // should also check that the above directory is forController=error |
134 $contents .= <<<EOS |
146 $contents .= <<<EOS |
135 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
147 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
136 <html xmlns="http://www.w3.org/1999/xhtml"> |
148 <html xmlns="http://www.w3.org/1999/xhtml"> |
137 <head> |
149 <head> |
141 <body> |
153 <body> |
142 <h1>An error occurred</h1> |
154 <h1>An error occurred</h1> |
143 <h2><?php echo \$this->message ?></h2> |
155 <h2><?php echo \$this->message ?></h2> |
144 |
156 |
145 <?php if (isset(\$this->exception)): ?> |
157 <?php if (isset(\$this->exception)): ?> |
146 |
158 |
147 <h3>Exception information:</h3> |
159 <h3>Exception information:</h3> |
148 <p> |
160 <p> |
149 <b>Message:</b> <?php echo \$this->exception->getMessage() ?> |
161 <b>Message:</b> <?php echo \$this->exception->getMessage() ?> |
150 </p> |
162 </p> |
151 |
163 |
152 <h3>Stack trace:</h3> |
164 <h3>Stack trace:</h3> |
153 <pre><?php echo \$this->exception->getTraceAsString() ?> |
165 <pre><?php echo \$this->exception->getTraceAsString() ?> |
154 </pre> |
166 </pre> |
155 |
167 |
156 <h3>Request Parameters:</h3> |
168 <h3>Request Parameters:</h3> |
157 <pre><?php echo var_export(\$this->request->getParams(), true) ?> |
169 <pre><?php echo \$this->escape(var_export(\$this->request->getParams(), true)) ?> |
158 </pre> |
170 </pre> |
|
171 |
159 <?php endif ?> |
172 <?php endif ?> |
160 |
173 |
161 </body> |
174 </body> |
162 </html> |
175 </html> |
163 |
176 |
164 EOS; |
177 EOS; |
165 } elseif ($this->_forActionName == 'index' && $this->_resource->getParentResource()->getAttribute('forControllerName') == 'Index') { |
178 } elseif ($this->_forActionName == 'index' && $controllerName == 'Index' && $moduleName == 'default') { |
166 |
179 |
167 $contents =<<<EOS |
180 $contents =<<<EOS |
168 <style> |
181 <style> |
169 a:link, |
182 a:link, |
170 a:visited |
183 a:visited |
209 </div> |
222 </div> |
210 </div> |
223 </div> |
211 EOS; |
224 EOS; |
212 |
225 |
213 } else { |
226 } else { |
214 $contents = '<br /><br /><center>View script for controller <b>' . $this->_resource->getParentResource()->getAttribute('forControllerName') . '</b>' |
227 $controllerName = $this->_resource->getParentResource()->getAttribute('forControllerName'); |
215 . ' and script/action name <b>' . $this->_forActionName . '</b></center>'; |
228 $actionName = $this->_forActionName; |
|
229 $contents = <<<EOS |
|
230 <br /><br /> |
|
231 <div id="view-content"> |
|
232 <p>View script for controller <b>$controllerName</b> and script/action name <b>$actionName</b></p> |
|
233 </div> |
|
234 EOS; |
216 } |
235 } |
217 return $contents; |
236 return $contents; |
218 } |
237 } |
219 |
238 |
220 protected function _convertActionNameToFilesystemName($actionName) |
239 protected function _convertActionNameToFilesystemName($actionName) |