3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This class generates form components for the display preferences.
21 class CRM_Admin_Form_Preferences_Display
extends CRM_Admin_Form_Preferences
{
23 protected $_settings = [
24 'contact_view_options' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
25 'contact_smart_group_display' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
26 'contact_edit_options' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
27 'advanced_search_options' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
28 'user_dashboard_options' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
29 'contact_ajax_check_similar' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
30 'activity_assignee_notification' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
31 'activity_assignee_notification_ics' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
32 'do_not_notify_assignees_for' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
33 'preserve_activity_tab_filter' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
34 'editor_id' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
35 'ajaxPopupsEnabled' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
36 'display_name_format' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
37 'sort_name_format' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
38 'menubar_position' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
39 'menubar_color' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
40 'theme_backend' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
41 'theme_frontend' => CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
,
45 * Build the form object.
47 public function buildQuickForm() {
49 //changes for freezing the invoices/credit notes checkbox if invoicing is uncheck
50 $invoiceSettings = Civi
::settings()->get('contribution_invoice_settings');
51 $this->assign('invoicing', CRM_Invoicing_Utils
::isInvoicingEnabled());
53 $this->addElement('submit', 'ckeditor_config', ts('Configure CKEditor'));
55 $editOptions = CRM_Core_OptionGroup
::values('contact_edit_options', FALSE, FALSE, FALSE, 'AND v.filter = 0');
56 $this->assign('editOptions', $editOptions);
58 $contactBlocks = CRM_Core_OptionGroup
::values('contact_edit_options', FALSE, FALSE, FALSE, 'AND v.filter = 1');
59 $this->assign('contactBlocks', $contactBlocks);
61 $nameFields = CRM_Core_OptionGroup
::values('contact_edit_options', FALSE, FALSE, FALSE, 'AND v.filter = 2');
62 $this->assign('nameFields', $nameFields);
64 $this->addElement('hidden', 'contact_edit_preferences', NULL, ['id' => 'contact_edit_preferences']);
66 $optionValues = CRM_Core_OptionGroup
::values('user_dashboard_options', FALSE, FALSE, FALSE, NULL, 'name');
67 $invoicesKey = array_search('Invoices / Credit Notes', $optionValues);
68 $this->assign('invoicesKey', $invoicesKey);
69 parent
::buildQuickForm();
73 * Process the form submission.
75 public function postProcess() {
76 if ($this->_action
== CRM_Core_Action
::VIEW
) {
80 $this->_params
= $this->controller
->exportValues($this->_name
);
82 if (!empty($this->_params
['contact_edit_preferences'])) {
83 $preferenceWeights = explode(',', $this->_params
['contact_edit_preferences']);
84 foreach ($preferenceWeights as $key => $val) {
86 unset($preferenceWeights[$key]);
89 $opGroupId = CRM_Core_DAO
::getFieldValue('CRM_Core_DAO_OptionGroup', 'contact_edit_options', 'id', 'name');
90 CRM_Core_BAO_OptionValue
::updateOptionWeights($opGroupId, array_flip($preferenceWeights));
93 $this->postProcessCommon();
95 // If "Configure CKEditor" button was clicked
96 if (!empty($this->_params
['ckeditor_config'])) {
97 // Suppress the "Saved" status message and redirect to the CKEditor Config page
98 $session = CRM_Core_Session
::singleton();
99 $session->getStatus(TRUE);
100 $url = CRM_Utils_System
::url('civicrm/admin/ckeditor', 'reset=1');
101 $session->pushUserContext($url);