Translate,Models..
This commit is contained in:
parent
fe10b02c33
commit
8c478f4b9c
11 changed files with 161 additions and 55 deletions
|
|
@ -23,11 +23,6 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
return $navigation;
|
||||
}
|
||||
|
||||
protected function _initConfig()
|
||||
{
|
||||
return new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
|
||||
}
|
||||
|
||||
/**
|
||||
* View and Layout configuration
|
||||
*
|
||||
|
|
@ -35,13 +30,12 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
*/
|
||||
protected function _initView()
|
||||
{
|
||||
$this->bootstrap('config');
|
||||
|
||||
$view = new Zend_View();
|
||||
$view->setEncoding('UTF-8');
|
||||
|
||||
// Set site title
|
||||
$view->headTitle($this->getResource('config')->app->name);
|
||||
// Set site title from application.ini
|
||||
$config = $this->getApplication()->getOptions();
|
||||
$view->headTitle($config['app']['name']);
|
||||
|
||||
$layout = Zend_Layout::startMvc();
|
||||
$layout->setLayoutPath(APPLICATION_PATH . '/modules/default/views/layout');
|
||||
|
|
@ -58,12 +52,17 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
*/
|
||||
protected function _initFront()
|
||||
{
|
||||
$this->bootstrap('autoloader');
|
||||
|
||||
// Get front controller
|
||||
$frontController = Zend_Controller_Front::getInstance();
|
||||
|
||||
// Set modules directory
|
||||
$frontController->addModuleDirectory(APPLICATION_PATH . '/modules');
|
||||
|
||||
// Add plugins
|
||||
$frontController->registerPlugin(new Fiktiv_Controller_Plugin_Language());
|
||||
|
||||
return $frontController;
|
||||
}
|
||||
|
||||
|
|
@ -94,6 +93,55 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
return $router;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure global and local(modules) models
|
||||
*/
|
||||
protected function _initModels()
|
||||
{
|
||||
$this->bootstrap('autoloader');
|
||||
|
||||
// Include global model directory
|
||||
set_include_path(implode(PATH_SEPARATOR, array(
|
||||
APPLICATION_PATH . '/models',
|
||||
get_include_path()
|
||||
)));
|
||||
|
||||
// Let our model autoloader plugin handle local models
|
||||
$front = $this->getResource('front');
|
||||
$front->registerPlugin(new Fiktiv_Controller_Plugin_ModelAutoloader());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure autoloader
|
||||
*
|
||||
* @return Zend_Loader_Autoloader $autoloader
|
||||
*/
|
||||
protected function _initAutoloader()
|
||||
{
|
||||
$autoloader = Zend_Loader_Autoloader::getInstance();
|
||||
$autoloader->registerNamespace('Fiktiv_');
|
||||
$autoloader->setFallbackAutoloader(true);
|
||||
|
||||
return $autoloader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure multilanguage (translator)
|
||||
*
|
||||
* @return Zend_Translate $translate
|
||||
*/
|
||||
protected function _initTranslate()
|
||||
{
|
||||
|
||||
$translate = new Zend_Translate('ini', APPLICATION_PATH . '/languages/se.ini', 'sv');
|
||||
$translate->addTranslation(APPLICATION_PATH . '/languages/en.ini', 'en');
|
||||
|
||||
Zend_Form::setDefaultTranslator($translate);
|
||||
|
||||
return $translate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup a sweet and simple database
|
||||
* connection.
|
||||
|
|
|
|||
Reference in a new issue