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


PHP CRM_Contact_BAO_ContactType::contactTypes方法代码示例

本文整理汇总了PHP中CRM_Contact_BAO_ContactType::contactTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_ContactType::contactTypes方法的具体用法?PHP CRM_Contact_BAO_ContactType::contactTypes怎么用?PHP CRM_Contact_BAO_ContactType::contactTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Contact_BAO_ContactType的用法示例。


在下文中一共展示了CRM_Contact_BAO_ContactType::contactTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetMethods

 /**
  * Test contactTypes() and subTypes() methods with valid data
  * success expected
  */
 public function testGetMethods()
 {
     // check all contact types
     $contactTypes = array('Individual', 'Organization', 'Household');
     $result = CRM_Contact_BAO_ContactType::contactTypes('Individual');
     foreach ($contactTypes as $type) {
         $this->assertEquals(in_array($type, $result), TRUE);
     }
     // check for type:Individual
     $result = CRM_Contact_BAO_ContactType::subTypes('Individual');
     foreach ($result as $subtype) {
         $subTypeName = in_array($subtype, $this->subTypesIndividual);
         if (!empty($subTypeName)) {
             $this->assertEquals($subTypeName, TRUE);
         }
         $this->assertEquals(in_array($subtype, $this->subTypesOrganization), FALSE);
         $this->assertEquals(in_array($subtype, $this->subTypesHousehold), FALSE);
     }
     // check for type:Organization
     $result = CRM_Contact_BAO_ContactType::subTypes('Organization');
     foreach ($result as $subtype) {
         $this->assertEquals(in_array($subtype, $this->subTypesIndividual), FALSE);
         $subTypeName = in_array($subtype, $this->subTypesOrganization);
         if (!empty($subTypeName)) {
             $this->assertEquals($subTypeName, TRUE);
         }
         $subTypeName = in_array($subTypeName, $this->subTypesHousehold);
         if (empty($subTypeName)) {
             $this->assertEquals($subTypeName, FALSE);
         }
     }
     // check for type:Household
     $result = CRM_Contact_BAO_ContactType::subTypes('Household');
     foreach ($result as $subtype) {
         $this->assertEquals(in_array($subtype, $this->subTypesIndividual), FALSE);
         $this->assertEquals(in_array($subtype, $this->subTypesOrganization), FALSE);
         $this->assertEquals(in_array($subtype, $this->subTypesHousehold), TRUE);
     }
     // check for all conatct types
     $result = CRM_Contact_BAO_ContactType::subTypes();
     foreach ($this->subTypesIndividual as $subtype) {
         $this->assertEquals(in_array($subtype, $result), TRUE);
     }
     foreach ($this->subTypesOrganization as $subtype) {
         $this->assertEquals(in_array($subtype, $result), TRUE);
     }
     foreach ($this->subTypesHousehold as $subtype) {
         $this->assertEquals(in_array($subtype, $result), TRUE);
     }
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:54,代码来源:ContactTypeTest.php

示例2: isProviderEnabled

 /**
  * Check if a provider is allowed to add stuff.
  * If correspondig setting is empty, all are allowed
  *
  * @param string $providerName
  */
 public static function isProviderEnabled($providerName)
 {
     // Join contact types to providerName 'Contact'
     $contactTypes = CRM_Contact_BAO_ContactType::contactTypes(TRUE);
     if (in_array($providerName, $contactTypes)) {
         $providerName = 'Contact';
     }
     $allowed = TRUE;
     // Use core setting recentItemsProviders if configured
     $providersPermitted = Civi::settings()->get('recentItemsProviders');
     if ($providersPermitted) {
         $allowed = in_array($providerName, $providersPermitted);
     }
     // Else allow
     return $allowed;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:22,代码来源:Recent.php


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