_userContext = $session->readUserContext(); CRM_Utils_System::setTitle(ts('Batch Update for Event Participants')); $validate = FALSE; //validations if (count($this->_participantIds) > $this->_maxParticipations) { CRM_Core_Session::setStatus("The maximum number of event participations you can select for Batch Update is {$this->_maxParticipations}. You have selected " . count($this->_participantIds) . ". Please select fewer participantions from your search results and try again."); $validate = TRUE; } // then redirect if ($validate) { CRM_Utils_System::redirect($this->_userContext); } } /** * Build the form object * * * @return void */ public function buildQuickForm() { $types = array('Participant'); $profiles = CRM_Core_BAO_UFGroup::getProfiles($types, TRUE); if (empty($profiles)) { CRM_Core_Session::setStatus("To use Batch Update for event participants, you need to configure a profile containing only Participant fields (e.g. Participant Status, Participant Role, etc.). Configure a profile at 'Administer CiviCRM >> Customize >> CiviCRM Profile'."); CRM_Utils_System::redirect($this->_userContext); } $ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'), array( '' => ts('- select profile -')) + $profiles, TRUE ); $this->addDefaultButtons(ts('Continue')); } /** * Add local and global form rules * * * @return void */ public function addRules() { $this->addFormRule(array('CRM_Event_Form_Task_PickProfile', 'formRule')); } /** * Global validation rules for the form * * @param array $fields * Posted values of the form. * * @return array * list of errors to be posted back to the form * @static */ public static function formRule($fields) { return TRUE; } /** * Process the form after the input has been submitted and validated * * * @return void */ public function postProcess() { $params = $this->exportValues(); $this->set('ufGroupId', $params['uf_group_id']); // also reset the batch page so it gets new values from the db $this->controller->resetPage('Batch'); } }