public function createForm() { $oCategorie = new Projet_Form_Element_Text(self::CATEGORIE); $oCategorie->setLabel('Categorie')->setRequired(true); $oDescription = new Projet_Form_Element_TextArea(self::DESCRIPTION); $oDescription->setLabel('Description'); $this->addElementsWithSubmit(array($oCategorie, $oDescription), 'Enregistrer'); $this->setAttrib('class', CSS_FORM_MEDIUM); $this->setDefaultDecorators(); }
public function createForm(array $aCategories, array $aConservation, array $aUnites) { $oLibelle = new Projet_Form_Element_Text(self::LIBELLE); $oLibelle->setLabel('Libelle')->setRequired(true); $oDescription = new Projet_Form_Element_TextArea(self::DESCRIPTION); $oDescription->setLabel('Description'); $oCategorie = new Projet_Form_Element_Select(self::CATEGORIE); $oCategorie->setLabel('Categorie')->setMultiOptions($aCategories); $oTypeConservation = new Projet_Form_Element_MultiCheckBox(self::CONSERVATION); $oTypeConservation->setLabel('Conservation')->setMultiOptions($aConservation); $oMesure = new Projet_Form_Element_Select(self::MESURE); $oMesure->setLabel('Unité de mesure')->setMultiOptions($aUnites); $this->addElementsWithSubmit(array($oCategorie, $oLibelle, $oTypeConservation, $oMesure, $oDescription), 'Enregistrer'); $this->setAttrib('class', CSS_FORM_MEDIUM); $this->setDefaultDecorators(); }
public function createForm($aCategoriesProduits) { $oCategorie = new Projet_Form_Element_Select(self::CATEGORIE); $oCategorie->setMultiOptions($aCategoriesProduits)->setLabel('Categorie'); $oItem = new Projet_Form_Element_Select(self::LIBELLE, array('ajax' => 'span')); $oItem->setLabel('Item'); $oDec = new Zend_Form_Decorator_HtmlTag(array('tag' => 'span', 'id' => 'unite', 'placement' => 'append')); $oQuantite = new Projet_Form_Element_Text(self::QUANTITE, array('deco' => $oDec)); $oQuantite->setLabel('Quantité')->setRequired(true)->setAllowEmpty(false)->addValidator('Float', true)->addValidator('GreaterThan', true, array('min' => 0)); // ->addDecorator('HtmlTag', array('tag' => 'span', // 'id' => 'unite', // 'placement' => 'append')); $oSelectDateDuree = new Projet_Form_Element_Radio(self::DATE_DUREE); $oSelectDateDuree->setMultiOptions(array(self::N_DATE => 'Date', self::N_DUREE => 'Durée'))->setSeparator("  \t")->setRequired(true); $oDatePeremption = new Projet_Form_Element_DatePicker(self::DATE_PER); $oDatePeremption->setLabel('Date de péremption'); $oDureePeremption = new Projet_Form_Element_Text(self::DUREE_PER); $oDureePeremption->setLabel('Durée de péremption')->addValidator('Float', true)->addValidator('GreaterThan', true, array('min' => 0)); $this->addElementsWithSubmit(array($oCategorie, $oItem, $oQuantite, $oSelectDateDuree, $oDatePeremption, $oDureePeremption), 'Ajouter le produit'); $this->setAttrib('class', CSS_FORM_MEDIUM); $this->setDefaultDecorators(); }