4 * Copyright © 2014 Free Software Foundation, Inc.
6 * This file is a part of FSF Member Dashboard.
8 * FSF Member Dashboard is free software; you can copy, modify, and
9 * distribute it under the terms of the GNU Affero General Public
10 * License Version 3, 19 November 2007 and the CiviCRM Licensing
13 * FSF Member Dashboard is distributed in the hope that it will be
14 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Affero General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with FSF Member Dashboard. If not, see
20 * <http://www.gnu.org/licenses/>.
23 class CRM_Admin_Form_Setting_MemberDashboard
extends CRM_Admin_Form_Setting
{
26 function setDefaultValues() {
27 return CRM_Core_BAO_Setting
::getItem(MEMBERDASHBOARD_SETTINGS_GROUP
);
31 * Fetch the names and ids of all unreserved profiles.
33 function fetchProfiles() {
34 $sql = 'SELECT id, title FROM civicrm_uf_group WHERE is_reserved=0';
35 $dao = CRM_Core_DAO
::executeQuery($sql);
38 while($dao->fetch()) {
39 $profiles[$dao->id
] = $dao->title
;
45 public function buildQuickForm() {
46 $this->add('select', 'memberdashboard_info_profile_id',
47 'Member Info Profile', $this->fetchProfiles());
48 $this->applyFilter('__ALL__', 'trim');
49 $this->addButtons(array(
58 public function postProcess() {
59 $params = $this->exportValues();
60 $key = 'memberdashboard_info_profile_id';
61 $value = $params[$key];
63 civicrm_api3('setting', 'create', array(
67 CRM_Core_Session
::setStatus(ts('Settings saved.'), '', 'success');