/** * Class constructor * * @return void */ public function __construct($options) { parent::__construct($options); $imageSrc = $options['imageSrc']; if (isset($options['imgField'])) { $imgField = $options['imgField']; } $dataId = $options['dataId']; $isNewImage = $options['isNewImage']; $moduleName = $options['moduleName']; if ($dataId == '') { $pathTmp = "../../../../../data/images/" . $moduleName . "/tmp"; } else { $pathTmp = "../../../../../data/images/" . $moduleName . "/" . $dataId . "/tmp"; } $config = Zend_Registry::get('config'); // hidden specify if new image for the news $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage)); $newImage->removeDecorator('Label'); $this->addElement($newImage); // Name of the product line $name = new Zend_Form_Element_Text('CCI_Name'); $name->setLabel($this->getView()->getCibleText('form_category_name_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput '); $label = $name->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($name); if (!empty($imgField)) { // Image for the category $imageTmp = new Zend_Form_Element_Hidden($imgField . '_tmp'); $imageTmp->removeDecorator('Label'); $this->addElement($imageTmp); $imageOrg = new Zend_Form_Element_Hidden($imgField . '_original'); $imageOrg->removeDecorator('Label'); $this->addElement($imageOrg); $imageView = new Zend_Form_Element_Image($imgField . '_preview', array('onclick' => 'return false;')); $imageView->setImage($imageSrc); $this->addElement($imageView); $imagePicker = new Cible_Form_Element_ImagePicker($imgField, array('onchange' => "document.getElementById('imageView').src = document.getElementById('" . $imgField . "').value", 'associatedElement' => $imgField . '_preview', 'pathTmp' => $pathTmp, 'contentID' => $dataId)); $imagePicker->setLabel($this->getView()->getCibleText('form_category_logo_label')); $this->addElement($imagePicker); } // ImageSrc $imageBanner = new Zend_Form_Element_Select('C_BannerGroupID'); $imageBanner->setLabel($this->getView()->getCibleText('form_banner_image_group_extranet'))->setAttrib('class', 'stdSelect'); $imageBanner->addMultiOption('', 'Sans image'); $group = new GroupObject(); $groupArray = $group->groupCollection(); foreach ($groupArray as $group1) { $imageBanner->addMultiOption($group1['BG_ID'], $group1['BG_Name']); } $this->addElement($imageBanner); // id of the associated meta data $metaTagId = new Zend_Form_Element_Hidden('CCI_MetaId'); $metaTagId->removeDecorator('Label'); $this->addElement($metaTagId); }
public function __construct($options = null) { parent::__construct($options); $imageSrc = $options['imageSrc']; $dataId = $options['dataId']; $imgField = $options['imgField']; $isNewImage = $options['isNewImage']; $moduleName = $options['moduleName']; if ($dataId == '') { $pathTmp = "../../../../../data/images/" . $moduleName . "/tmp"; } else { $pathTmp = "../../../../../data/images/" . $moduleName . "/" . $dataId . "/tmp"; } // hidden specify if new image for the news $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage)); $newImage->removeDecorator('Label'); $this->addElement($newImage); // Image for the product line $imageTmp = new Zend_Form_Element_Hidden($imgField . '_tmp'); $imageTmp->removeDecorator('Label'); $this->addElement($imageTmp); $imageOrg = new Zend_Form_Element_Hidden($imgField . '_original'); $imageOrg->removeDecorator('Label'); $this->addElement($imageOrg); // Name of the group of banner // Set the texte for the image $textDescription = new Zend_Form_Element_Textarea('BII_Text'); $textDescription->setLabel($this->_view->getCibleText('form_banner_image_text_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextarea'); $label = $textDescription->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $textUrl = new Zend_Form_Element_Text('BII_Url'); $textUrl->setLabel($this->_view->getCibleText('form_banner_image_texturl_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdText'); $label = $textUrl->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $groupImage = new Zend_Form_Element_Select('BI_GroupID'); $groupImage->setLabel($this->_view->getCibleText('form_banner_image_group'))->setAttrib('class', 'largeSelect'); $group = new GroupObject(); $groupArray = $group->groupCollection(); foreach ($groupArray as $group1) { $groupImage->addMultiOption($group1['BG_ID'], $group1['BG_Name']); } $label = $groupImage->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); // Image for the product line $imageView = new Zend_Form_Element_Image($imgField . '_preview', array('onclick' => 'return false;')); $imageView->setImage($imageSrc); $imagePicker = new Cible_Form_Element_ImagePicker($imgField, array('onchange' => "document.getElementById('imageView').src = document.getElementById('" . $imgField . "').value", 'associatedElement' => $imgField . '_preview', 'pathTmp' => $pathTmp, 'contentID' => $dataId)); $imagePicker->removeDecorator('Label'); $this->addElement($imageView); $this->addElement($imagePicker); $this->addElement($groupImage); $this->addElement($textDescription); $this->addElement($textUrl); }
/** * Class constructor * * @return void */ public function __construct($options) { parent::__construct($options); $imageSrc = $options['imageSrc']; $dataId = $options['dataId']; $isNewImage = $options['isNewImage']; $moduleName = $options['moduleName']; if ($dataId == '') { $pathTmp = "../../../../../data/images/" . $moduleName . "/tmp"; } else { $pathTmp = "../../../../../data/images/" . $moduleName . "/" . $dataId . "/tmp"; } $config = Zend_Registry::get('config'); // Name of the product line $name = new Zend_Form_Element_Text('SCI_Name'); $name->setLabel($this->getView()->getCibleText('form_subcategory_name_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput '); $label = $name->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($name); $oCategories = new CatalogCategoriesObject(); $listCat = $oCategories->getAll(Zend_Registry::get('currentEditLanguage')); $categories = new Zend_Form_Element_Select('SC_CategoryID'); $categories->setLabel($this->getView()->getCibleText('form_select_category_label'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'largeSelect'); $categories->addMultiOption('', $this->getView()->getCibleText('form_select_default_label')); foreach ($listCat as $data) { $categories->addMultiOption($data['CC_ID'], $data['CCI_Name']); } $this->addElement($categories); // ImageSrc $imageBanner = new Zend_Form_Element_Select('SC_BannerGroupID'); $imageBanner->setLabel($this->getView()->getCibleText('form_banner_image_group_extranet'))->setAttrib('class', 'stdSelect'); $imageBanner->addMultiOption('', 'Sans image'); $group = new GroupObject(); $groupArray = $group->groupCollection(); foreach ($groupArray as $group1) { $imageBanner->addMultiOption($group1['BG_ID'], $group1['BG_Name']); } $this->addElement($imageBanner); // id of the associated meta data $metaTagId = new Zend_Form_Element_Hidden('SCI_MetaId'); $metaTagId->removeDecorator('Label'); $this->addElement($metaTagId); }