Définit les variables de vue dans un plugins pour affecter la valeur à tout moment, à désactiver pour les autres vues

This commit is contained in:
Michael RICOIS 2012-01-03 15:04:02 +00:00
parent 7e80ace6f8
commit bfca86274e
3 changed files with 19 additions and 8 deletions

View File

@ -10,6 +10,7 @@ resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
autoloaderNamespaces[] = "Application_"
resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth"
resources.frontController.plugins.Comptage = "Application_Controller_Plugin_Comptage"
resources.layout.layout = "main"
resources.layout.layoutPath = APPLICATION_PATH "/views/default"
resources.view.basePath = APPLICATION_PATH "/views/default"

View File

@ -7,14 +7,7 @@ class IndexController extends Zend_Controller_Action
protected $juridique = array('cj', 'actifEco', 'procolHisto', 'tvaIntraValide', 'dateImmat');
protected $financier = array('bilType', 'avisCs', 'bilDuree', 'bilTca', 'bilAnnee', 'bilCloture', 'bilEE', 'bilFL', 'bilFK', 'bilFR', 'bilGF', 'bilGP', 'bilGU', 'bilGW', 'bilHD', 'bilHH', 'bilHL', 'bilHM', 'bilHN', 'bilYP');
public function indexAction()
{
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$this->view->total = number_format($session->getNb('total'), 0, '', ' ');
$this->view->insee = number_format($session->getNb('insee'), 0, '', ' ');
}
public function indexAction(){}
public function selectionAction(){}

View File

@ -0,0 +1,17 @@
<?php
class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$layout = Zend_Layout::getMVCInstance();
if ($layout->isEnabled()) {
$controller = $this->_request->getControllerName();
$action = $this->_request->getActionName();
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$view = $layout->getView();
$view->total = number_format($session->getNb('total'), 0, '', ' ');
$view->insee = number_format($session->getNb('insee'), 0, '', ' ');
}
}
}