. */ class CRM_Admin_Form_Setting_MemberDashboard extends CRM_Admin_Form_Setting { protected $_values; function setDefaultValues() { return CRM_Core_BAO_Setting::getItem(MEMBERDASHBOARD_SETTINGS_GROUP); } /** * Fetch the names and ids of all unreserved profiles. */ function fetchProfiles() { $sql = 'SELECT id, title FROM civicrm_uf_group'; $dao = CRM_Core_DAO::executeQuery($sql); $profiles = array(); while($dao->fetch()) { $profiles[$dao->id] = $dao->title; } return $profiles; } public function buildQuickForm() { $this->add('select', 'memberdashboard_info_profile_id', 'Member Info Profile', $this->fetchProfiles()); $this->add('text', 'memberdashboard_button_static_url', 'Member Button Static Image URL'); $this->add('text', 'memberdashboard_button_api_url', 'Member Button API URL'); $this->add('text', 'memberdashboard_button_api_user', 'Member Button API User'); $this->add('text', 'memberdashboard_button_api_password', 'Member Button API Password'); $this->applyFilter('__ALL__', 'trim'); $this->addButtons(array( array( 'type' => 'submit', 'name' => ts('Save'), 'isDefault' => TRUE, ), )); } public function postProcess() { $params = $this->exportValues(); $profileKey = 'memberdashboard_info_profile_id'; $staticUrlKey = 'memberdashboard_button_static_url'; $apiUrlKey = 'memberdashboard_button_api_url'; $userKey = 'memberdashboard_button_api_user'; $passwordKey = 'memberdashboard_button_api_password'; civicrm_api3('setting', 'create', array( $profileKey => $params[$profileKey], $staticUrlKey => $params[$staticUrlKey], $apiUrlKey => $params[$apiUrlKey], $userKey => $params[$userKey], $passwordKey => $params[$passwordKey] )); CRM_Core_Session::setStatus(ts('Settings saved.'), '', 'success'); } }