'Send to specific vendor(s)', AbstractObj::SEND_TO_VENDORS_WITH_NAICS => 'Send to vendor(s) with these Vendor Classifications', AbstractObj::SEND_TO_ALL_APPROVED_VENDORS => 'Send to all approved vendors', AbstractObj::SEND_TO_ALL_VENDORS => 'Send to all vendors', ]; protected $_vendorAutocompleteUrl; public function init() { $this->_dfRelations[] = $this->getConfigArray('dynamicFormRelations'); return parent::init(); } public function setVendorAutocompleteUrl($url) { $this->_vendorAutocompleteUrl = $url; return $this; } protected function _initElements() { $this->addElement('select', 'categoryId', [ 'label' => 'Category', 'required' => true, 'multiOptions' => ['' => 'Select One'] + (new Qs_Db_Table('DLibraryCategory'))->get4Select( ['id', 'title'], 'id <> ' . AbstractObj::CATEGORY_ID_MARKETPLACE), ]); $this->addElement('radio', 'sendTo', [ 'label' => 'Send to', 'multiOptions' => $this->_sendToOptions, 'required' => true, ]); $this->addElement('multiDataAutocomplete', 'vendors', [ 'label' => 'Vendors', 'dataUrl' => $this->_vendorAutocompleteUrl, 'placeholder' => 'Autocomplete field', 'required' => ($this->_getData('sendTo') == AbstractObj::SEND_TO_SPECIFIC_VENDORS), ]); $this->getElement('vendors')->getDecorator('label')->setOption('class', 'required'); $this->addElement('multiCheckbox', 'naicsCodes', [ 'label' => 'Vendor Classifications', 'columns' => 2, 'multiOptions' => (new Qs_Db_Table('Naics'))->get4Select(['id', 'title'], null, 'id ASC'), 'required' => ($this->_getData('sendTo') == AbstractObj::SEND_TO_VENDORS_WITH_NAICS), ]); $this->getElement('naicsCodes')->getDecorator('label')->setOption('class', 'required'); $this->addElement('text', 'title', ['label' => 'File name', 'required' => true]); $this->addElement('extendedFile', 'file', ['label' => 'Upload file', 'required' => true]); $this->addElement('htmlEditor', 'emailNote', ['label' => 'Note for email']); return $this; } public function render(\Zend_View_Interface $view = null) { /** @var \Qs_Doc $doc */ $doc = Zend_Registry::get('doc'); $doc->addScript('js/jquery-ui.js'); $doc->addScript('js/app/library/admin/form.js'); $options = [ 'formId' => $this->getId(), 'vendorAutocompleteUrl' => $this->_vendorAutocompleteUrl, 'sendToElementId' => $this->getElement('sendTo')->getId(), 'categoryIdElementId' => $this->getElement('categoryId')->getId(), 'toAllVendorsCategoryId' => AbstractObj::CATEGORY_ID_RFP, 'sendToAllVendorsId' => AbstractObj::SEND_TO_ALL_VENDORS, ]; $doc->addInitObject('app.library.admin.form', [$options]); $doc->addStylesheet('css/thirdpart/jquery-ui.css'); return parent::render($view); } }