110 lines
3.0 KiB
PHP
110 lines
3.0 KiB
PHP
<?php
|
|
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|
{
|
|
// --- 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()
|
|
->appendHttpEquiv('viewport', 'width=device-width, initial-scale=1.0')
|
|
->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
|
|
->appendHttpEquiv('Content-Language', 'fr-FR');
|
|
|
|
//Favicon - Touch icon for iOS 2.0+ and Android 2.1+
|
|
$view->headLink()->headLink(array(
|
|
'rel' => 'apple-touch-icon-precomposed',
|
|
'href' => '/favicon-144.png'
|
|
));
|
|
//Favicon - targeted to any additional png size
|
|
$view->headLink()->headLink(array(
|
|
'rel' => 'icon',
|
|
'type' => 'image/png',
|
|
'href' => '/favicon-32.png'
|
|
));
|
|
$view->headLink()->headLink(array(
|
|
'rel' => 'shortcut icon',
|
|
'type' => 'image/x-icon',
|
|
'href' => '/favicon.ico')
|
|
);
|
|
|
|
$view->headLink()
|
|
->appendStylesheet('/themes/default/css/main.css', 'all')
|
|
->appendStylesheet('/libs/bootstrap-3.3.4/css/bootstrap.min.css', 'all');
|
|
|
|
$view->headScript()
|
|
->appendFile('/libs/html5shiv.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
|
|
->appendFile('/libs/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9'));
|
|
|
|
$view->inlineScript()
|
|
->appendFile('/libs/jquery-2.1.4.min.js', 'text/javascript')
|
|
->appendFile('/libs/bootstrap-3.3.4/js/bootstrap.min.js', 'text/javascript');
|
|
|
|
$view->headTitle()->setSeparator(' - ');
|
|
$view->headTitle('WebFiler');
|
|
}
|
|
|
|
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->resources->db);
|
|
$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);
|
|
}
|
|
|
|
return $db;
|
|
}
|
|
|
|
protected function _initCache()
|
|
{
|
|
if ( APPLICATION_ENV!='development' ) {
|
|
//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);
|
|
}
|
|
}
|
|
|
|
}
|
|
|