當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Core_BAO_ConfigSetting::enableComponent方法代碼示例

本文整理匯總了PHP中CRM_Core_BAO_ConfigSetting::enableComponent方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Core_BAO_ConfigSetting::enableComponent方法的具體用法?PHP CRM_Core_BAO_ConfigSetting::enableComponent怎麽用?PHP CRM_Core_BAO_ConfigSetting::enableComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Core_BAO_ConfigSetting的用法示例。


在下文中一共展示了CRM_Core_BAO_ConfigSetting::enableComponent方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     $this->loadAllFixtures();
     CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
     CRM_Core_BAO_ConfigSetting::enableComponent('CiviCampaign');
 }
開發者ID:joshgowans,項目名稱:civicrm-core,代碼行數:7,代碼來源:PseudoConstantTest.php

示例2: setUp

 public function setUp()
 {
     parent::setUp();
     $this->tablesToTruncate = array('civicrm_activity', 'civicrm_contact', 'civicrm_custom_group', 'civicrm_custom_field', 'civicrm_case', 'civicrm_case_contact', 'civicrm_case_activity', 'civicrm_case_type', 'civicrm_activity_contact', 'civicrm_managed', 'civicrm_relationship', 'civicrm_relationship_type');
     $this->quickCleanup($this->tablesToTruncate);
     $this->loadAllFixtures();
     CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
 }
開發者ID:konadave,項目名稱:civicrm-core,代碼行數:8,代碼來源:CaseTest.php

示例3: testToggleComponent

 public function testToggleComponent()
 {
     $origNames = array();
     foreach (CRM_Core_Component::getEnabledComponents() as $c) {
         $origNames[] = $c->name;
     }
     $this->assertTrue(!in_array('CiviCase', $origNames));
     $enableResult = CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
     $this->assertTrue($enableResult, 'Cannot enable CiviCase in line ' . __LINE__);
     $newNames = array();
     foreach (CRM_Core_Component::getEnabledComponents() as $c) {
         $newNames[] = $c->name;
     }
     $this->assertTrue(in_array('CiviCase', $newNames));
     $this->assertEquals(count($newNames), count($origNames) + 1);
 }
開發者ID:FundingWorks,項目名稱:civicrm-core,代碼行數:16,代碼來源:ConfigSettingTest.php

示例4: setUp

 public function setUp()
 {
     parent::setUp();
     /** @var $hooks \CRM_Utils_Hook_UnitTests */
     $hooks = \CRM_Utils_Hook::singleton();
     $hooks->setHook('civicrm_caseTypes', array($this, 'hook_caseTypes'));
     \CRM_Case_XMLRepository::singleton(TRUE);
     \CRM_Case_XMLProcessor::flushStaticCaches();
     // CRM-9404 - set-up is a bit cumbersome but had to put something in place to set up activity types & case types
     //. Using XML was causing breakage as id numbers were changing over time
     // & was really hard to troubleshoot as involved truncating option_value table to mitigate this & not leaving DB in a
     // state where tests could run afterwards without re-loading.
     $this->caseStatusGroup = $this->callAPISuccess('option_group', 'get', array('name' => 'case_status', 'format.only_id' => 1));
     $optionValues = array('Medical evaluation' => 'Medical evaluation', 'Mental health evaluation' => "Mental health evaluation", 'Secure temporary housing' => 'Secure temporary housing', 'Long-term housing plan' => 'Long-term housing plan', 'ADC referral' => 'ADC referral', 'Income and benefits stabilization' => 'Income and benefits stabilization');
     foreach ($optionValues as $name => $label) {
         $activityTypes = $this->callAPISuccess('option_value', 'Create', array('option_group_id' => 2, 'name' => $name, 'label' => $label, 'component_id' => 7));
         // store for cleanup
         $this->optionValues[] = $activityTypes['id'];
     }
     // We used to be inconsistent about "HousingSupport" vs "housing_support".
     // Now, the rule is simply: use the "name" from "civicrm_case_type.name".
     $this->caseType = 'housing_support';
     $this->caseTypeId = 1;
     $this->tablesToTruncate = array('civicrm_activity', 'civicrm_contact', 'civicrm_custom_group', 'civicrm_custom_field', 'civicrm_case', 'civicrm_case_contact', 'civicrm_case_activity', 'civicrm_case_type', 'civicrm_activity_contact', 'civicrm_managed', 'civicrm_relationship', 'civicrm_relationship_type');
     $this->quickCleanup($this->tablesToTruncate);
     $this->loadAllFixtures();
     // enable the default custom templates for the case type xml files
     $this->customDirectories(array('template_path' => TRUE));
     // case is not enabled by default
     $enableResult = CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
     $this->assertTrue($enableResult, 'Cannot enable CiviCase in line ' . __LINE__);
     // create a logged in USER since the code references it for source_contact_id
     $this->createLoggedInUser();
     $session = CRM_Core_Session::singleton();
     $this->_loggedInUser = $session->get('userID');
     /// note that activityType options are cached by the FULL set of options you pass in
     // ie. because Activity api includes campaign in it's call cache is not flushed unless
     // included in this call. Also note flush function doesn't work on this property as it sets to null not empty array
     CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name', TRUE);
 }
