/** * Function to build the form * * @return void * @access public */ public function buildQuickForm() { $params = array('id' => $this->_eventId); $values = array(); CRM_Core_DAO::commonRetrieve('CRM_Event_DAO_Event', $params, $values, array('title')); $buttons = array(); // only pending status class family able to confirm. $statusMsg = NULL; if (array_key_exists($this->_participantStatusId, CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'"))) { //need to confirm that though participant confirming //registration - but is there enough space to confirm. $emptySeats = CRM_Event_BAO_Participant::pendingToConfirmSpaces($this->_eventId); $additonalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_participantId); $requireSpace = 1 + count($additonalIds); if ($emptySeats !== NULL && $requireSpace > $emptySeats) { $statusMsg = ts("Oops, it looks like there are currently no available spaces for the %1 event.", array(1 => $values['title'])); } else { if ($this->_cc == 'fail') { $statusMsg = '<div class="bold">' . ts('Your Credit Card transaction was not successful. No money has yet been charged to your card.') . '</div><div><br />' . ts('Click the "Confirm Registration" button to complete your registration in %1, or click "Cancel Registration" if you are no longer interested in attending this event.', array(1 => $values['title'])) . '</div>'; } else { $statusMsg = '<div class="bold">' . ts('Confirm your registration for %1.', array(1 => $values['title'])) . '</div><div><br />' . ts('Click the "Confirm Registration" button to begin, or click "Cancel Registration" if you are no longer interested in attending this event.') . '</div>'; } $buttons = array_merge($buttons, array(array('type' => 'next', 'name' => ts('Confirm Registration'), 'spacing' => ' ', 'isDefault' => TRUE))); } } // status class other than Negative should be able to cancel registration. if (array_key_exists($this->_participantStatusId, CRM_Event_PseudoConstant::participantStatus(NULL, "class != 'Negative'"))) { $cancelConfirm = ts('Are you sure you want to cancel your registration for this event?'); $buttons = array_merge($buttons, array(array('type' => 'submit', 'name' => ts('Cancel Registration'), 'spacing' => ' ', 'js' => array('onclick' => 'return confirm(\'' . $cancelConfirm . '\');')))); if (!$statusMsg) { $statusMsg = ts('You can cancel your registration for %1 by clicking "Cancel Registration".', array(1 => $values['title'])); } } if (!$statusMsg) { $statusMsg = ts("Oops, it looks like your registration for %1 has already been cancelled.", array(1 => $values['title'])); } $this->assign('statusMsg', $statusMsg); $this->addButtons($buttons); }