+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
- *
*/
/**
* This class generates form components generic to CiviCRM settings
- *
*/
class CRM_Admin_Form_Setting extends CRM_Core_Form {
/**
* Set default values for the form.
- * default values are retrieved from the database
- *
*
- * @return void
+ * Default values are retrieved from the database.
*/
public function setDefaultValues() {
if (!$this->_defaults) {
//Set defaults for autocomplete and contact reference options
$this->_defaults['autocompleteContactSearch'] = array(
- '1' => 1
- ) + $autoSearchFields;
+ '1' => 1,
+ ) + $autoSearchFields;
$this->_defaults['autocompleteContactReference'] = array(
- '1' => 1
- ) + $cRSearchFields;
+ '1' => 1,
+ ) + $cRSearchFields;
// we can handle all the ones defined in the metadata here. Others to be converted
foreach ($this->_settings as $setting => $group) {
}
/**
- * Build the form object
- *
- * @return void
+ * Build the form object.
*/
public function buildQuickForm() {
$session = CRM_Core_Session::singleton();
}
/**
- * Process the form submission
- *
- *
- * @return void
+ * Process the form submission.
*/
public function postProcess() {
// store the submitted values in an array
}
/**
+ * Common Process.
+ *
+ * @todo Document what I do.
+ *
* @param array $params
*/
public function commonProcess(&$params) {
// save components to be enabled
if (array_key_exists('enableComponents', $params)) {
- CRM_Core_BAO_Setting::setItem($params['enableComponents'],
- CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_components');
-
- // unset params by emptying the values, so while retrieving we can detect and load from settings table
- // instead of config-backend for backward compatibility. We could use unset() in later releases.
- $params['enableComponents'] = $params['enableComponentIDs'] = array();
+ civicrm_api3('setting', 'create', array(
+ 'enable_components' => $params['enableComponents'],
+ ));
+ unset($params['enableComponents']);
}
// save checksum timeout
unset($params[$setting]);
}
CRM_Core_BAO_ConfigSetting::create($params);
+
+ CRM_Core_Config::clearDBCache();
+ CRM_Utils_System::flushCache();
+ CRM_Core_Resources::singleton()->resetCacheCode();
+
CRM_Core_Session::setStatus(" ", ts('Changes Saved'), "success");
}
$configFile = $config->uploadDir . 'Config.IDS.ini';
@unlink($configFile);
}
+
}