Example #1
0
 public function __construct($aCategoriesProduits = array())
 {
     parent::__construct('AjoutProduit');
     $this->createForm($aCategoriesProduits);
     $this->setSrvMethodes('Application_Service_Produit', 'formAjoutSave');
 }
Example #2
0
 /** @brief	méthode générale pour traiter les formulaires de création
  *
  * La méthode effectue la vérification des donnés par le formulaire et
  * utilise les méthodes getService, getSvcSaveMethode du formulaire pour
  * enregistrer en base
  *
  * Les messages sont passés à la vue par la propriété message.
  *
  * @param $oForm formulaire à traiter
  * @param $msgEdition message à afficher en cas d'édition
  * @param $msgSucces message à afficher en cas de succ√®s
  * @param $msgInvalid message à afficher en cas de formulaire rempli invalidement
  *
  * @return FORM_SUCCES || FORM_INVALID || FORM_RIEN || FORM_DOUBLON
  *
  * @author amboise.lafont
  */
 protected function formCreer(Projet_Form $oForm, $msgEdition = '', $msgSucces = 'form.message.succes', $msgInvalid = 'form.message.invalid')
 {
     // Vérification de la réponse au formulaire.
     if ($this->getRequest()->isPost()) {
         if ($oForm->isValid($this->getRequest()->getPost())) {
             // Lorsque la réponse est valide, on proc√®de à l'enregistrement.
             $sSaveMethode = $oForm->getSvcSaveMethode();
             try {
                 $oForm->getService()->{$sSaveMethode}($oForm->getValues());
                 $this->view->message = $msgSucces;
                 // on ne donne pas le formulaire à la vue
                 return self::FORM_SUCCES;
             } catch (Projet_Exception_Doublon $e) {
                 $this->view->errors = true;
                 $this->view->message = $msgInvalid;
                 $ret = self::FORM_DOUBLON;
             } catch (Exception $e) {
                 if (APP_DEBUG) {
                     throw new Zend_Exception('FORM_SAVE', "cf service form Save ou équivalent", $e);
                 } else {
                     $this->view->message = 'message.enregistrement.echec';
                     return self::FORM_INVALID;
                 }
             }
         } else {
             $this->view->errors = true;
             // Lorsque la réponse est invalide, un message est donné au Layout qui le détecte et l'affiche.
             $this->view->message = $msgInvalid;
             $ret = self::FORM_INVALID;
         }
     } else {
         // Lorsque la réponse n'existe pas, un message est donné au Layout qui le détecte et l'affiche.
         $this->view->message = $msgEdition;
         $ret = self::FORM_RIEN;
     }
     // On donne le formulaire à la vue.
     $this->view->form = $oForm;
     return $ret;
 }
Example #3
0
 public function __construct(array $aCategories = array(), $aConservation = array(), $aUnites = array())
 {
     parent::__construct('AjoutLibelle');
     $this->createForm($aCategories, $aConservation, $aUnites);
     $this->setSrvMethodes('Application_Service_Items', 'formSave');
 }
Example #4
0
 public function __construct()
 {
     parent::__construct('FormLogin');
     $this->setAction('authentification')->setAttrib('id', 'FormLogin');
     $this->createForm();
 }
Example #5
0
 public function __construct()
 {
     parent::__construct('AjoutCategorie');
     $this->createForm();
     $this->setSrvMethodes('Application_Service_Categories', 'formSave');
 }