92 lines
2.6 KiB
PHP
92 lines
2.6 KiB
PHP
<?php
|
|
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|
{
|
|
protected function _initViewSettings()
|
|
{
|
|
$this->bootstrap('view');
|
|
$view = $this->getResource('view');
|
|
$pathStyle = '/themes/default/styles';
|
|
$pathScript = '/themes/default/scripts';
|
|
|
|
$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()
|
|
->appendStylesheet('/libs/qtip/jquery.qtip.css', 'all')
|
|
->appendStylesheet('/themes/jstree/default/style.css') // Ohhhhhhhhhh !
|
|
->appendStylesheet('/libs/ui/themes/smoothness/jquery-ui.css', 'all')
|
|
->appendStylesheet($pathStyle.'/main.css', 'all');
|
|
|
|
$view->headScript()
|
|
->appendFile('/libs/jquery/jquery.js', 'text/javascript')
|
|
->appendFile('/libs/jquery/jquery.bgiframe.js', 'text/javascript')
|
|
->appendFile('/libs/jquery/jquery.cookie.js', 'text/javascript')
|
|
->appendFile('/libs/ui/jquery-ui.js', 'text/javascript')
|
|
->appendFile('/libs/qtip/jquery.qtip.js', 'text/javascript')
|
|
->appendFile($pathScript.'/scripts.js', 'text/javascript');
|
|
|
|
$view->headTitle()->setSeparator(' - ');
|
|
$view->headTitle('Odea');
|
|
}
|
|
|
|
protected function _initLogging()
|
|
{
|
|
//Firebug
|
|
$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()
|
|
{
|
|
$dbConfig = Zend_Registry::get('configuration')->databases;
|
|
try {
|
|
$db = Zend_Db::factory($dbConfig->db);
|
|
Zend_Db_Table::setDefaultAdapter ($db);
|
|
} catch ( Exception $e ) {
|
|
if (APPLICATION_ENV == 'development') {
|
|
print_r($e);
|
|
} else {
|
|
echo "Le service rencontre actuellement un problème technique.";
|
|
}
|
|
exit;
|
|
}
|
|
|
|
/**
|
|
* Set the default adapter to use with all model
|
|
*/
|
|
Zend_Db_Table::setDefaultAdapter($db);
|
|
|
|
/**
|
|
* Set Firebug Database profiler
|
|
*/
|
|
if (APPLICATION_ENV == 'development') {
|
|
$profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
|
|
$profiler->setEnabled(true);
|
|
$db->setProfiler($profiler);
|
|
}
|
|
}
|
|
|
|
|
|
protected function _initCache()
|
|
{
|
|
//MetadataCache pour la base de données
|
|
$frontendOptions = array(
|
|
'lifetime' => 14400,
|
|
'automatic_serialization' => true
|
|
);
|
|
$backendOptions = array();
|
|
$cache = Zend_Cache::factory('Core','Apc', $frontendOptions, $backendOptions);
|
|
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
|
|
|
|
//Cache pour les données de la base à stocker
|
|
}
|
|
|
|
} |