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


PHP CRM_Contact_DAO_RelationshipType::selectAdd方法代码示例

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


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

示例1: array

 /**
  * Get all Relationship Types  from database.
  *
  * The static array group is returned, and if it's
  * called the first time, the <b>RelationshipType DAO</b> is used
  * to get all the relationship types.
  *
  * Note: any database errors will be trapped by the DAO.
  *
  * @param string $valueColumnName db column name/label.
  * @param boolean $reset          reset relationship types if true
  *
  * @access public
  * @static
  *
  * @return array - array reference of all relationship types.
  */
 public static function &relationshipType($valueColumnName = 'label', $reset = FALSE)
 {
     if (!CRM_Utils_Array::value($valueColumnName, self::$relationshipType) || $reset) {
         self::$relationshipType[$valueColumnName] = array();
         //now we have name/label columns CRM-3336
         $column_a_b = "{$valueColumnName}_a_b";
         $column_b_a = "{$valueColumnName}_b_a";
         $relationshipTypeDAO = new CRM_Contact_DAO_RelationshipType();
         $relationshipTypeDAO->selectAdd();
         $relationshipTypeDAO->selectAdd("id, {$column_a_b}, {$column_b_a}, contact_type_a, contact_type_b, contact_sub_type_a, contact_sub_type_b");
         $relationshipTypeDAO->is_active = 1;
         $relationshipTypeDAO->find();
         while ($relationshipTypeDAO->fetch()) {
             self::$relationshipType[$valueColumnName][$relationshipTypeDAO->id] = array('id' => $relationshipTypeDAO->id, $column_a_b => $relationshipTypeDAO->{$column_a_b}, $column_b_a => $relationshipTypeDAO->{$column_b_a}, 'contact_type_a' => "{$relationshipTypeDAO->contact_type_a}", 'contact_type_b' => "{$relationshipTypeDAO->contact_type_b}", 'contact_sub_type_a' => "{$relationshipTypeDAO->contact_sub_type_a}", 'contact_sub_type_b' => "{$relationshipTypeDAO->contact_sub_type_b}");
         }
     }
     return self::$relationshipType[$valueColumnName];
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:35,代码来源:PseudoConstant.php

示例2: checkRelationshipType

 /**
  * Check if the relationship type selected between two contacts is correct.
  *
  * @param int $contact_a
  *   1st contact id.
  * @param int $contact_b
  *   2nd contact id.
  * @param int $relationshipTypeId
  *   Relationship type id.
  *
  * @return bool
  *   true if it is valid relationship else false
  */
 public static function checkRelationshipType($contact_a, $contact_b, $relationshipTypeId)
 {
     $relationshipType = new CRM_Contact_DAO_RelationshipType();
     $relationshipType->id = $relationshipTypeId;
     $relationshipType->selectAdd();
     $relationshipType->selectAdd('contact_type_a, contact_type_b, contact_sub_type_a, contact_sub_type_b');
     if ($relationshipType->find(TRUE)) {
         $contact_type_a = CRM_Contact_BAO_Contact::getContactType($contact_a);
         $contact_type_b = CRM_Contact_BAO_Contact::getContactType($contact_b);
         $contact_sub_type_a = CRM_Contact_BAO_Contact::getContactSubType($contact_a);
         $contact_sub_type_b = CRM_Contact_BAO_Contact::getContactSubType($contact_b);
         if ((!$relationshipType->contact_type_a || $relationshipType->contact_type_a == $contact_type_a) && (!$relationshipType->contact_type_b || $relationshipType->contact_type_b == $contact_type_b) && (!$relationshipType->contact_sub_type_a || in_array($relationshipType->contact_sub_type_a, $contact_sub_type_a)) && (!$relationshipType->contact_sub_type_b || in_array($relationshipType->contact_sub_type_b, $contact_sub_type_b))) {
             return TRUE;
         } else {
             return FALSE;
         }
     }
     return FALSE;
 }
开发者ID:scardinius,项目名称:civicrm-core,代码行数:32,代码来源:Relationship.php

示例3: checkRelationshipType

 /**
  * Function to check if the relationship type selected between two contacts is correct
  *
  * @param int $contact_a 1st contact id 
  * @param int $contact_b 2nd contact id 
  * @param int $relationshipTypeId relationship type id
  *
  * @return boolean  true if it is valid relationship else false
  * @access public
  * @static
  */
 static function checkRelationshipType($contact_a, $contact_b, $relationshipTypeId)
 {
     $relationshipType = new CRM_Contact_DAO_RelationshipType();
     $relationshipType->id = $relationshipTypeId;
     $relationshipType->selectAdd();
     $relationshipType->selectAdd('contact_type_a, contact_type_b, contact_sub_type_a, contact_sub_type_b');
     if ($relationshipType->find(true)) {
         require_once 'CRM/Contact/BAO/Contact.php';
         $contact_type_a = CRM_Contact_BAO_Contact::getContactType($contact_a);
         $contact_type_b = CRM_Contact_BAO_Contact::getContactType($contact_b);
         $contact_sub_type_a = CRM_Contact_BAO_Contact::getContactSubType($contact_a);
         $contact_sub_type_b = CRM_Contact_BAO_Contact::getContactSubType($contact_b);
         if ((!$relationshipType->contact_type_a || $relationshipType->contact_type_a == $contact_type_a) && (!$relationshipType->contact_type_b || $relationshipType->contact_type_b == $contact_type_b) && (!$relationshipType->contact_sub_type_a || $relationshipType->contact_sub_type_a == $contact_sub_type_a) && (!$relationshipType->contact_sub_type_b || $relationshipType->contact_sub_type_b == $contact_sub_type_b)) {
             return true;
         } else {
             return false;
         }
     }
     return false;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:31,代码来源:Relationship.php


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