107 lines
2.9 KiB
PHP
107 lines
2.9 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('HTML5');
|
|
|
|
$view->headMeta()
|
|
->appendName('viewport', 'width=device-width, initial-scale=1.0')
|
|
->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
|
|
->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
|
|
->appendHttpEquiv('Content-Language', 'fr-FR');
|
|
|
|
$view->headLink()
|
|
->appendStylesheet('/libs/bootstrap-v3.0.3/css/bootstrap.min.css', 'all')
|
|
->appendStylesheet('/themes/default/css/justified-nav.css', 'all');
|
|
|
|
$view->headScript()
|
|
->appendFile('/libs/html5shiv.js', 'text/javascript', array('conditional' => 'lt IE 9'))
|
|
->appendFile('/libs/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
|
|
->appendFile('/libs/jquery-1.10.2.min.js', 'text/javascript')
|
|
->appendFile('/libs/bootstrap-v3.0.3/js/bootstrap.min.js', 'text/javascript');
|
|
|
|
$view->headTitle()->setSeparator(' - ');
|
|
$view->headTitle('Partner');
|
|
}
|
|
|
|
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()
|
|
{
|
|
$c = new Zend_Config($this->getOptions());
|
|
try {
|
|
$db = Zend_Db::factory($c->profil->db->sdv1);
|
|
$db->getConnection();
|
|
} catch ( Exception $e ) {
|
|
if (APPLICATION_ENV == 'development') {
|
|
echo '<pre>'; print_r($e); echo '</pre>';
|
|
} 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
|
|
$cache = Zend_Cache::factory(
|
|
'Core',
|
|
'Apc',
|
|
array('lifetime' => 28800,'automatic_serialization' => true),
|
|
array()
|
|
);
|
|
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
|
|
}
|
|
|
|
protected function _initRouter()
|
|
{
|
|
$this->bootstrap('frontController');
|
|
$front = $this->getResource('frontController');
|
|
$router = $front->getRouter();
|
|
|
|
//Route pour prestations
|
|
$route = new Zend_Controller_Router_Route('/id/:client/*', array(
|
|
'controller' => 'presta',
|
|
'action' => 'index',
|
|
));
|
|
$router->addRoute('presta', $route);
|
|
return $router;
|
|
}
|
|
} |