1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| <?php
class FormulaireTypeMonument extends Zend_Form
{
protected $_isUpdate;
public function __construct($isUpdate = false, $options = null)
{
$this->_isUpdate = $isUpdate;
parent::__construct($options);
}
public function init() {
$this->setName('type_monument');
$id = new Zend_Form_Element_Hidden('id');
$nom = new Zend_Form_Element_Text('nom_type');
$nom->setLabel('Intitulé du Type Monument : ')
->setRequired(true)
->addFilter('StripTags')
->addFilter('StringTrim')
->addValidator('NotEmpty');
// partie que je veux cacher lors de la modification
//--------------------------------------------------------------------------------
if(!$this->_isUpdate) {
$check=new Zend_Form_Element_Checkbox('encore');
$check->setLabel('Ajouter un autre ?');/**/
}
//--------------------------------------------------------------------------------
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$this->addElements(array($id, $nom, $check,/**/ $submit));
}
} |