_dfRelations = $this->getConfigArray('dynamicFormRelations'); return parent::init(); } protected function _initElements() { $this->addElement( 'select', 'status', [ 'label' => 'Status', 'required' => true, 'multioptions' => ['' => 'Select One'] + $this->_getStatuses() ] ); $this->_initCompanyFields(); $this->_initPersonalFields(); $this->_initListsFields(); $this->_initLeadershipFields(); return $this; } public function getCompanyId() { return $this->_getData('companyId'); } protected function _initCompanyFields() { $this->addElement('header', '_companyInfo', ['label' => 'Company Information']); $this->_initCompanyField(); $this->companyId->setRequired(false); return $this; } protected function _initPersonalFields() { $this->addElement('header', '_personalInfo', ['label' => 'Personal Information']); parent::_initPersonalFields(); $this->addElement('textarea', 'notes', ['label' => 'Notes']); return $this; } protected function _initListsFields() { $this->addElement('header', '_lists', ['label' => 'Lists']); $this->addElement('multiCheckbox', 'lists', ['columns' => 3, 'multioptions' => $this->_getLists()]); $this->getElement('lists')->getDecorator('Label')->setTagOption('class', 'hidden'); return $this; } protected function _initLeadershipFields() { $this->addElement('header', '_leadership', ['label' => 'Leadership']); $this->addElement( 'select', 'leadershipGroupId', [ 'label' => 'Leadership Group', 'multioptions' => ['' => 'Select One'] + $this->_getLeadershipGroups() ] ); $this->addElement('text', 'leadershipPosition', ['label' => 'Position']); $photoConfig = $this->getConfig('photo'); $resize = $photoConfig->width . 'x' . $photoConfig->height . Qs_ImageFs::getResizeMethodAlias($photoConfig->resizeMethod); $this->addElement( 'extendedImage', 'leadershipPhoto', [ 'label' => 'Photo', 'resize' => $resize, 'defaultThumbnail' => 'images/member-no-photo.png', ] ); $this->addElement( 'url', 'linkedInUrl', [ 'label' => 'LinkedIn Profile Link', 'description' => 'Example: http://www.linkedin.com/profile/view?id=58004809' ] ); $this->addElement('htmlEditor', 'leadershipBio', ['label' => 'Bio']); $this->addSeoGroup('User', ['nickname', 'lastName']); $this->getElement('alias')->setRequired('' != $this->_getData('leadershipGroupId')); $this->getElement('alias')->getDecorator('Label')->setOption('class', 'required'); return $this; } protected function _get4Select($tableAlias) { $table = new Qs_Db_Table($tableAlias); return $table->get4Select(); } protected function _getStatuses() { return $this->_get4Select('UserStatus'); } protected function _getLists() { return $this->_get4Select('List'); } protected function _getLeadershipGroups() { return $this->_get4Select('LeadershipGroup'); } public function render(Zend_View_Interface $view = null) { $html = Qs_Form::render($view); /** @var $doc \App_Doc_Admin */ $doc = $this->getDoc(); $doc->addScript('js/jquery.defaultHint.js', array(), 'defaultHint'); $options = [ 'formId' => $this->getId(), 'aliasId' => $this->getElement('alias')->getId(), 'hintOptions' => [ 'elements' => [ ['selector' => '#_companyId', 'hint' => 'Autocomplete field'] ], 'useWrapper' => true ], ]; $doc->addScript('js/app/user/admin/form.js'); $doc->addInitObject('app.user.admin.form', [$options]); return $html; } }