Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
06b69b18 | 4 | | CiviCRM version 4.5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06b69b18 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
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. | | |
13 | | | | |
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. | | |
18 | | | | |
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 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | ||
28 | /** | |
29 | * | |
30 | * @package CRM | |
06b69b18 | 31 | * @copyright CiviCRM LLC (c) 2004-2014 |
6a488035 TO |
32 | * $Id$ |
33 | * | |
34 | */ | |
35 | ||
36 | /** | |
37 | * This class holds all the Pseudo constants those | |
38 | * are specific to Campaign and Survey. | |
39 | */ | |
40 | class CRM_Campaign_PseudoConstant extends CRM_Core_PseudoConstant { | |
41 | ||
42 | /** | |
43 | * Activity types | |
44 | * @var array | |
45 | * @static | |
46 | */ | |
47 | private static $activityType; | |
48 | ||
49 | /** | |
50 | * Campaign Type | |
51 | * @var array | |
52 | * @static | |
53 | */ | |
54 | private static $campaignType = array(); | |
55 | ||
56 | /** | |
57 | * Campaign Status | |
58 | * @var array | |
59 | * @static | |
60 | */ | |
61 | private static $campaignStatus = array(); | |
62 | ||
63 | /** | |
64 | * Engagement Level | |
65 | * @static | |
66 | */ | |
67 | private static $engagementLevel; | |
68 | ||
69 | /** | |
3f3a3ba0 | 70 | * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. |
6a488035 TO |
71 | * Get all the survey activity types |
72 | * | |
73 | * @access public | |
74 | * | |
dd244018 EM |
75 | * @param string $returnColumn |
76 | * | |
6a488035 TO |
77 | * @return array - array reference of all survey activity types. |
78 | * @static | |
79 | */ | |
80 | public static function &activityType($returnColumn = 'name') { | |
81 | $cacheKey = $returnColumn; | |
82 | if (!isset(self::$activityType[$cacheKey])) { | |
83 | $campaingCompId = CRM_Core_Component::getComponentID('CiviCampaign'); | |
84 | if ($campaingCompId) { | |
85 | self::$activityType[$cacheKey] = CRM_Core_OptionGroup::values('activity_type', | |
86 | FALSE, FALSE, FALSE, | |
87 | " AND v.component_id={$campaingCompId}", | |
88 | $returnColumn | |
89 | ); | |
90 | } | |
91 | } | |
92 | asort(self::$activityType[$cacheKey]); | |
93 | return self::$activityType[$cacheKey]; | |
94 | } | |
95 | ||
96 | /** | |
3f3a3ba0 | 97 | * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. |
6a488035 TO |
98 | * Get all campaign types. |
99 | * | |
100 | * The static array campaignType is returned | |
101 | * | |
102 | * @access public | |
103 | * @static | |
104 | * | |
105 | * @return array - array reference of all campaign types. | |
106 | * | |
107 | */ | |
108 | public static function &campaignType() { | |
109 | if (!self::$campaignType) { | |
110 | self::$campaignType = CRM_Core_OptionGroup::values('campaign_type'); | |
111 | } | |
112 | asort(self::$campaignType); | |
113 | return self::$campaignType; | |
114 | } | |
115 | ||
116 | /** | |
3f3a3ba0 | 117 | * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. |
6a488035 TO |
118 | * Get all campaign status. |
119 | * | |
120 | * The static array campaignStatus is returned | |
121 | * | |
122 | * @access public | |
123 | * @static | |
124 | * | |
125 | * @return array - array reference of all campaign status. | |
126 | * | |
127 | */ | |
128 | public static function &campaignStatus() { | |
129 | if (!self::$campaignStatus) { | |
130 | self::$campaignStatus = CRM_Core_OptionGroup::values('campaign_status'); | |
131 | } | |
132 | asort(self::$campaignStatus); | |
133 | return self::$campaignStatus; | |
134 | } | |
135 | ||
136 | /** | |
3f3a3ba0 | 137 | * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. |
6a488035 TO |
138 | * Get all Engagement Level. |
139 | * | |
140 | * The static array Engagement Level is returned | |
141 | * | |
142 | * @access public | |
143 | * @static | |
144 | * | |
145 | * @return array - array reference of all Engagement Level. | |
146 | */ | |
147 | public static function &engagementLevel() { | |
148 | if (!isset(self::$engagementLevel)) { | |
149 | self::$engagementLevel = CRM_Core_OptionGroup::values('engagement_index'); | |
150 | } | |
151 | ||
152 | return self::$engagementLevel; | |
153 | } | |
154 | ||
155 | /** | |
156 | * Flush given pseudoconstant so it can be reread from db | |
3f3a3ba0 | 157 | * next time it's requested. |
6a488035 TO |
158 | * |
159 | * @access public | |
160 | * @static | |
161 | * | |
da6b46f4 | 162 | * @param bool|string $name pseudoconstant to be flushed |
6a488035 | 163 | */ |
3f3a3ba0 | 164 | public static function flush($name = 'cache') { |
fa56270d CW |
165 | if (isset(self::$$name)) { |
166 | self::$$name = NULL; | |
167 | } | |
6a488035 TO |
168 | } |
169 | } | |
170 |