_id = $this->get('id'); $this->_BAOName = $this->get('BAOName'); } /** * This function sets the default values for the form. MobileProvider that in edit/view mode * the default values are retrieved from the database * * @access public * * @return array defaults */ function setDefaultValues() { $defaults = array(); if (isset($this->_id)) { $params = array('id' => $this->_id); $baoName = $this->_BAOName; $baoName::retrieve($params, $defaults); } if (isset($defaults['minimum_fee'])) { $defaults['minimum_fee'] = CRM_Utils_Money::format($defaults['minimum_fee'], NULL, '%a'); } if (isset($defaults['status'])) { $this->assign('membershipStatus', $defaults['status']); } if ($this->_action & CRM_Core_Action::ADD) { $defaults['is_active'] = 1; } if (isset($defaults['member_of_contact_id']) && $defaults['member_of_contact_id'] ) { $defaults['member_org'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $defaults['member_of_contact_id'], 'display_name' ); } return $defaults; } /** * Function to actually build the form * * @return void * @access public */ public function buildQuickForm() { if ($this->_action & CRM_Core_Action::RENEW) { $this->addButtons(array( array( 'type' => 'upload', 'name' => ts('Renew'), 'isDefault' => TRUE ), array( 'type' => 'cancel', 'name' => ts('Cancel') ) ) ); } elseif ($this->_action & CRM_Core_Action::DELETE) { $this->addButtons(array( array( 'type' => 'next', 'name' => ts('Delete'), 'isDefault' => TRUE ), array( 'type' => 'cancel', 'name' => ts('Cancel') ) ) ); } else { $this->addButtons(array( array( 'type' => 'upload', 'name' => ts('Save'), 'isDefault' => TRUE ), array( 'type' => 'upload', 'name' => ts('Save and New'), 'subName' => 'new' ), array( 'type' => 'cancel', 'name' => ts('Cancel') ) ) ); } } }