bootstrap('view'); $view = $this->getResource('view'); /* * Si on détecte un périphérique mobile alors on charge * les bons scripts $theme = 'mobile'; $path = realpath(APPLICATION_PATH.'/views/'.$theme); $view = new Zend_View(); $view->addBasePath($path); */ $theme = 'default'; $pathStyle = '/themes/'.$theme.'/styles'; $pathScript = '/themes/'.$theme.'/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() ->headLink(array('rel' => 'favicon', 'type' => 'image/png', 'href' => '/favicon.png')); $view->headLink() ->headLink(array('rel' => 'shortcut icon', 'type' => 'image/x-icon', 'href' => '/favicon.ico')); //Get controller name + action name to define css and js to load $view->headLink() ->appendStylesheet($pathStyle.'/reset.css', 'all') ->appendStylesheet($pathStyle.'/main.css', 'all') ->appendStylesheet($pathStyle.'/menu.css', 'all') ->appendStylesheet($pathStyle.'/jquery-ui.css', 'all') ->appendStylesheet($pathStyle.'/jquery.qtip.css', 'all'); if (APPLICATION_ENV != 'development'){ $view->headScript() ->appendFile($pathScript.'/min/jquery.min.js', 'text/javascript') ->appendFile($pathScript.'/jquery.bgiframe.js', 'text/javascript') ->appendFile($pathScript.'/min/jquery-ui.min.js', 'text/javascript') ->appendFile($pathScript.'/min/jquery.qtip.min.js', 'text/javascript') ->appendFile($pathScript.'/growl.js', 'text/javascript') ->appendFile($pathScript.'/script.js', 'text/javascript'); } else { $view->headScript() ->appendFile($pathScript.'/jquery.js', 'text/javascript') ->appendFile($pathScript.'/jquery.bgiframe.js', 'text/javascript') ->appendFile($pathScript.'/jquery-ui.js', 'text/javascript') ->appendFile($pathScript.'/jquery.qtip.js', 'text/javascript') ->appendFile($pathScript.'/growl.js', 'text/javascript') ->appendFile($pathScript.'/script.js', 'text/javascript'); } $view->headTitle()->setSeparator(' - '); $view->headTitle('Extranet Scores & Décisions'); } protected function _initRouter() { $this->bootstrap('frontController'); $front = $this->getResource('frontController'); $router = $front->getRouter(); $localauthRoute = new Zend_Controller_Router_Route('localauth/', array( 'controller' => 'user', 'action' => 'login' )); $fichierRoute = new Zend_Controller_Router_Route('fichier/:action/:fichier', array( 'controller' => 'fichier', 'fichier' => '', )); $printRoute = new Zend_Controller_Router_Route('editer/:action/:fichier', array( 'controller' => 'print', 'fichier' => '', )); $router->addRoute('localauth', $localauthRoute); $router->addRoute('fichier', $fichierRoute); $router->addRoute('print', $printRoute); return $router; } 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); //ChromePHP - a voir comment désactiver require_once 'Vendors/ChromePHP/ChromePhp.php'; //Application Logger en Production $AppLogger = new Zend_Log(); if (APPLICATION_ENV == 'production') { $Mail = new Zend_Mail(); $Mail->setFrom('production@scores-decisions.com') ->addTo('supportdev@scores-decisions.com'); $AppMailWriter = new Zend_Log_Writer_Mail($WsMail); $AppMailWriter->setSubjectPrependText('ERREUR'); $AppMailWriter->addFilter(Zend_Log::ERR); $AppLogger->addWriter($MailWriter); } $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path'); $path = $config->data.'/'.$config->log; $AppFileWriter = new Zend_Log_Writer_Stream($path.'/application.log'); $AppFileWriter->addFilter(Zend_Log::ERR); $AppLogger->addWriter($AppFileWriter); Zend_Registry::set('log', $AppLogger); } protected function _initZFDebug() { $zfdebug = false; //@todo : Mettre dans la configuration if (APPLICATION_ENV != 'production' && $zfdebug == true) { $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('ZFDebug'); $options = array( 'plugins' => array( 'Variables', 'File' => array('base_path' => APPLICATION_PATH . '../' ), 'Memory', 'Time', 'Exception') ); # Instantiate the database adapter and setup the plugin. # Alternatively just add the plugin like above and rely on the autodiscovery feature. if ($this->hasPluginResource('db')) { $this->bootstrap('db'); $db = $this->getPluginResource('db')->getDbAdapter(); $options['plugins']['Database']['adapter'] = $db; } # Setup the cache plugin if ($this->hasPluginResource('cache')) { $this->bootstrap('cache'); $cache = $this->getPluginResource('cache')->getDbAdapter(); $options['plugins']['Cache']['backend'] = $cache->getBackend(); } $debug = new ZFDebug_Controller_Plugin_Debug($options); $this->bootstrap('frontController'); $frontController = $this->getResource('frontController'); $frontController->registerPlugin($debug); } } }