開發者ID:prashantgajare,項目名稱:civicrm-core,代碼行數:40,代碼來源:CiviCaseTestCase.php

示例5: setUp

 /**
  * Set up function.
  *
  * Ensure CiviCase is enabled.
  */
 public function setUp()
 {
     parent::setUp();
     CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
 }
開發者ID:FundingWorks,項目名稱:civicrm-core,代碼行數:10,代碼來源:QueryTest.php

示例6: setUp

 /**
  *  Test setup for every test
  *
  *  Connect to the database, truncate the tables that will be used
  *  and redirect stdin to a temporary file
  */
 public function setUp()
 {
     $this->_entity = 'case';
     parent::setUp();
     // CRM-9404 - set-up is a bit cumbersome but had to put something in place to set up activity types & case types
     //. Using XML was causing breakage as id numbers were changing over time
     // & was really hard to troubleshoot as involved truncating option_value table to mitigate this & not leaving DB in a
     // state where tests could run afterwards without re-loading.
     $this->caseStatusGroup = $this->callAPISuccess('option_group', 'get', array('name' => 'case_status', 'format.only_id' => 1));
     $this->caseTypeGroup = $this->callAPISuccess('option_group', 'get', array('name' => 'case_type', 'format.only_id' => 1));
     $caseTypes = $this->callAPISuccess('option_value', 'Create', array('option_group_id' => $this->caseTypeGroup, 'name' => 'housing_support', 'label' => "Housing Support", 'sequential' => 1, 'description' => 'Help homeless individuals obtain temporary and long-term housing'));
     $this->caseTypeId = $caseTypes['values'][0]['value'];
     $this->optionValues[] = $caseTypes['id'];
     $optionValues = array('Medical evaluation' => 'Medical evaluation', 'Mental health evaluation' => "Mental health evaluation", 'Secure temporary housing' => 'Secure temporary housing', 'Long-term housing plan' => 'Long-term housing plan', 'ADC referral' => 'ADC referral', 'Income and benefits stabilization' => 'Income and benefits stabilization');
     foreach ($optionValues as $name => $label) {
         $activityTypes = $this->callAPISuccess('option_value', 'Create', array('option_group_id' => 2, 'name' => $name, 'label' => $label, 'component_id' => 7));
         // store for cleanup
         $this->optionValues[] = $activityTypes['id'];
     }
     $tablesToTruncate = array('civicrm_activity', 'civicrm_contact', 'civicrm_custom_group', 'civicrm_custom_field', 'civicrm_case', 'civicrm_case_contact', 'civicrm_case_activity', 'civicrm_activity_contact', 'civicrm_relationship', 'civicrm_relationship_type');
     $this->quickCleanup($tablesToTruncate);
     $activityTypes = $this->callAPISuccess('option_value', 'get', array('option_group_id' => 2, 'name' => 'Follow Up', 'label' => 'Follow Up', 'sequential' => 1));
     $this->followup_activity_type_value = $activityTypes['values'][0]['value'];
     //  Insert a row in civicrm_contact creating contact 17
     $op = new PHPUnit_Extensions_Database_Operation_Insert();
     $op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_XMLDataSet(dirname(__FILE__) . '/dataset/contact_17.xml'));
     //Create relationship types
     $relTypeParams = array('name_a_b' => 'Case Coordinator is', 'label_a_b' => 'Case Coordinator is', 'name_b_a' => 'Case Coordinator', 'label_b_a' => 'Case Coordinator', 'description' => 'Case Coordinator', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Individual', 'is_reserved' => 0, 'is_active' => 1);
     $this->relationshipTypeCreate($relTypeParams);
     $relTypeParams = array('name_a_b' => 'Homeless Services Coordinator is', 'label_a_b' => 'Homeless Services Coordinator is', 'name_b_a' => 'Homeless Services Coordinator', 'label_b_a' => 'Homeless Services Coordinator', 'description' => 'Homeless Services Coordinator', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Individual', 'is_reserved' => 0, 'is_active' => 1);
     $this->relationshipTypeCreate($relTypeParams);
     $relTypeParams = array('name_a_b' => 'Health Services Coordinator is', 'label_a_b' => 'Health Services Coordinator is', 'name_b_a' => 'Health Services Coordinator', 'label_b_a' => 'Health Services Coordinator', 'description' => 'Health Services Coordinator', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Individual', 'is_reserved' => 0, 'is_active' => 1);
     $this->relationshipTypeCreate($relTypeParams);
     $relTypeParams = array('name_a_b' => 'Senior Services Coordinator is', 'label_a_b' => 'Senior Services Coordinator is', 'name_b_a' => 'Senior Services Coordinator', 'label_b_a' => 'Senior Services Coordinator', 'description' => 'Senior Services Coordinator', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Individual', 'is_reserved' => 0, 'is_active' => 1);
     $this->relationshipTypeCreate($relTypeParams);
     $relTypeParams = array('name_a_b' => 'Benefits Specialist is', 'label_a_b' => 'Benefits Specialist is', 'name_b_a' => 'Benefits Specialist', 'label_b_a' => 'Benefits Specialist', 'description' => 'Benefits Specialist', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Individual', 'is_reserved' => 0, 'is_active' => 1);
     $this->relationshipTypeCreate($relTypeParams);
     // enable the default custom templates for the case type xml files
     $this->customDirectories(array('template_path' => TRUE));
     // case is not enabled by default
     $enableResult = CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
     $this->assertTrue($enableResult, 'Cannot enable CiviCase in line ' . __LINE__);
     $this->_params = array('case_type_id' => $this->caseTypeId, 'subject' => 'Test case', 'contact_id' => 17);
     // create a logged in USER since the code references it for source_contact_id
     $this->createLoggedInUser();
     $session = CRM_Core_Session::singleton();
     $this->_loggedInUser = $session->get('userID');
     /// note that activityType options are cached by the FULL set of options you pass in
     // ie. because Activity api includes campaign in it's call cache is not flushed unless
     // included in this call. Also note flush function doesn't work on this property as it sets to null not empty array
     CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name', TRUE);
 }
開發者ID:archcidburnziso,項目名稱:civicrm-core,代碼行數:58,代碼來源:CaseTest.php

示例7: testEnableComponentInvalid

 public function testEnableComponentInvalid()
 {
     $config = CRM_Core_Config::singleton(TRUE, TRUE);
     $result = CRM_Core_BAO_ConfigSetting::enableComponent('CiviFake');
     $this->assertFalse($result);
 }
開發者ID:hyebahi,項目名稱:civicrm-core,代碼行數:6,代碼來源:SettingTest.php

示例8: enableCiviCampaign

 /**
  * Enable CiviCampaign Component.
  */
 public function enableCiviCampaign()
 {
     CRM_Core_BAO_ConfigSetting::enableComponent('CiviCampaign');
     // force reload of config object
     $config = CRM_Core_Config::singleton(TRUE, TRUE);
     //flush cache by calling with reset
     $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name', TRUE);
 }
開發者ID:nielosz,項目名稱:civicrm-core,代碼行數:11,代碼來源:CiviUnitTestCase.php

示例9: custom_data_entities

 /**
  * @return array
  */
 public static function custom_data_entities()
 {
     $entities = CRM_Core_BAO_CustomQuery::$extendsMap;
     $enabledComponents = Civi::settings()->get('enable_components');
     $customDataEntities = array();
     $invalidEntities = array('Individual', 'Organization', 'Household');
     $entitiesToFix = array('Case', 'Relationship');
     foreach ($entities as $entityName => $entity) {
         if (!in_array($entityName, $invalidEntities) && !in_array($entityName, $entitiesToFix)) {
             if (!empty(self::$componentMap[$entityName]) && empty($enabledComponents[self::$componentMap[$entityName]])) {
                 CRM_Core_BAO_ConfigSetting::enableComponent(self::$componentMap[$entityName]);
             }
             $customDataEntities[] = array($entityName);
         }
     }
     return $customDataEntities;
 }
開發者ID:rollox,項目名稱:civicrm-core,代碼行數:20,代碼來源:SyntaxConformanceTest.php


注:本文中的CRM_Core_BAO_ConfigSetting::enableComponent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。