/** * Build the form object. * * @return void */ public function buildQuickForm() { CRM_PCP_BAO_PCP::buildPCPForm($this); $this->addElement('checkbox', 'pcp_active', ts('Enable Personal Campaign Pages? (for this event)'), NULL, array('onclick' => "return showHideByValue('pcp_active',true,'pcpFields','table-row','radio',false);")); $this->add('select', 'target_entity_type', ts('Campaign Type'), array('' => ts('- select -'), 'event' => ts('Event'), 'contribute' => ts('Contribution')), NULL, array('onchange' => "return showHideByValue('target_entity_type','contribute','pcpDetailFields','block','select',false);")); $this->add('select', 'target_entity_id', ts('Online Contribution Page'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionPage()); parent::buildQuickForm(); // If at least one PCP has been created, don't allow changing the target $pcpBlock = new CRM_PCP_DAO_PCPBlock(); $pcpBlock->entity_table = 'civicrm_event'; $pcpBlock->entity_id = $this->_id; $pcpBlock->find(TRUE); if (!empty($pcpBlock->id) && CRM_PCP_BAO_PCP::getPcpBlockInUse($pcpBlock->id)) { foreach (array('target_entity_type', 'target_entity_id') as $element_name) { $element = $this->getElement($element_name); $element->freeze(); } } $this->addFormRule(array('CRM_PCP_Form_Event', 'formRule'), $this); }
/** * Function to build the form * * @return void * @access public */ public function buildQuickForm() { CRM_PCP_BAO_PCP::buildPCPForm($this); $this->addElement('checkbox', 'pcp_active', ts('Enable Personal Campaign Pages? (for this contribution page)'), NULL, array('onclick' => "return showHideByValue('pcp_active',true,'pcpFields','table-row','radio',false);")); parent::buildQuickForm(); $this->addFormRule(array('CRM_PCP_Form_Contribute', 'formRule'), $this); }