--- /dev/null
+<?php
+/**
+ * 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 copy, modify, and
+ * distribute it under the terms of the GNU Affero General Public
+ * License Version 3, 19 November 2007 and the CiviCRM Licensing
+ * Exception.
+ *
+ * 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
+ * Affero 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
+ * <http://www.gnu.org/licenses/>.
+ */
+
+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');
+ }
+}
--- /dev/null
+{*
+ 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
+ <http://www.gnu.org/licenses/>.
+*}
+
+<div class="crm-block crm-form-block crm-regionlookup-form-block">
+ <fieldset>
+ <legend>{ts}Info Profile{/ts}</legend>
+
+ <div class="help">
+ {ts}The profile that members should see when editing their
+ contact information.{/ts}
+ </div>
+
+ <table class="form-layout-compressed">
+ <tr>
+ <td class="label">
+ {$form.memberdashboard_info_profile_id.label}
+ </td>
+ <td>
+ {$form.memberdashboard_info_profile_id.html}
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+
+ <div class="crm-submit-buttons">
+ {include file="CRM/common/formButtons.tpl" location="bottom"}
+ </div>
+</div>
<?xml version="1.0"?>
<menu>
+ <item>
+ <path>civicrm/admin/setting/memberdashboard</path>
+ <title>FSF Member Dashboard Settings</title>
+ <page_callback>CRM_Admin_Form_Setting_MemberDashboard</page_callback>
+ <adminGroup>System Settings</adminGroup>
+ <access_arguments>administer CiviCRM</access_arguments>
+ </item>
<item>
<path>civicrm/member-dashboard</path>
<page_callback>CRM_Memberdashboard_Page_MemberDashboard</page_callback>