當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Utils_Hook::membershipTypeValues方法代碼示例

本文整理匯總了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;
     }
 }
開發者ID:hampelm,項目名稱:Ginsberg-CiviDemo,代碼行數:30,代碼來源:Membership.php

示例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;
     }
 }
開發者ID:konadave,項目名稱:civicrm-core,代碼行數:47,代碼來源:Membership.php

示例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;
     }
 }
開發者ID:kidaa30,項目名稱:yes,代碼行數:33,代碼來源:Membership.php


注:本文中的CRM_Utils_Hook::membershipTypeValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。