_initUserElement(); $this->_initEventElement(); return $this; } protected function _initUserElement() { if (($userId = (int) $this->_getData('userId')) && false !== ($name = UserObj::getAutocompleteItemTitle($userId)) ) { $this->addElement('hidden', 'userId', ['value' => $userId]); $this->addElement( 'static', 'userName', [ 'label' => 'Individual', 'value' => $name, ] ); } return $this; } protected function _initEventElement() { $userId = (int) $this->_getData('userId'); $multiOptions = $this->getDataObj()->getAvailableEvents4Select($userId); if (empty($multiOptions)) { $this->addElement('static', 'eventId', ['label' => 'Event', 'value' => 'No Events Available']); $this->getElement('eventId')->getDecorator('htmlTag')->setOption('class', 'errors'); return $this; } $this->addElement( 'select', 'eventId', [ 'label' => 'Event', 'multiOptions' => ['' => 'Select Event'] + (array) $multiOptions, 'required' => true, ] ); return $this; } public function setDataObj($dataObj) { $this->_dataObj = $dataObj; return $this; } public function getDataObj() { if (null == $this->_dataObj) { throw new Qs_Exception_EmptyPropertyException($this, '_dataObj'); } return $this->_dataObj; } public function getCancelUrl() { if (null === $this->_cancelUrl) { if (($url = EventView::getPage('url'))) { $this->_cancelUrl = $url; } else { $this->_cancelUrl = Qs_Constant::get('BASE_URL_LANGUAGE'); } } return $this->_cancelUrl; } }