本文整理汇总了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];
}
示例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;
}
示例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;
}