_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this); if ($this->_context == 'view') { $this->_single = TRUE; $participantID = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); $contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); $this->_participantIds = [$participantID]; $this->_componentClause = " civicrm_participant.id = $participantID "; $this->assign('totalSelectedParticipants', 1); // also set the user context to send back to view page $session = CRM_Core_Session::singleton(); $session->pushUserContext(CRM_Utils_System::url('civicrm/contact/view/participant', "reset=1&action=view&id={$participantID}&cid={$contactID}" )); } else { parent::preProcess(); } } /** * Build the form object. */ public function buildQuickForm() { CRM_Utils_System::setTitle(ts('Make Name Badges')); // Ajax submit would interfere with file download $this->preventAjaxSubmit(); //add select for label $label = CRM_Badge_BAO_Layout::getList(); $this->add('select', 'badge_id', ts('Name Badge Format'), [ '' => ts('- select -'), ] + $label, TRUE ); $next = 'next'; $back = $this->_single ? 'cancel' : 'back'; $this->addDefaultButtons(ts('Make Name Badges'), $next, $back); } /** * Process the form after the input has been submitted and validated. */ public function postProcess() { $params = $this->controller->exportValues($this->_name); CRM_Badge_BAO_Badge::buildBadges($params, $this); } }