当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_BAO_Domain::edit方法代码示例

本文整理汇总了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"));
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:54,代码来源:WordReplacements.php

示例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'));
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:48,代码来源:Domain.php

示例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;
    }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:36,代码来源:FourThree.php

示例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"));
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:52,代码来源:WordReplacements.php

示例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'));
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:57,代码来源:Domain.php

示例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;
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:26,代码来源:WordReplacement.php

示例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;
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:21,代码来源:WordReplacement.php

示例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)));
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:20,代码来源:Domain.php


注:本文中的CRM_Core_BAO_Domain::edit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。