webservice/application/Bootstrap.php

87 lines
2.2 KiB
PHP
Raw Normal View History

2010-08-30 07:49:44 +00:00
<?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('XHTML1_STRICT');
$view->headMeta()
->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
->appendHttpEquiv('Content-Language', 'fr-FR');
2010-09-20 15:08:45 +00:00
$view->headLink()
2010-12-13 16:54:04 +00:00
->appendStylesheet('/styles/reset.css', 'all')
2010-09-20 15:08:45 +00:00
->appendStylesheet('/styles/main.css', 'all');
2010-08-30 07:49:44 +00:00
$view->headTitle('WsEntreprise');
2010-09-20 15:08:45 +00:00
2010-08-30 07:49:44 +00:00
}
//Initialisation global des paramètres de log
protected function _initLogging()
{
require_once 'Zend/Log.php';
require_once 'Zend/Mail.php';
2010-09-14 16:36:59 +00:00
2010-10-26 13:21:59 +00:00
$WsLogger = new Zend_Log();
2010-09-14 16:36:59 +00:00
$WsFileWriter = new Zend_Log_Writer_Stream(LOG_PATH.'/wsentreprise.log');
2010-09-14 16:36:59 +00:00
$WsFileWriter->addFilter(Zend_Log::INFO);
$WsLogger->addWriter($WsFileWriter);
2010-10-26 13:21:59 +00:00
if (APPLICATION_ENV == 'production')
{
$WsMail = new Zend_Mail();
$WsMail->setFrom('production@scores-decisions.com')
->addTo('mricois@scores-decisions.com');
$WsMailWriter = new Zend_Log_Writer_Mail($WsMail);
$WsMailWriter->setSubjectPrependText('ERREUR');
$WsMailWriter->addFilter(Zend_Log::ERR);
$WsLogger->addWriter($WsMailWriter);
}
$AppFileWriter = new Zend_Log_Writer_Stream(LOG_PATH.'/application.log');
2010-09-14 16:36:59 +00:00
$AppFileWriter->addFilter(Zend_Log::ERR);
$AppLogger = new Zend_Log();
$AppLogger->addWriter($AppFileWriter);
2010-08-30 07:49:44 +00:00
2010-09-14 16:36:59 +00:00
Zend_Registry::set('WsLogger', $WsLogger);
Zend_Registry::set('log', $AppLogger);
2010-08-30 07:49:44 +00:00
}
protected function _initNavigation()
{
$view = $this->bootstrap('layout')->getResource('layout')->getView();
$menu = array(
array(
'label' => 'Accueil',
'controller' => 'index',
'action' => 'index',
),
array(
'label' => 'Documentation',
'controller' => 'documentation',
'action' => 'index',
'pages' => array(
array(
'label' => 'Exemples',
'controller' => 'documentation',
'action' => 'exemples',
),
),
),
2010-12-13 16:54:04 +00:00
array(
2010-12-14 10:36:48 +00:00
'label' => 'Démonstration',
2010-12-13 16:54:04 +00:00
'controller' => 'demo',
'action' => 'index',
),
);
$view->navigation(new Zend_Navigation($menu));
}
2010-10-26 13:21:59 +00:00
protected function _initDb(){}
2010-08-30 07:49:44 +00:00
}