本文整理匯總了PHP中CRM_Contact_BAO_Relationship::makeURLClause方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Contact_BAO_Relationship::makeURLClause方法的具體用法?PHP CRM_Contact_BAO_Relationship::makeURLClause怎麽用?PHP CRM_Contact_BAO_Relationship::makeURLClause使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Contact_BAO_Relationship
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Relationship::makeURLClause方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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
*
* return array $values relationship records
* @static
* @access public
*/
function getRelationship($contactId, $status = 0, $numRelationship = 0, $count = 0, $relationshipId = 0, $links = null, $permissionMask = null)
{
list($select1, $from1, $where1) = CRM_Contact_BAO_Relationship::makeURLClause($contactId, $status, $numRelationship, $count, $relationshipId, 'a_b');
list($select2, $from2, $where2) = CRM_Contact_BAO_Relationship::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 ($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 == CRM_CONTACT_BAO_RELATIONSHIP_CURRENT) {
$mask |= CRM_CORE_ACTION_DISABLE;
} else {
if ($status == CRM_CONTACT_BAO_RELATIONSHIP_DISABLED) {
$mask |= CRM_CORE_ACTION_ENABLE;
}
}
$mask = $mask & $permissionMask;
}
while ($relationship->fetch()) {
$rid = $relationship->civicrm_relationship_id;
$values[$rid]['id'] = $rid;
$values[$rid]['cid'] = $relationship->civicrm_contact_id;
$values[$rid]['relation'] = $relationship->relation;
$values[$rid]['name'] = $relationship->sort_name;
$values[$rid]['email'] = $relationship->email;
$values[$rid]['phone'] = $relationship->phone;
$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]['is_active'] = $relationship->is_active;
if ($relationship->name_a_b == $relationship->relation) {
$values[$rid]['rtype'] = 'a_b';
} else {
$values[$rid]['rtype'] = 'b_a';
}
if ($links) {
$replace = array('id' => $rid, 'rtype' => $values[$rid]['rtype'], 'cid' => $contactId);
$values[$rid]['action'] = CRM_Core_Action::formLink($links, $mask, $replace);
}
}
return $values;
}
}