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
|
class Backend_Form_Galeriephoto extends App_Form
{
public function __construct($options = null)
{
parent::__construct($options);
$this->setMethod('post')
->setAttrib('id', 'backendform1');
$galerie_photo_id = new Zend_Form_Element_Hidden('galerie_photo_id');
$galerie_categorie_key = new Zend_Form_Element_Select('galerie_categorie_key');
$galerie_categorie_key->setLabel('Categorie')
->setAttrib('id','galerie_categorie_key')
->setRequired(true);
$mapperCategorie = new Frontend_Model_GaleriecategorieMapper();
$listCategorie = $mapperCategorie->fetchAll();
$galerie_categorie_key->addMultiOption('', 'Choisir une catégorie');
foreach($listCategorie as $line){
$galerie_categorie_key->addMultiOption($line->getGalerie_categorie_id(), App_Tools::getinfosLangue($line->getId_langue()). ' | ' . $line->getGalerie_categorie_libelle());
}
$galerie_photo_libelle = New App_Form_Element_Text('galerie_photo_libelle');
$galerie_photo_libelle->setLabel('Libelle photo')
->setAttrib('id','galerie_photo_libelle')
->setAttrib('size','150');
$galerie_photo_actif = new Zend_Form_Element_Select('galerie_photo_actif');
$galerie_photo_actif->setLabel('Actif')
->addMultiOption(1,'Oui')
->addMultiOption(0,'Non');
$galerie_photo_ordre = New App_Form_Element_Text('galerie_photo_ordre');
$galerie_photo_ordre->setLabel('Ordre')
->setAttrib('id','galerie_photo_ordre')
->setAttrib('size','30');
$file = new Zend_Form_Element_File('galerie_photo_path');
$file->setLabel('Fichier')
->setDestination(APPLICATION_PATH .'\..\public\frontend\medias\upload\galery')
->setRequired(true);
$file->addValidator('Size', false, 1000000); //512000
$file->addValidator('Extension', false, 'jpg,png,gif');
$submit = new App_Form_Element_Submit('Envoyer');
$submit->setAttrib('id', 'send')
->addDecorator('HtmlTag', array('tag' => 'p', 'id' => 'submit-wrap'));
$element = array(
$galerie_photo_id,
$galerie_categorie_key,
$galerie_photo_libelle,
$galerie_photo_actif,
$galerie_photo_ordre,
$file,
$submit
);
$this->addElements($element);
} |
Partager