getConfig('mode'); if (Module::MODE_SIMPLE == $mode) { $this->_initStatusFields(); $this->_initSimpleElements(); } else if (Module::MODE_ASSOCIATION == $mode) { $this->_initAssociationElements(); } else { throw new Qs_Exception('Unknown module mode.'); } return $this; } protected function _initMembershipTypeFields() { parent::_initMembershipTypeFields(); $this->addElement('date', 'expiredOn', [ 'label' => 'Membership Expired On', 'description' => 'Leave field blank to make membership infinite', ]); $this->_initStatusFields(); return $this; } protected function _initIndividualFields($full = true) { parent::_initIndividualFields($full); $this->photo->setRequired(false); $this->_initAdditionalAssociationFields(); return $this; } protected function _initAdditionalAssociationFields() { $this->addElement('date', 'joinDate', ['label' => 'Join Date']); $this->addElement('textarea', 'notes', ['label' => 'Notes']); $this->_addLeadershipFields(); return $this; } protected function _addLeadershipFields() { $this->addElement( 'select', 'leadershipGroupId', [ 'label' => 'Leadership Group', 'multioptions' => ['' => 'Select One'] + $this->_getLeadershipGroups(), ] ); $this->addElement('text', 'leadershipPosition', ['label' => 'Leadership Position']); $this->addDisplayGroup( ['leadershipGroupId', 'leadershipPosition'], 'leadershipGroup', ['legend' => 'Leadership'] ); return $this; } protected function _initStatusFields() { $this->addElement( 'select', 'status', [ 'label' => 'Account Status', 'required' => true, 'multioptions' => ['' => 'Select One'] + $this->_getStatuses(), ] ); return $this; } protected function _get4Select($tableAlias) { $table = new Qs_Db_Table($tableAlias); return $table->get4Select(); } protected function _getStatuses() { return $this->_get4Select('UserStatus'); } 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 = Zend_Registry::get('doc'); $options = $this->_getScriptOptions(); $doc->addScript('js/app/user/admin/form.js'); $doc->addInitObject('app.user.admin.form', [$options]); return $html; } }