本文整理汇总了PHP中CRM_Utils_Hook::membershipTypeValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Hook::membershipTypeValues方法的具体用法?PHP CRM_Utils_Hook::membershipTypeValues怎么用?PHP CRM_Utils_Hook::membershipTypeValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_Hook
的用法示例。
在下文中一共展示了CRM_Utils_Hook::membershipTypeValues方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: implode
static function &buildMembershipTypeValues(&$form, $membershipTypeID = null)
{
$whereClause = null;
if (is_array($membershipTypeID)) {
$allIDs = implode(',', $membershipTypeID);
$whereClause = "WHERE id IN ( {$allIDs} )";
} else {
if (is_numeric($membershipTypeID) && $membershipTypeID > 0) {
$whereClause = "WHERE id = {$membershipTypeID}";
}
}
$query = "\nSELECT *\nFROM civicrm_membership_type\n {$whereClause};\n";
$dao = CRM_Core_DAO::executeQuery($query);
$membershipTypeValues = array();
$membershipTypeFields = array('id', 'minimum_fee', 'name', 'is_active', 'description', 'contribution_type_id', 'auto_renew');
while ($dao->fetch()) {
$membershipTypeValues[$dao->id] = array();
foreach ($membershipTypeFields as $mtField) {
$membershipTypeValues[$dao->id][$mtField] = $dao->{$mtField};
}
}
$dao->free();
require_once 'CRM/Utils/Hook.php';
CRM_Utils_Hook::membershipTypeValues($form, $membershipTypeValues);
if (is_numeric($membershipTypeID) && $membershipTypeID > 0) {
return $membershipTypeValues[$membershipTypeID];
} else {
return $membershipTypeValues;
}
}
示例2: buildMembershipTypeValues
/**
* Build an array of available membership types.
*
* @param CRM_Core_Form $form
* @param array $membershipTypeID
* @param bool $activeOnly
* Do we only want active ones?
* (probably this should default to TRUE but as a newly added parameter we are leaving default b
* behaviour unchanged).
*
* @return array
*/
public static function buildMembershipTypeValues(&$form, $membershipTypeID = array(), $activeOnly = FALSE)
{
$whereClause = " WHERE domain_id = " . CRM_Core_Config::domainID();
$membershipTypeIDS = (array) $membershipTypeID;
if ($activeOnly) {
$whereClause .= " AND is_active = 1 ";
}
if (!empty($membershipTypeIDS)) {
$allIDs = implode(',', $membershipTypeIDS);
$whereClause .= " AND id IN ( {$allIDs} )";
}
CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes, CRM_Core_Action::ADD);
if ($financialTypes) {
$whereClause .= " AND financial_type_id IN (" . implode(',', array_keys($financialTypes)) . ")";
} else {
$whereClause .= " AND financial_type_id IN (0)";
}
$query = "\nSELECT *\nFROM civicrm_membership_type\n {$whereClause};\n";
$dao = CRM_Core_DAO::executeQuery($query);
$membershipTypeValues = array();
$membershipTypeFields = array('id', 'minimum_fee', 'name', 'is_active', 'description', 'financial_type_id', 'auto_renew', 'member_of_contact_id', 'relationship_type_id', 'relationship_direction', 'max_related', 'duration_unit', 'duration_interval');
while ($dao->fetch()) {
$membershipTypeValues[$dao->id] = array();
foreach ($membershipTypeFields as $mtField) {
$membershipTypeValues[$dao->id][$mtField] = $dao->{$mtField};
}
}
$dao->free();
CRM_Utils_Hook::membershipTypeValues($form, $membershipTypeValues);
if (is_numeric($membershipTypeID) && $membershipTypeID > 0) {
return $membershipTypeValues[$membershipTypeID];
} else {
return $membershipTypeValues;
}
}
示例3: implode
/**
* @param CRM_Core_Form $form
* @param int $membershipTypeID
*
* @return array
*/
public static function &buildMembershipTypeValues(&$form, $membershipTypeID = NULL)
{
$whereClause = " WHERE domain_id = " . CRM_Core_Config::domainID();
if (is_array($membershipTypeID)) {
$allIDs = implode(',', $membershipTypeID);
$whereClause .= " AND id IN ( {$allIDs} )";
} elseif (is_numeric($membershipTypeID) && $membershipTypeID > 0) {
$whereClause .= " AND id = {$membershipTypeID}";
}
$query = "\nSELECT *\nFROM civicrm_membership_type\n {$whereClause};\n";
$dao = CRM_Core_DAO::executeQuery($query);
$membershipTypeValues = array();
$membershipTypeFields = array('id', 'minimum_fee', 'name', 'is_active', 'description', 'financial_type_id', 'auto_renew', 'member_of_contact_id', 'relationship_type_id', 'relationship_direction', 'max_related');
while ($dao->fetch()) {
$membershipTypeValues[$dao->id] = array();
foreach ($membershipTypeFields as $mtField) {
$membershipTypeValues[$dao->id][$mtField] = $dao->{$mtField};
}
}
$dao->free();
CRM_Utils_Hook::membershipTypeValues($form, $membershipTypeValues);
if (is_numeric($membershipTypeID) && $membershipTypeID > 0) {
return $membershipTypeValues[$membershipTypeID];
} else {
return $membershipTypeValues;
}
}