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


PHP CRM_Contact_BAO_RelationshipType::add方法代码示例

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


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

示例1: civicrm_api3_relationship_type_create

/**
 * Create relationship type.
 *
 * @param array $params
 *   Array per getfields metadata.
 *
 * @return array
 */
function civicrm_api3_relationship_type_create($params)
{
    if (!isset($params['label_a_b'])) {
        $params['label_a_b'] = $params['name_a_b'];
    }
    if (!isset($params['label_b_a'])) {
        $params['label_b_a'] = $params['name_b_a'];
    }
    $ids = array();
    if (isset($params['id']) && !CRM_Utils_Rule::integer($params['id'])) {
        return civicrm_api3_create_error('Invalid value for relationship type ID');
    } else {
        $ids['relationshipType'] = CRM_Utils_Array::value('id', $params);
    }
    $relationType = CRM_Contact_BAO_RelationshipType::add($params, $ids);
    $relType = array();
    _civicrm_api3_object_to_array($relationType, $relType[$relationType->id]);
    return civicrm_api3_create_success($relType, $params, 'RelationshipType', 'create', $relationType);
}
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:27,代码来源:RelationshipType.php

示例2: crm_create_relationship_type

/**
 * Function to create relationship type
 *
 * @param  array $params   Associative array of property name/value pairs to insert in new relationship type.
 *
 * @return Newly created Relationship_type object
 *
 * @access public
 *
 */
function crm_create_relationship_type($params)
{
    if (!isset($params['name_a_b']) and !isset($params['name_b_a']) and !isset($params['contact_type_a']) and !isset($params['contact_type_b'])) {
        return _crm_error('Return array is not properly set');
    }
    require_once 'CRM/Contact/BAO/RelationshipType.php';
    $relationType = CRM_Contact_BAO_RelationshipType::add($params, $ids);
    return $relationType;
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:19,代码来源:Relationship.php

示例3: postProcess

 /**
  * Function to process the form
  *
  * @access public
  * @return None
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         CRM_Contact_BAO_RelationshipType::del($this->_id);
         CRM_Core_Session::setStatus(ts('Selected Relationship type has been deleted.'));
     } else {
         $params = array();
         $ids = array();
         // store the submitted values in an array
         $params = $this->exportValues();
         $params['is_active'] = CRM_Utils_Array::value('is_active', $params, false);
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $ids['relationshipType'] = $this->_id;
         }
         $cTypeA = CRM_Utils_System::explode(CRM_Core_DAO::VALUE_SEPARATOR, $params['contact_types_a'], 2);
         $cTypeB = CRM_Utils_System::explode(CRM_Core_DAO::VALUE_SEPARATOR, $params['contact_types_b'], 2);
         $params['contact_type_a'] = $cTypeA[0];
         $params['contact_type_b'] = $cTypeB[0];
         $params['contact_sub_type_a'] = $cTypeA[1] ? $cTypeA[1] : 'NULL';
         $params['contact_sub_type_b'] = $cTypeB[1] ? $cTypeB[1] : 'NULL';
         CRM_Contact_BAO_RelationshipType::add($params, $ids);
         CRM_Core_Session::setStatus(ts('The Relationship Type has been saved.'));
     }
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:30,代码来源:RelationshipType.php

示例4: civicrm_relationship_type_add

/**
 * Function to create relationship type
 *
 * @param  array $params   Associative array of property name/value pairs to insert in new relationship type.
 *
 * @return Newly created Relationship_type object
 *
 * @access public
 *
 */
function civicrm_relationship_type_add($params)
{
    if (empty($params)) {
        return civicrm_create_error(ts('No input parameters present'));
    }
    if (!is_array($params)) {
        return civicrm_create_error(ts('Parameter is not an array'));
    }
    if (!isset($params['contact_types_a']) && !isset($params['contact_types_b']) && !isset($params['name_a_b']) && !isset($params['name_b_a'])) {
        return civicrm_create_error(ts('Missing some required parameters (contact_types_a contact_types_b name_a_b name b_a)'));
    }
    if (!isset($params['label_a_b'])) {
        $params['label_a_b'] = $params['name_a_b'];
    }
    if (!isset($params['label_b_a'])) {
        $params['label_b_a'] = $params['name_b_a'];
    }
    require_once 'CRM/Utils/Rule.php';
    $ids = array();
    if (isset($params['id']) && !CRM_Utils_Rule::integer($params['id'])) {
        return civicrm_create_error('Invalid value for relationship type ID');
    } else {
        $ids['relationshipType'] = CRM_Utils_Array::value('id', $params);
    }
    require_once 'CRM/Contact/BAO/RelationshipType.php';
    $relationType = CRM_Contact_BAO_RelationshipType::add($params, $ids);
    $relType = array();
    _civicrm_object_to_array($relationType, $relType);
    return $relType;
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:40,代码来源:RelationshipType.php

示例5: testRelCreateWithinDiffTypeStudentSponsor

 public function testRelCreateWithinDiffTypeStudentSponsor()
 {
     //check for Student to Sponcer
     $relTypeParams = array('name_a_b' => 'StudentToSponsor', 'name_b_a' => 'SponsorToStudent', 'contact_type_a' => 'Individual', 'contact_sub_type_a' => $this->student, 'contact_type_b' => 'Organization', 'contact_sub_type_b' => $this->sponsor);
     $relTypeIds = array();
     $relType = CRM_Contact_BAO_RelationshipType::add($relTypeParams, $relTypeIds);
     $params = array('relationship_type_id' => $relType->id . '_a_b', 'is_active' => 1, 'contact_check' => array($this->organization_sponsor => 1));
     $ids = array('contact' => $this->indivi_student);
     list($valid, $invalid, $duplicate, $saved, $relationshipIds) = CRM_Contact_BAO_Relationship::legacyCreateMultiple($params, $ids);
     $this->assertEquals($valid, 1);
     $this->assertEquals(empty($relationshipIds), FALSE);
     $this->relationshipTypeDelete($relType->id);
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:13,代码来源:RelationshipTest.php

示例6: postProcess

 /**
  * Function to process the form
  *
  * @access public
  * @return None
  */
 function postProcess()
 {
     if ($this->_action & CRM_CORE_ACTION_DELETE) {
         CRM_Contact_BAO_RelationshipType::del($this->_id);
         CRM_Core_Session::setStatus(ts('Selected Relationship type has been deleted.'));
     } else {
         $params = array();
         $ids = array();
         // store the submitted values in an array
         $params = $this->exportValues();
         $params['is_active'] = CRM_Utils_Array::value('is_active', $params, false);
         if ($this->_action & CRM_CORE_ACTION_UPDATE) {
             $ids['relationshipType'] = $this->_id;
         }
         CRM_Contact_BAO_RelationshipType::add($params, $ids);
         CRM_Core_Session::setStatus(ts('The Relationship Type has been saved.'));
     }
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:24,代码来源:RelationshipType.php


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