44 lines
1.0 KiB
PHP
44 lines
1.0 KiB
PHP
|
<?php
|
||
|
|
||
|
class ErreurController extends Libs_Controller
|
||
|
{
|
||
|
protected $correlation = array(
|
||
|
'siege' => array('fax', 'tel'),
|
||
|
'fax'=> array('siege'))
|
||
|
;
|
||
|
|
||
|
public function getAction()
|
||
|
{
|
||
|
$session = new Zend_Session_Namespace('erreurs');
|
||
|
$this->_helper->layout()->disableLayout();
|
||
|
|
||
|
$request = $this->getRequest();
|
||
|
$key = $request->getParam('key');
|
||
|
$valeur = $request->getParam('valeur');
|
||
|
|
||
|
$this->correlation($key, $valeur);
|
||
|
$this->view->erreurs = $session->erreurs;
|
||
|
}
|
||
|
|
||
|
protected function correlation($key, $valeurs)
|
||
|
{
|
||
|
$session = new Zend_Session_Namespace('erreurs');
|
||
|
$session->erreurs[$key] = array('erreur' => false, 'valeur' => $valeurs);
|
||
|
|
||
|
foreach($session->erreurs as $erreur => $valeurs)
|
||
|
{
|
||
|
if(in_array($erreur, $this->correlation[$key]))
|
||
|
{
|
||
|
if($session->erreurs[$key]['valeur'] != 'tous')
|
||
|
$session->erreurs[$key]['erreur'] = true;
|
||
|
else
|
||
|
unset($session->erreurs[$key]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|