addElement( 'select', 'year', array( 'label' => 'Applicable Year', 'multiOptions' => array('' => 'Select One') + (new App_FPL_Admin_Obj())->getFPLYears4Select(), 'required' => true ) ); $this->addElement( 'multiDraggableSelect', 'counties', array( 'label' => 'Counties', 'required' => true, 'height' => 300, 'multiOptions' => ($data = $this->_getData()) ? (new App_BenchmarkPlans_Admin_Obj())->getCounties4Select($data['id'], $data['year']) : array(), 'description' => 'Click twice on the name of the county to move between tables.' ) ); /** @var Zend_Form_Element_Select $countiesElement */ $countiesElement = $this->getElement('counties'); $countiesElement->setRegisterInArrayValidator(false); $this->addElement( 'extendedFile', 'file', array( 'label' => 'File', 'required' => true, 'downloadLinkText' => 'Download existing', 'validators' => array(array('Extension', false, 'csv')), 'description' => 'Only .csv files allowed' ) ); /** @var $extendedFile Qs_Form_Decorator_ExtendedFile */ if (($extendedFile = $this->getElement('file')->getDecorator('ExtendedFile'))) { $extendedFile->setAdditionalHtmlBeforeElement( (($this->_getData('file')) ? ' or Upload new ' : 'Upload new ') ); } return $this; } public function render(\Zend_View_Interface $view = null) { /** @var $doc \App_Doc_Site */ $doc = \Zend_Registry::get('doc'); $doc->addScript('js/app/benchmarkPlan/admin.js'); $doc->addInitObject('app.BenchmarkPlans_Admin', array(array('id' => $this->_getData('id')))); return parent::render($view); } }