77 lines
2.1 KiB
PHP
77 lines
2.1 KiB
PHP
<?php
|
|
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|
{
|
|
protected function _initConfig()
|
|
{
|
|
$config = new Zend_Config($this->getOptions());
|
|
Zend_Registry::set('config', $config);
|
|
return $config;
|
|
}
|
|
|
|
//Initialisation global des paramètres de vue
|
|
protected function _initViewSettings()
|
|
{
|
|
$this->bootstrap('view');
|
|
$view = $this->getResource('view');
|
|
$view->setEncoding('UTF-8');
|
|
$view->doctype('XHTML1_STRICT');
|
|
$view->headMeta()
|
|
->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
|
|
->appendHttpEquiv('Content-Language', 'fr-FR');
|
|
$view->headTitle()->setSeparator(' - ');
|
|
|
|
$view->headLink()
|
|
->appendStylesheet('/styles/normalize.css', 'all')
|
|
->appendStylesheet('/styles/main.css', 'all')
|
|
->appendStylesheet('/libs/ui/themes/smoothness/jquery-ui.css', 'all');
|
|
|
|
$view->headScript()
|
|
->appendFile('/libs/jquery/jquery-1.9.0.min.js', 'text/javascript')
|
|
->appendFile('/libs/ui/jquery-ui.min.js', 'text/javascript')
|
|
->appendFile('/scripts/enrichissement.js', 'text/javascript');
|
|
|
|
$view->headTitle()->setSeparator(' - ');
|
|
|
|
$view->headTitle('Enrichissement de fichier');
|
|
}
|
|
|
|
protected function _initDb()
|
|
{
|
|
$c = Zend_Registry::get('config');
|
|
try {
|
|
$db = Zend_Db::factory($c->profil->db->local);
|
|
Zend_Db_Table::setDefaultAdapter ($db);
|
|
} catch ( Exception $e ) {
|
|
exit ( $e->getMessage() );
|
|
}
|
|
Zend_Registry::set('db', $db);
|
|
}
|
|
|
|
//Initialisation global des paramètres de log
|
|
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 _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
|
|
}
|
|
}
|
|
|