Added the _initTranslationGlobals function to bind PHP globals to javascript vars for dynamic translation purposes
This commit is contained in:
parent
795e239ff3
commit
efd05c4b77
|
@ -18,7 +18,6 @@ require_once "Auth.php";
|
||||||
require_once __DIR__.'/forms/helpers/ValidationTypes.php';
|
require_once __DIR__.'/forms/helpers/ValidationTypes.php';
|
||||||
require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php';
|
require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php';
|
||||||
|
|
||||||
|
|
||||||
require_once (APPLICATION_PATH."/logging/Logging.php");
|
require_once (APPLICATION_PATH."/logging/Logging.php");
|
||||||
Logging::setLogPath('/var/log/airtime/zendphp.log');
|
Logging::setLogPath('/var/log/airtime/zendphp.log');
|
||||||
|
|
||||||
|
@ -51,7 +50,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
$view = $this->getResource('view');
|
$view = $this->getResource('view');
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
|
||||||
$view->headScript()->appendScript("var baseUrl = '$baseUrl'");
|
$view->headScript()->appendScript("var baseUrl = '$baseUrl';");
|
||||||
|
$this->_initTranslationGlobals($view);
|
||||||
|
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
$user = Application_Model_User::GetCurrentUser();
|
||||||
if (!is_null($user)){
|
if (!is_null($user)){
|
||||||
|
@ -60,7 +60,17 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
$userType = "";
|
$userType = "";
|
||||||
}
|
}
|
||||||
$view->headScript()->appendScript("var userType = '$userType';");
|
$view->headScript()->appendScript("var userType = '$userType';");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ideally, globals should be written to a single js file once
|
||||||
|
* from a php init function. This will save us from having to
|
||||||
|
* reinitialize them every request
|
||||||
|
*/
|
||||||
|
private function _initTranslationGlobals($view) {
|
||||||
|
$view->headScript()->appendScript("var PRODUCT_NAME = '" . PRODUCT_NAME . "';");
|
||||||
|
$view->headScript()->appendScript("var USER_MANUAL_URL = '" . USER_MANUAL_URL . "';");
|
||||||
|
$view->headScript()->appendScript("var COMPANY_NAME = '" . COMPANY_NAME . "';");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _initHeadLink()
|
protected function _initHeadLink()
|
||||||
|
|
Loading…
Reference in New Issue