Ajout des données

This commit is contained in:
Michael RICOIS 2014-07-17 09:05:58 +00:00
parent 210701a2c9
commit 3bcf15e2d7
3 changed files with 30 additions and 15 deletions

View File

@ -1,23 +1,21 @@
<?php if (count($this->inLabels)>0) {?>
<ul>
<div class="list-group">
<?php foreach ($this->inLabels as $i => $item) {?>
<li><?=$item?>
<a class="remove" href="<?=$this->url(array('controller'=>'index', 'action'=>'remove',
'critere'=>$this->critereName, 'in'=>$i ), null, true)?>">
<img src="/themes/default/images/cross.png" alt="Supprimer la valeur"></a>
</li>
<a href="<?=$this->url(array('controller'=>'index', 'action'=>'remove', 'critere'=>$this->critereName, 'in'=>$i ),
null, true)?>" class="list-group-item remove"><?=$item?>
<button type="button" class="close"><span aria-hidden="true">&times;</span><span class="sr-only">Supprimer</span></button>
</a>
<?php }?>
</ul>
</div>
<?php }?>
<?php if (count($this->exLabels)>0) {?>
<ul>
<div class="list-group">
<?php foreach ($this->exLabels as $i => $item) {?>
<li><?=$item?>
<a class="remove" href="<?=$this->url(array('controller'=>'index', 'action'=>'remove',
'critere'=>$this->critereName, 'ex'=>$i ), null, true)?>">
<img src="/themes/default/images/cross.png" alt="Supprimer la valeur"></a>
</li>
<a href="<?=$this->url(array('controller'=>'index', 'action'=>'remove', 'critere'=>$this->critereName, 'ex'=>$i ),
null, true)?>" class="list-group-item remove"><?=$item?>
<button type="button" class="close"><span aria-hidden="true">&times;</span><span class="sr-only">Supprimer</span></button>
</a>
<?php }?>
</ul>
</div>
<?php }?>

View File

@ -834,6 +834,16 @@ class Scores_Ciblage_FieldList
return $values;
}
public function isMultiple($key)
{
if ( is_array( $this->items[$key]['type']) ) {
return true;
}
return false;
}
/**
*
* @param string $key

View File

@ -89,7 +89,14 @@ class Scores_Ciblage_Session
}
//Merge with data already in session if needed
if ( $this->fields->isMultiple($key) ) {
if ($ex) {
$existingValue = count($this->ciblage->select[$key]['ex']) ? $this->ciblage->select[$key]['ex'] : array();
} else {
$existingValue = count($this->ciblage->select[$key]['in']) ? $this->ciblage->select[$key]['in'] : array();
}
$valueToSave = array_merge($valueToSave, $existingValue);
}
//Prepare to save date in session
if ( $valueToSave !== null ) {