_initRelations(); return $this; } protected function _initRelations() { $this->_dfPreserveFields = array('durationType'); $this->_dfRelations = array( array( '_element' => 'moreInfoType', 'node' => '[name="moreInfoType"]:checked', 'group' => '[name="moreInfoType"]', 'event' => 'change', 'rules' => array( array( 'value' => 'none', '_elements' => array() ), array( 'value' => 'url', '_elements' => array('moreInfoUrl') ), array( 'value' => 'page', '_elements' => array('moreInfoPage') ), ) ), array( 'element' => 'type', 'node' => '[name="type"]:checked', 'group' => '[name="type"]', 'event' => 'change', 'rules' => array( array( 'value' => 'regular', 'activateFn' => new \Zend_Json_Expr('app.event.admin.Form.prototype.onRegularTypeChanged'), 'nodes' => array('#registrationGroup-element'), '_elements' => array( 'durationType', 'registrationStartDate', 'registrationStartTime', 'registrationEndDate', 'registrationEndTime', 'regularPrice', 'memberPrice', 'registrationLimit', 'registrationUrl', 'showWaiver', ) ), array( 'value' => 'group', 'activateFn' => new \Zend_Json_Expr('app.event.admin.Form.prototype.onGroupTypeChanged'), 'nodes' => array('#registrationGroup-element'), '_elements' => array( 'durationType', 'registrationStartDate', 'registrationStartTime', 'registrationEndDate', 'registrationEndTime', 'regularPrice', 'memberPrice', 'groupLimit', 'registrationLimit', 'showWaiver', ) ), array( 'value' => 'committee', 'activateFn' => new \Zend_Json_Expr('app.event.admin.Form.prototype.onCommitteeTypeChanged'), '_elements' => array('committeeId', 'agendaFileName') ), array( 'value' => 'other', 'activateFn' => new \Zend_Json_Expr('app.event.admin.Form.prototype.onOtherTypeChanged'), '_elements' => array('durationType', 'registrationUrl'), ), ) ), array( 'element' => 'durationType', 'node' => '[name="durationType"]:checked', 'group' => '[name="durationType"]', 'event' => 'change', 'rules' => array( array( 'value' => 'single', 'activateFn' => new \Zend_Json_Expr('app.event.admin.Form.prototype.switchToSingle'), '_elements' => array() ), array( 'value' => 'multiple', 'activateFn' => new \Zend_Json_Expr('app.event.admin.Form.prototype.switchToMulti'), '_elements' => array('endDate') ), ) ), array( 'element' => 'registrationUrl', 'node' => '[name="registrationUrl"]', 'event' => 'change', 'rules' => array( array( 'value' => '', '_elements' => array('registrationLimit') ), array( 'value' => new \Zend_Json_Expr('function(value) { return value > ""; }'), '_value' => function ($value) { return $value > ''; }, '_elements' => array() ), ) ), ); return $this; } protected function _initPaths() { parent::_initPaths(); $this->addPrefixPath('App\Event\Admin\Form\Element', 'App/Event/Admin/Form/Element/', self::ELEMENT); $this->addPrefixPath('App\Event\Admin\Form\Decorator', 'App/Event/Admin/Form/Decorator/', self::DECORATOR); $this->getView()->addHelperPath('App/Event/Admin/View/Helper', 'App\Event\Admin\View\Helper'); return $this; } /** * @param string $name element name * @return string element label id (e.g. foo-label) */ protected function _dfGetElementLabelId($name) { return $this->getElement($name)->getId() . '-label'; } /** * @param string $name element name * @return string element container id (e.g. foo-element) */ protected function _dfGetElementContainerId($name) { return $this->getElement($name)->getId() . '-element'; } public function getValues($suppressArrayNotation = false) { $values = parent::getValues($suppressArrayNotation); $this->dfClearUnusedValues($values); return $values; } protected function _initElements() { $this->_addTitleElement(); $this->_addTypeElement(); $this->_addDurationElement(); $this->_addRegistrationTimeElement(); $this->_addLocationElement(); $this->_addGoogleMapUrlElement(); $this->_addRegistrationUrlElement(); $this->_addMoreInfoElement(); $this->_addCommitteeElement(); $this->_addDescriptionElement(); $this->_addAgendaElement(); $this->_addRegularPriceElement(); $this->_addMemberPriceElement(); $this->_addGroupLimitElement(); $this->_addRegistrationLimitElement(); $this->_addShowWaiverElement(); $this->_addShowElement(); return $this; } protected function _addResources() { /** @var $doc \Qs_Doc */ $doc = \Zend_Registry::get('doc'); $doc->addScript('js/jquery.dynamicForm.js'); $doc->addScript('js/app/event/admin/form.js'); $options = array( 'formId' => $this->getId(), 'relations' => $this->dfConvertRelations(), 'timeDefaults' => self::$timeDefaults, ); $doc->addInitObject('app.event.admin.Form', array($options), 'appEventAdminForm'); return parent::_addResources(); } }