From 6b4f39a8f62f7ba223682728bf8681ddbb5d3884 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 21 Oct 2014 10:04:05 -0400 Subject: [PATCH] Add a settings page. * CRM/Admin/Form/Setting/MemberDashboard.php: New file. * templates/CRM/Admin/Form/Setting/MemberDashboard.tpl: New file. * xml/Menu/memberdashboard.xml: Add menu entry. --- CRM/Admin/Form/Setting/MemberDashboard.php | 63 +++++++++++++++++++ .../Admin/Form/Setting/MemberDashboard.tpl | 46 ++++++++++++++ xml/Menu/memberdashboard.xml | 7 +++ 3 files changed, 116 insertions(+) create mode 100644 CRM/Admin/Form/Setting/MemberDashboard.php create mode 100644 templates/CRM/Admin/Form/Setting/MemberDashboard.tpl diff --git a/CRM/Admin/Form/Setting/MemberDashboard.php b/CRM/Admin/Form/Setting/MemberDashboard.php new file mode 100644 index 0000000..b9c4ca6 --- /dev/null +++ b/CRM/Admin/Form/Setting/MemberDashboard.php @@ -0,0 +1,63 @@ +. + */ + +class CRM_Admin_Form_Setting_MemberDashboard extends CRM_Admin_Form_Setting { + protected $_values; + + function setDefaultValues() { + return CRM_Core_BAO_Setting::getItem(MEMBERDASHBOARD_SETTINGS_GROUP); + } + + public function buildQuickForm() { + // Fetch the names and ids of all unreserved profiles. + $sql = 'SELECT id, title FROM civicrm_uf_group WHERE is_reserved=0'; + $dao = CRM_Core_DAO::executeQuery($sql); + $profiles = array(); + + while($dao->fetch()) { + $profiles[$dao->id] = $dao->title; + } + + $this->add('select', 'memberdashboard_info_profile_id', + 'Member Info Profile', $profiles); + $this->applyFilter('__ALL__', 'trim'); + $this->addButtons(array( + array( + 'type' => 'submit', + 'name' => ts('Save'), + 'isDefault' => TRUE, + ), + )); + } + + public function postProcess() { + $params = $this->exportValues(); + $key = 'memberdashboard_info_profile_id'; + $value = $params[$key]; + + civicrm_api3('setting', 'create', array( + $key => $value + )); + + CRM_Core_Session::setStatus(ts('Settings saved.'), '', 'success'); + } +} diff --git a/templates/CRM/Admin/Form/Setting/MemberDashboard.tpl b/templates/CRM/Admin/Form/Setting/MemberDashboard.tpl new file mode 100644 index 0000000..245e05f --- /dev/null +++ b/templates/CRM/Admin/Form/Setting/MemberDashboard.tpl @@ -0,0 +1,46 @@ +{* + FSF Member Dashboard + Copyright © 2014 Free Software Foundation, Inc. + + This file is a part of FSF Member Dashboard. + + FSF Member Dashboard is free software: you can redistribute it + and/or modify it under the terms of the GNU Affero General Public + License as published by the Free Software Foundation, either version + 3 of the License, or (at your option) any later version. + + FSF Member Dashboard is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FSF Member Dashboard. If not, see + . +*} + +
+
+ {ts}Info Profile{/ts} + +
+ {ts}The profile that members should see when editing their + contact information.{/ts} +
+ + + + + + +
+ {$form.memberdashboard_info_profile_id.label} + + {$form.memberdashboard_info_profile_id.html} +
+
+ +
+ {include file="CRM/common/formButtons.tpl" location="bottom"} +
+
diff --git a/xml/Menu/memberdashboard.xml b/xml/Menu/memberdashboard.xml index 8792b7c..c9e9749 100644 --- a/xml/Menu/memberdashboard.xml +++ b/xml/Menu/memberdashboard.xml @@ -1,5 +1,12 @@ + + civicrm/admin/setting/memberdashboard + FSF Member Dashboard Settings + CRM_Admin_Form_Setting_MemberDashboard + System Settings + administer CiviCRM + civicrm/member-dashboard CRM_Memberdashboard_Page_MemberDashboard -- 2.25.1