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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| class alternatestylesheetForm extends Zend_Form
{
public function __construct($options = null)
{
// on appel le constucteur de Zend_Form
parent::__construct($options);
// on charge les decorateurs, helpers, et elements personnaliser
// $loader = new Zend_Loader_PluginLoader();
// $loader->addPrefixPath('Brts_Form_Decorator', 'Brts/Form/decorator');
// on détermine les paramètres du formulaire
$this->setAction('/'.self::$userNamespace->langue.'/'.self::$userNamespace->module.'/alternatestylesheet/submit')
->setName('chooseAlternatStylesheet')
->setMethod('post')
->setEnctype(Zend_Form::ENCTYPE_URLENCODED)
->addElementPrefixPath('Brts_Form_Decorator', 'Brts/Form/Decorator/', 'decorator');
// on definit le tableau MultiOptions pour le <select> stylesheet
$arrayStyleSheetMultiOptions = array('default' => 'Style par default', 'choix1' => '1', 'choix2' => '2');
$stylesheet = new Zend_Form_Element_Select('stylesheet');
$stylesheet->setLabel('stylesheet')
->setAttribs(array(
'class' => 'court',
'size' => '1',
'tabindex' => '1'
))
->removeDecorator('label')
->removeDecorator('HtmlTag')
// ->addPrefixPath('Brts_Decorator',
// 'Brts/Form/decorator',
// 'decorator')
->setMultiOptions($arrayStyleSheetMultiOptions)
->setRequired(true);
$btn_envoi = new Zend_Form_Element_Submit('envoi');
$btn_envoi->setLabel('Envoyer')
->removeDecorator('DtDdWrapper')
// ->addPrefixPath('Brts_Form_Decorator',
// 'Brts/Form/decorator',
// 'decorator')
->setAttribs(array(
'class' => 'bouton_form',
'tabindex' => '2',
'title' => 'Appliquer le style choisi'
));
// on ajoute tout les éléments au formulaire
$this->addElements(
array(
$stylesheet,
$btn_envoi
));
// on réinisialise les décorateurs
$this->clearDecorators();
// definition des décorateurs communs au formulaire via "decorateur de vue manuel"
$this->setDecorators(array(
array('ViewScript', array('script' => 'show.phtml'))
));
$stylesheet->setDecorators(array('Indentator'));
$btn_envoi->setDecorators(array('Indentator'));
}
} |
Partager