本文整理匯總了PHP中CRM_Contact_BAO_Contact_Permission::relationship方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Contact_BAO_Contact_Permission::relationship方法的具體用法?PHP CRM_Contact_BAO_Contact_Permission::relationship怎麽用?PHP CRM_Contact_BAO_Contact_Permission::relationship使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Contact_BAO_Contact_Permission
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Contact_Permission::relationship方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getRelationship
/**
* This is the function to get the list of relationships
*
* @param int $contactId contact id
* @param int $status 1: Past 2: Disabled 3: Current
* @param int $numRelationship no of relationships to display (limit)
* @param int $count get the no of relationships
* $param int $relationshipId relationship id
* $param array $links the list of links to display
* $param int $permissionMask the permission mask to be applied for the actions
* $param boolean $permissionedContact to return only permissioned Contact
* $param array $params array of variables consistent with filters supported by the api
* return array $values relationship records
* @static
* @access public
*/
static function getRelationship($contactId = NULL, $status = 0, $numRelationship = 0, $count = 0, $relationshipId = 0, $links = NULL, $permissionMask = NULL, $permissionedContact = FALSE, $params = array())
{
$values = array();
if (!$contactId && !$relationshipId) {
return $values;
}
list($select1, $from1, $where1) = self::makeURLClause($contactId, $status, $numRelationship, $count, $relationshipId, 'a_b', $params);
list($select2, $from2, $where2) = self::makeURLClause($contactId, $status, $numRelationship, $count, $relationshipId, 'b_a', $params);
$order = $limit = '';
if (!$count) {
$order = ' ORDER BY civicrm_relationship_type_id, sort_name ';
if ($numRelationship) {
$limit = " LIMIT 0, {$numRelationship}";
}
}
// building the query string
$queryString = '';
$queryString = $select1 . $from1 . $where1 . $select2 . $from2 . $where2 . $order . $limit;
$relationship = new CRM_Contact_DAO_Relationship();
$relationship->query($queryString);
$row = array();
if ($count) {
$relationshipCount = 0;
while ($relationship->fetch()) {
$relationshipCount += $relationship->cnt1 + $relationship->cnt2;
}
return $relationshipCount;
} else {
$mask = NULL;
if ($status != self::INACTIVE) {
if ($links) {
$mask = array_sum(array_keys($links));
if ($mask & CRM_Core_Action::DISABLE) {
$mask -= CRM_Core_Action::DISABLE;
}
if ($mask & CRM_Core_Action::ENABLE) {
$mask -= CRM_Core_Action::ENABLE;
}
if ($status == self::CURRENT) {
$mask |= CRM_Core_Action::DISABLE;
} elseif ($status == self::DISABLED) {
$mask |= CRM_Core_Action::ENABLE;
}
$mask = $mask & $permissionMask;
}
}
while ($relationship->fetch()) {
$rid = $relationship->civicrm_relationship_id;
$cid = $relationship->civicrm_contact_id;
if ($permissionedContact && !CRM_Contact_BAO_Contact_Permission::relationship($cid, $contactId)) {
continue;
}
$values[$rid]['id'] = $rid;
$values[$rid]['cid'] = $cid;
$values[$rid]['contact_id_a'] = $relationship->contact_id_a;
$values[$rid]['contact_id_b'] = $relationship->contact_id_b;
$values[$rid]['relationship_type_id'] = $relationship->civicrm_relationship_type_id;
$values[$rid]['relation'] = $relationship->relation;
$values[$rid]['name'] = $relationship->sort_name;
$values[$rid]['display_name'] = $relationship->display_name;
$values[$rid]['job_title'] = $relationship->job_title;
$values[$rid]['email'] = $relationship->email;
$values[$rid]['phone'] = $relationship->phone;
$values[$rid]['employer_id'] = $relationship->employer_id;
$values[$rid]['organization_name'] = $relationship->organization_name;
$values[$rid]['country'] = $relationship->country;
$values[$rid]['city'] = $relationship->city;
$values[$rid]['state'] = $relationship->state;
$values[$rid]['start_date'] = $relationship->start_date;
$values[$rid]['end_date'] = $relationship->end_date;
$values[$rid]['description'] = $relationship->description;
$values[$rid]['is_active'] = $relationship->is_active;
$values[$rid]['is_permission_a_b'] = $relationship->is_permission_a_b;
$values[$rid]['is_permission_b_a'] = $relationship->is_permission_b_a;
$values[$rid]['case_id'] = $relationship->case_id;
if ($status) {
$values[$rid]['status'] = $status;
}
$values[$rid]['civicrm_relationship_type_id'] = $relationship->civicrm_relationship_type_id;
if ($relationship->contact_id_a == $contactId) {
$values[$rid]['rtype'] = 'a_b';
} else {
$values[$rid]['rtype'] = 'b_a';
}
//.........這裏部分代碼省略.........
示例2: getRelationship
/**
* This is the function to get the list of relationships
*
* @param int $contactId contact id
* @param int $status 1: Past 2: Disabled 3: Current
* @param int $numRelationship no of relationships to display (limit)
* @param int $count get the no of relationships
* $param int $relationshipId relationship id
* $param array $links the list of links to display
* $param int $permissionMask the permission mask to be applied for the actions
* $param boolean $permissionedContact to return only permissioned Contact
*
* return array $values relationship records
* @static
* @access public
*/
static function getRelationship($contactId, $status = 0, $numRelationship = 0, $count = 0, $relationshipId = 0, $links = null, $permissionMask = null, $permissionedContact = false)
{
list($select1, $from1, $where1) = self::makeURLClause($contactId, $status, $numRelationship, $count, $relationshipId, 'a_b');
list($select2, $from2, $where2) = self::makeURLClause($contactId, $status, $numRelationship, $count, $relationshipId, 'b_a');
$order = $limit = '';
if (!$count) {
$order = ' ORDER BY civicrm_relationship_type_id, sort_name ';
if ($numRelationship) {
$limit = " LIMIT 0, {$numRelationship}";
}
}
// building the query string
$queryString = '';
$queryString = $select1 . $from1 . $where1 . $select2 . $from2 . $where2 . $order . $limit;
$relationship =& new CRM_Contact_DAO_Relationship();
$relationship->query($queryString);
$row = array();
if ($count) {
$relationshipCount = 0;
while ($relationship->fetch()) {
$relationshipCount += $relationship->cnt1 + $relationship->cnt2;
}
return $relationshipCount;
} else {
$values = array();
$mask = null;
if ($status != self::INACTIVE) {
if ($links) {
$mask = array_sum(array_keys($links));
if ($mask & CRM_Core_Action::DISABLE) {
$mask -= CRM_Core_Action::DISABLE;
}
if ($mask & CRM_Core_Action::ENABLE) {
$mask -= CRM_Core_Action::ENABLE;
}
if ($status == self::CURRENT) {
$mask |= CRM_Core_Action::DISABLE;
} else {
if ($status == self::DISABLED) {
$mask |= CRM_Core_Action::ENABLE;
}
}
$mask = $mask & $permissionMask;
}
}
require_once 'CRM/Contact/BAO/Contact/Permission.php';
while ($relationship->fetch()) {
$rid = $relationship->civicrm_relationship_id;
$cid = $relationship->civicrm_contact_id;
if ($permissionedContact && !CRM_Contact_BAO_Contact_Permission::relationship($cid, $contactId)) {
continue;
}
$values[$rid]['id'] = $rid;
$values[$rid]['cid'] = $cid;
$values[$rid]['relation'] = $relationship->relation;
$values[$rid]['name'] = $relationship->sort_name;
$values[$rid]['display_name'] = $relationship->display_name;
$values[$rid]['job_title'] = $relationship->job_title;
$values[$rid]['email'] = $relationship->email;
$values[$rid]['phone'] = $relationship->phone;
$values[$rid]['employer_id'] = $relationship->employer_id;
$values[$rid]['organization_name'] = $relationship->organization_name;
$values[$rid]['country'] = $relationship->country;
$values[$rid]['city'] = $relationship->city;
$values[$rid]['state'] = $relationship->state;
$values[$rid]['start_date'] = $relationship->start_date;
$values[$rid]['end_date'] = $relationship->end_date;
$values[$rid]['description'] = $relationship->description;
$values[$rid]['is_active'] = $relationship->is_active;
$values[$rid]['is_permission_a_b'] = $relationship->is_permission_a_b;
$values[$rid]['is_permission_b_a'] = $relationship->is_permission_b_a;
if ($status) {
$values[$rid]['status'] = $status;
}
$values[$rid]['civicrm_relationship_type_id'] = $relationship->civicrm_relationship_type_id;
if ($relationship->contact_id_a == $contactId) {
$values[$rid]['rtype'] = 'a_b';
} else {
$values[$rid]['rtype'] = 'b_a';
}
if ($links) {
$replace = array('id' => $rid, 'rtype' => $values[$rid]['rtype'], 'cid' => $contactId, 'cbid' => $values[$rid]['cid']);
if ($status == self::INACTIVE) {
// setting links for inactive relationships
//.........這裏部分代碼省略.........