2012-11-19 15:53:10 +00:00
|
|
|
<?php
|
2011-08-18 15:23:25 +00:00
|
|
|
class Zend_View_Helper_JavascriptHelper extends Zend_View_Helper_Abstract
|
2012-11-19 15:53:10 +00:00
|
|
|
{
|
|
|
|
function javascriptHelper()
|
|
|
|
{
|
2011-08-18 15:23:25 +00:00
|
|
|
$request = Zend_Controller_Front::getInstance()->getRequest();
|
2012-11-19 15:53:10 +00:00
|
|
|
|
|
|
|
$controller = $request->getControllerName();
|
|
|
|
$action = $request->getActionName();
|
|
|
|
|
|
|
|
$paramsTheme = Zend_Registry::get('theme');
|
|
|
|
|
|
|
|
$fileController = APPLICATION_PATH . '/../public/' .
|
|
|
|
$paramsTheme->pathScript . '/' . $controller . '.js';
|
|
|
|
if ( file_exists($fileController) ) {
|
|
|
|
$contentScript = file_get_contents($fileController);
|
|
|
|
$view->inlineScript()->appendScript($contentScript);
|
|
|
|
}
|
|
|
|
|
|
|
|
$fileControllerAction = APPLICATION_PATH . '/../public/' .
|
|
|
|
$paramsTheme->pathScript . '/' . $controller . '-' . $action . '.js';
|
|
|
|
|
|
|
|
if ( file_exists($fileControllerAction) ) {
|
|
|
|
$contentScript = file_get_contents($fileControllerAction);
|
|
|
|
$view->inlineScript()->appendScript($contentScript);
|
2011-08-18 15:23:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|