Correction des array en string pour l'affichage des sessions dans le select

This commit is contained in:
Damien LASSERRE 2012-01-16 15:34:53 +00:00
parent c992950c33
commit 7e53de8c28

View File

@ -56,7 +56,7 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
private function selectMultipleHTML($name, $field)
{
$session = new SessionCiblage();
$return = '<select class="criteres" name="'.$name.'">';
$return .= '<option value="tous">Tous</option>';
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
@ -73,12 +73,15 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
private function selectHTML($name, $field)
{
$session = new SessionCiblage();
$sessionValeur = $session->getCritere($name);
if(is_array($sessionValeur))
$sessionValeur = implode(',', $sessionValeur);
$return = '<select class="criteres" name="'.$name.'">';
$return .= '<option value="tous">Tous</option>';
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
$selected = "";
if(($session->getCritere($name) != null) and $session->getCritere($name) == $value)
if(($sessionValeur != null) and $sessionValeur == $value)
$selected = " selected";
$return .= '<option'.((!empty($selected))?$selected:null).' value="'.$value.'">'.$label.'</option>';
}