本文整理汇总了PHP中CRM_Core_BAO_Domain::edit方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Domain::edit方法的具体用法?PHP CRM_Core_BAO_Domain::edit怎么用?PHP CRM_Core_BAO_Domain::edit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Domain
的用法示例。
在下文中一共展示了CRM_Core_BAO_Domain::edit方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
/**
* Function to process the form
*
* @access public
*
* @return void
*/
public function postProcess()
{
$params = $this->controller->exportValues($this->_name);
$this->_numStrings = sizeof($params['old']);
$enabled['exactMatch'] = $enabled['wildcardMatch'] = $disabled['exactMatch'] = $disabled['wildcardMatch'] = array();
for ($i = 1; $i <= $this->_numStrings; $i++) {
if (!empty($params['new'][$i]) && !empty($params['old'][$i])) {
if (isset($params['enabled']) && !empty($params['enabled'][$i])) {
if (!empty($params['cb']) && !empty($params['cb'][$i])) {
$enabled['exactMatch'] += array($params['old'][$i] => $params['new'][$i]);
} else {
$enabled['wildcardMatch'] += array($params['old'][$i] => $params['new'][$i]);
}
} else {
if (isset($params['cb']) && is_array($params['cb']) && array_key_exists($i, $params['cb'])) {
$disabled['exactMatch'] += array($params['old'][$i] => $params['new'][$i]);
} else {
$disabled['wildcardMatch'] += array($params['old'][$i] => $params['new'][$i]);
}
}
}
}
$overrides = array('enabled' => $enabled, 'disabled' => $disabled);
$config = CRM_Core_Config::singleton();
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
if ($domain->locales && $config->localeCustomStrings) {
// for multilingual
$addReplacements = $config->localeCustomStrings;
$addReplacements[$config->lcMessages] = $overrides;
$stringOverride = serialize($addReplacements);
} else {
// for single language
$stringOverride = serialize(array($config->lcMessages => $overrides));
}
$params = array('locale_custom_strings' => $stringOverride);
$id = CRM_Core_Config::domainID();
$wordReplacementSettings = CRM_Core_BAO_Domain::edit($params, $id);
if ($wordReplacementSettings) {
// This controller was originally written to CRUD $config->locale_custom_strings,
// but that's no longer the canonical store. Sync changes to canonical store.
// This is inefficient - at some point, we should rewrite this UI.
CRM_Core_BAO_WordReplacement::rebuildWordReplacementTable();
CRM_Core_Session::setStatus("", ts("Settings Saved"), "success");
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/options/wordreplacements', "reset=1"));
}
}
示例2: postProcess
/**
* Process the form when submitted
*
* @return void
* @access public
*/
public function postProcess()
{
require_once 'CRM/Core/BAO/Domain.php';
$params = array();
$params = $this->exportValues();
$params['entity_id'] = $this->_id;
$params['entity_table'] = CRM_Core_BAO_Domain::getTableName();
$domain = CRM_Core_BAO_Domain::edit($params, $this->_id);
require_once 'CRM/Core/BAO/LocationType.php';
$defaultLocationType =& CRM_Core_BAO_LocationType::getDefault();
$location = array();
$params['address'][1]['location_type_id'] = $defaultLocationType->id;
$params['phone'][1]['location_type_id'] = $defaultLocationType->id;
$params['email'][1]['location_type_id'] = $defaultLocationType->id;
$location = CRM_Core_BAO_Location::create($params, true, 'domain');
$params['loc_block_id'] = $location['id'];
require_once 'CRM/Core/BAO/Domain.php';
CRM_Core_BAO_Domain::edit($params, $this->_id);
//set domain from email address, CRM-3552
$emailName = '"' . $params['email_name'] . '"<' . $params['email_address'] . '>';
$emailParams = array('label' => $emailName, 'description' => $params['description'], 'is_active' => 1, 'is_default' => 1);
$groupParams = array('name' => 'from_email_address');
//get the option value wt.
if ($this->_fromEmailId) {
$action = $this->_action;
$emailParams['weight'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $this->_fromEmailId, 'weight');
} else {
//add from email address.
$action = CRM_Core_Action::ADD;
require_once 'CRM/Utils/Weight.php';
$grpId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'from_email_address', 'id', 'name');
$fieldValues = array('option_group_id' => $grpId);
$emailParams['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', $fieldValues);
}
require_once 'CRM/Core/OptionValue.php';
//reset default within domain.
$emailParams['reset_default_for'] = array('domain_id' => CRM_Core_Config::domainID());
CRM_Core_OptionValue::addOptionValue($emailParams, $groupParams, $action, $this->_fromEmailId);
CRM_Core_Session::setStatus(ts('Domain information for \'%1\' has been saved.', array(1 => $domain->name)));
$session =& CRM_Core_Session::singleton();
$session->replaceUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1'));
}
示例3: createDomainContacts
/**
* @return array
*/
public function createDomainContacts()
{
$domainParams = $context = array();
$query = "\nALTER TABLE civicrm_domain ADD contact_id INT( 10 ) UNSIGNED NULL DEFAULT NULL COMMENT 'FK to Contact ID. This is specifically not an FK to avoid circular constraints',\n ADD CONSTRAINT FK_civicrm_domain_contact_id FOREIGN KEY (contact_id) REFERENCES civicrm_contact(id);";
CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray, TRUE, NULL, FALSE, FALSE);
$query = '
SELECT cd.id, cd.name, ce.email FROM civicrm_domain cd
LEFT JOIN civicrm_loc_block clb ON clb.id = cd. loc_block_id
LEFT JOIN civicrm_email ce ON ce.id = clb.email_id ;
';
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$query = "\nSELECT cc.id FROM civicrm_contact cc\nLEFT JOIN civicrm_email ce ON ce.contact_id = cc.id\nWHERE cc.contact_type = 'Organization' AND cc.organization_name = %1\n";
$params = array(1 => array($dao->name, 'String'));
if ($dao->email) {
$query .= " AND ce.email = %2 ";
$params[2] = array($dao->email, 'String');
}
$contactID = CRM_Core_DAO::singleValueQuery($query, $params);
$context[1] = $dao->name;
if (empty($contactID)) {
$params = array('sort_name' => $dao->name, 'display_name' => $dao->name, 'legal_name' => $dao->name, 'organization_name' => $dao->name, 'contact_type' => 'Organization');
$contact = CRM_Contact_BAO_Contact::add($params);
$contactID = $contact->id;
$context[0] = 'added';
} else {
$context[0] = 'merged';
}
$domainParams['contact_id'] = $contactID;
CRM_Core_BAO_Domain::edit($domainParams, $dao->id);
}
return $context;
}
示例4: postProcess
/**
* Function to process the form
*
* @access public
*
* @return None
*/
public function postProcess()
{
$params = $this->controller->exportValues($this->_name);
$this->_numStrings = sizeof($params['old']);
$enabled['exactMatch'] = $enabled['wildcardMatch'] = $disabled['exactMatch'] = $disabled['wildcardMatch'] = array();
for ($i = 1; $i <= $this->_numStrings; $i++) {
if (CRM_Utils_Array::value($i, $params['new']) && CRM_Utils_Array::value($i, $params['old'])) {
if (isset($params['enabled']) && CRM_Utils_Array::value($i, $params['enabled'])) {
if (CRM_Utils_Array::value('cb', $params) && CRM_Utils_Array::value($i, $params['cb'])) {
$enabled['exactMatch'] += array($params['old'][$i] => $params['new'][$i]);
} else {
$enabled['wildcardMatch'] += array($params['old'][$i] => $params['new'][$i]);
}
} else {
if (isset($params['cb']) && is_array($params['cb']) && array_key_exists($i, $params['cb'])) {
$disabled['exactMatch'] += array($params['old'][$i] => $params['new'][$i]);
} else {
$disabled['wildcardMatch'] += array($params['old'][$i] => $params['new'][$i]);
}
}
}
}
$overrides = array('enabled' => $enabled, 'disabled' => $disabled);
$config = CRM_Core_Config::singleton();
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
if ($domain->locales && $config->localeCustomStrings) {
// for multilingual
$addReplacements = $config->localeCustomStrings;
$addReplacements[$config->lcMessages] = $overrides;
$stringOverride = serialize($addReplacements);
} else {
// for single language
$stringOverride = serialize(array($config->lcMessages => $overrides));
}
$params = array('locale_custom_strings' => $stringOverride);
$id = CRM_Core_Config::domainID();
$wordReplacementSettings = CRM_Core_BAO_Domain::edit($params, $id);
if ($wordReplacementSettings) {
//reset navigation
CRM_Core_BAO_Navigation::resetNavigation();
CRM_Core_Session::setStatus("Your Settings have been saved");
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/options/wordreplacements', "reset=1"));
}
}
示例5: postProcess
/**
* Process the form when submitted.
*
* @return void
*/
public function postProcess()
{
$params = $this->exportValues();
$params['entity_id'] = $this->_id;
$params['entity_table'] = CRM_Core_BAO_Domain::getTableName();
$domain = CRM_Core_BAO_Domain::edit($params, $this->_id);
$defaultLocationType = CRM_Core_BAO_LocationType::getDefault();
if (isset($this->_locationDefaults['address'][1]['location_type_id'])) {
$params['address'][1]['location_type_id'] = $this->_locationDefaults['address'][1]['location_type_id'];
} else {
$params['address'][1]['location_type_id'] = $defaultLocationType->id;
}
if (isset($this->_locationDefaults['phone'][1]['location_type_id'])) {
$params['phone'][1]['location_type_id'] = $this->_locationDefaults['phone'][1]['location_type_id'];
} else {
$params['phone'][1]['location_type_id'] = $defaultLocationType->id;
}
if (isset($this->_locationDefaults['email'][1]['location_type_id'])) {
$params['email'][1]['location_type_id'] = $this->_locationDefaults['email'][1]['location_type_id'];
} else {
$params['email'][1]['location_type_id'] = $defaultLocationType->id;
}
$params += array('contact_id' => $this->_contactId);
$contactParams = array('sort_name' => $domain->name, 'display_name' => $domain->name, 'legal_name' => $domain->name, 'organization_name' => $domain->name, 'contact_id' => $this->_contactId, 'contact_type' => 'Organization');
if ($this->_contactId) {
$contactParams['contact_sub_type'] = CRM_Contact_BAO_Contact::getContactSubType($this->_contactId);
}
CRM_Contact_BAO_Contact::add($contactParams);
CRM_Core_BAO_Location::create($params, TRUE);
CRM_Core_BAO_Domain::edit($params, $this->_id);
//set domain from email address, CRM-3552
$emailName = '"' . $params['email_name'] . '" <' . $params['email_address'] . '>';
$emailParams = array('label' => $emailName, 'description' => $params['description'], 'is_active' => 1, 'is_default' => 1);
$groupParams = array('name' => 'from_email_address');
//get the option value wt.
if ($this->_fromEmailId) {
$action = $this->_action;
$emailParams['weight'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $this->_fromEmailId, 'weight');
} else {
//add from email address.
$action = CRM_Core_Action::ADD;
$grpId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'from_email_address', 'id', 'name');
$fieldValues = array('option_group_id' => $grpId);
$emailParams['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', $fieldValues);
}
//reset default within domain.
$emailParams['reset_default_for'] = array('domain_id' => CRM_Core_Config::domainID());
CRM_Core_OptionValue::addOptionValue($emailParams, $groupParams, $action, $this->_fromEmailId);
CRM_Core_Session::setStatus(ts("Domain information for '%1' has been saved.", array(1 => $domain->name)), ts('Saved'), 'success');
$session = CRM_Core_Session::singleton();
$session->replaceUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1'));
}
示例6: rebuild
/**
* Rebuild.
*
* @param bool $clearCaches
*
* @return bool
*/
public static function rebuild($clearCaches = TRUE)
{
$id = CRM_Core_Config::domainID();
$stringOverride = self::getAllAsConfigArray($id);
$params = array('locale_custom_strings' => serialize($stringOverride));
$wordReplacementSettings = CRM_Core_BAO_Domain::edit($params, $id);
if ($wordReplacementSettings) {
CRM_Core_Config::singleton()->localeCustomStrings = $stringOverride;
// Partially mitigate the inefficiency introduced in CRM-13187 by doing this conditionally
if ($clearCaches) {
// Reset navigation
CRM_Core_BAO_Navigation::resetNavigation();
// Clear js localization
CRM_Core_Resources::singleton()->flushStrings()->resetCacheCode();
}
return TRUE;
}
return FALSE;
}
示例7: rebuild
/**
* Rebuild
*/
static function rebuild()
{
$id = CRM_Core_Config::domainID();
$stringOverride = self::getAllAsConfigArray($id);
$params = array('locale_custom_strings' => serialize($stringOverride));
$wordReplacementSettings = CRM_Core_BAO_Domain::edit($params, $id);
if ($wordReplacementSettings) {
CRM_Core_Config::singleton()->localeCustomStrings = $stringOverride;
// Reset navigation
CRM_Core_BAO_Navigation::resetNavigation();
// Clear js string cache
CRM_Core_Resources::singleton()->flushStrings();
// Clear dynamic js files which may contain localization
CRM_Utils_File::flushDynamicResources();
return TRUE;
}
return FALSE;
}
示例8: postProcess
/**
* Process the form when submitted
*
* @return void
* @access public
*/
function postProcess()
{
require_once 'CRM/Core/BAO/Domain.php';
$params = array();
$params = $this->exportValues();
$params['domain_id'] = $this->_id;
$domain = CRM_Core_BAO_Domain::edit($params, $this->_id);
$location = array();
for ($locationId = 1; $locationId <= CRM_CONTACT_FORM_DOMAIN_LOCATION_BLOCKS; $locationId++) {
// start of for loop for location
$location[$locationId] = CRM_Core_BAO_Location::add($params, $this->_ids, $locationId);
}
CRM_Core_Session::setStatus(ts('The Domain "%1" has been saved.', array(1 => $domain->name)));
}