odea/application/Bootstrap.php

88 lines
2.8 KiB
PHP
Raw Normal View History

2012-02-02 17:29:14 +00:00
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initViewSettings()
{
$this->bootstrap('view');
$view = $this->getResource('view');
2012-02-15 09:25:21 +00:00
$pathStyle = '/themes/default/styles';
$pathScript = '/themes/default/scripts';
2012-02-02 17:29:14 +00:00
$view->setEncoding('UTF-8');
$view->doctype('XHTML1_STRICT');
$view->headMeta()
->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
->appendHttpEquiv('Content-Language', 'fr-FR');
$view->headLink()
2012-02-02 17:29:14 +00:00
->appendStylesheet($pathStyle.'/jquery.qtip.css', 'all')
2012-02-15 09:25:21 +00:00
->appendStylesheet('/themes/jstree/default/style.css')
->appendStylesheet('/themes/jqueryui/jquery-ui.css', 'all')
2012-02-02 17:29:14 +00:00
->appendStylesheet($pathStyle.'/main.css', 'all');
$view->headScript()
->appendFile($pathScript.'/jquery.js', 'text/javascript')
->appendFile($pathScript.'/jquery.bgiframe.js', 'text/javascript')
->appendFile($pathScript.'/jquery.cookie.js', 'text/javascript')
->appendFile($pathScript.'/jquery-ui.js', 'text/javascript')
->appendFile($pathScript.'/jquery.qtip.js', 'text/javascript')
2012-02-22 19:17:11 +00:00
->appendFile($pathScript.'/scripts.js', 'text/javascript');
2012-02-02 17:29:14 +00:00
2012-02-15 10:40:34 +00:00
$view->headTitle()->setSeparator(' - ');
2012-02-02 17:29:14 +00:00
$view->headTitle('Odea');
}
protected function _initLogging()
{
//Logger de développement
$writer = new Zend_Log_Writer_Firebug();
if(APPLICATION_ENV=='production') $writer->setEnabled(false);
$logger = new Zend_Log($writer);
Zend_Registry::set('firebug', $logger);
}
protected function _initDb()
{
2012-02-15 09:25:21 +00:00
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
2012-02-02 17:29:14 +00:00
try {
2012-02-15 09:25:21 +00:00
$db = Zend_Db::factory($dbConfig->db);
2012-02-02 17:29:14 +00:00
Zend_Db_Table::setDefaultAdapter ($db);
} catch ( Exception $e ) {
exit ( $e->getMessage() );
}
Zend_Registry::set('db', $db);
}
protected function _initAutoload()
{
require_once APPLICATION_PATH . '/../library/Zend/Loader/Autoloader.php';
$appPath = realpath(dirname(__FILE__));
$rootPath = dirname($appPath);
$autoload = Zend_Loader_Autoloader::getInstance();
$application = new Zend_Loader_Autoloader_Resource(array(
'basePath' => $appPath . '/modules/frontend/models/',
'namespace' => '',
'resourceTypes' => array('tables'=>array('path'=>'Tables/','namespace'=>'Table'),
'objects'=>array('path'=>'Objects/', 'namespace'=>'Object'),
'forms'=>array('path'=>'Forms/', 'namespace'=>'Form')
)));
$libs = new Zend_Loader_Autoloader_Resource(array(
'basePath' => $rootPath . '/library',
'namespace' => 'library',
'resourceTypes' => array('libs'=>array('path'=>'libs/','namespace'=>'Libs'),
)));
$loader = new Zend_Application_Module_Autoloader(array(
'namespace' => '',
'basePath' => APPLICATION_PATH));
return $loader;
}
}