3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2014
37 * This class holds all the Pseudo constants that are specific to the civimember component. This avoids
38 * polluting the core class and isolates the mass mailer class
40 class CRM_Member_PseudoConstant
extends CRM_Core_PseudoConstant
{
47 private static $membershipType;
54 private static $membershipStatus;
57 * Get all the membership types
64 * @return array - array reference of all membership types if any
67 public static function &membershipType($id = NULL, $force = FALSE) {
68 if (!self
::$membershipType ||
$force) {
69 CRM_Core_PseudoConstant
::populate(self
::$membershipType,
70 'CRM_Member_DAO_MembershipType',
71 FALSE, 'name', 'is_active', NULL, 'weight', 'id', TRUE
75 if (array_key_exists($id, self
::$membershipType)) {
76 return self
::$membershipType[$id];
83 return self
::$membershipType;
87 * Get all the membership statuss
93 * @param string $column
96 * @return array - array reference of all membership statuss if any
99 public static function &membershipStatus($id = NULL, $cond = NULL, $column = 'name', $force = FALSE) {
100 if (self
::$membershipStatus === NULL) {
101 self
::$membershipStatus = array();
106 $cacheKey .= "_{$cond}";
108 if (!isset(self
::$membershipStatus[$cacheKey]) ||
$force) {
109 CRM_Core_PseudoConstant
::populate(self
::$membershipStatus[$cacheKey],
110 'CRM_Member_DAO_MembershipStatus',
111 FALSE, $column, 'is_active', $cond, 'weight'
117 $value = CRM_Utils_Array
::value($id, self
::$membershipStatus[$cacheKey]);
120 $value = self
::$membershipStatus[$cacheKey];
127 * Flush given pseudoconstant so it can be reread from db
128 * next time it's requested.
133 * @param bool|string $name pseudoconstant to be flushed
135 public static function flush($name = 'cache') {
136 if (isset(self
::$
$name)) {