getMethod(); if (0 == strcasecmp($_SERVER['REQUEST_METHOD'], $method)) { $data = \Qs_Request::get($method); $itemIdMatched = true; if (($itemId = $this->getCmsItemId())) { $itemIdMatched = (isset($data['__idItem']) && $data['__idItem'] == $itemId); } return ($itemIdMatched && 0 === strpos($data['action'], 'insert')); } return false; } protected function _initElements() { $defaults = (array) $this->_getDefaults(); if (count($defaults) > $this->getMaxAttendeeCount()) { $defaults = array_slice($defaults, 0, $this->getMaxAttendeeCount(), true); } // current attendee if ($this->getAllowCurrentUser() && NewForm::RENDER_MODE_FULL === $this->getRenderMode()) { $form = new AttendeeItemForm(array( 'allowNonMembers' => $this->getAllowNonMembers(), 'currentUserId' => $this->getCurrentUserId(), 'showWaiver' => $this->getShowWaiver(), 'mode' => AttendeeItemForm::MODE_CURRENT_USER, 'index' => 'current', )); $this->addSubForm($form, 'current'); $firstItem = reset($defaults); $itemMode = (isset($firstItem['mode'])) ? $firstItem['mode'] : AttendeeItemForm::MODE_CHOOSE_TYPE; if (NewForm::RENDER_MODE_FULL === $this->getRenderMode() && $firstItem && AttendeeItemForm::MODE_CURRENT_USER === $itemMode) { unset($defaults['current']); } } // additional attendees if ($this->getAllowNonMembers() || $this->getAllowMembers()) { $itemOptions = array( 'allowMembers' => $this->getAllowMembers(), 'currentUserId' => $this->getCurrentUserId(), 'allowNonMembers' => $this->getAllowNonMembers(), 'userAutocompleteUrl' => $this->getUserAutocompleteUrl(), 'showWaiver' => $this->getShowWaiver(), ); foreach ($defaults as $index => $data) { $itemOptions['defaults'] = (array) $data; $itemOptions['index'] = $index; $form = new AttendeeItemForm($itemOptions); $this->addSubForm($form, (string) $index); } } return $this; } public function loadDefaultDecorators() { if (false == $this->loadDefaultDecoratorsIsDisabled() && null == $this->getDecorators()) { if (NewForm::RENDER_MODE_ATTENDEE === $this->getRenderMode()) { $this->addDecorator('FormElements'); } else { $this->addDecorator('FormElements') ->addDecorator('DtDdWrapper'); } } return $this; } public function initRender() { parent::initRender(); if (($decorator = $this->getDecorator('HtmlTag'))) { $decorator->setOption('id', $this->getId()); } return $this; } public function setRenderMode($renderMode) { $this->_renderMode = $renderMode; return $this; } public function getRenderMode() { return $this->_renderMode; } public function setIndex($index) { $this->_index = (int) $index; return $this; } public function getIndex() { return $this->_index; } public function setMaxAttendeeCount($maxAttendeeCount) { $this->_maxAttendeeCount = $maxAttendeeCount; return $this; } public function getMaxAttendeeCount() { return $this->_maxAttendeeCount; } public function setAllowMembers($allowMembers) { $this->_allowMembers = $allowMembers; return $this; } public function getAllowMembers() { return $this->_allowMembers; } public function setAllowNonMembers($allowNonMembers) { $this->_allowNonMembers = $allowNonMembers; return $this; } public function getAllowNonMembers() { return $this->_allowNonMembers; } public function setCurrentUserId($currentUserId) { $this->_currentUserId = $currentUserId; return $this; } public function getCurrentUserId() { return $this->_currentUserId; } public function setAllowCurrentUser($allowCurrentUser) { $this->_allowCurrentUser = $allowCurrentUser; return $this; } public function getAllowCurrentUser() { return $this->_allowCurrentUser; } public function setUserAutocompleteUrl($userAutocompleteUrl) { $this->_userAutocompleteUrl = $userAutocompleteUrl; return $this; } public function getUserAutocompleteUrl() { return $this->_userAutocompleteUrl; } public function getShowWaiver() { return $this->_showWaiver; } public function setShowWaiver($showWaiver) { $this->_showWaiver = $showWaiver; } }