Enregistrer un profil

This commit is contained in:
Michael RICOIS 2012-03-06 15:02:50 +00:00
parent 85dd71c9fa
commit 59df244e79
2 changed files with 36 additions and 5 deletions

View File

@ -35,7 +35,35 @@ class GestionController extends Zend_Controller_Action
//Sauvegarde du formulaire
if ( $request->isPost() ){
$params = $request->getParams();
//Vérifier le formulaire
$errForm = 0;
foreach ( $params as $key => $value ) {
if (empty($value)) {
$errForm++;
}
}
if (!$errForm) {
$data = array(
'idClient' => $params['idClient'],
'login' => $params['login'],
'reference' => $params['reference'],
'criteres' => json_encode($params['criteres']),
'tarifLigne' => $params['tarifLigne'],
'dateAjout' => date('Y-m-d H:i:s'),
'actif' => 1,
);
$profilM = new Table_EnrichissementProfils();
if ( $profilM->insert($data) ){
$this->view->message('message', "Profil enregistré");
} else {
$this->view->message('message', "Erreur lors de la sauvegarde");
}
} else {
$this->view->message('message', "Erreur lors de la saisie");
}
}

View File

@ -1,6 +1,8 @@
<div id="dashboard">
<form>
<?=$this->message?>
<form name="profil" action="<?=$this->url(array('controller'=>'gestion', 'action'=>'profiladd'))?>">
<label>idClient</label>
<input type="text" name="idClient" />
<br/>
@ -17,8 +19,7 @@
<div>
<label>Selection des données pour l'enrichissement</label>
<select name="listcriteres" multiple="10">
<option value="">-</option>
<select style="padding:5px;" name="criteres" multiple="20">
<?php if ( count($this->fields)>0 ) {?>
<?php foreach ( $this->fields as $value => $item ) {?>
<option value="<?=$value?>"><?=$item['label']?></option>
@ -27,8 +28,10 @@
</select>
</div>
<input type="submit" name="submit" value="Enregistrer"/>
</form>
</div>
</form>
</div>