Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
232624b1 | 4 | | CiviCRM version 4.4 | |
6a488035 TO |
5 | +--------------------------------------------------------------------+ |
6 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
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 | |
31 | * @copyright CiviCRM LLC (c) 2004-2013 | |
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 | * | |
75 | * @return array - array reference of all survey activity types. | |
76 | * @static | |
77 | */ | |
78 | public static function &activityType($returnColumn = 'name') { | |
79 | $cacheKey = $returnColumn; | |
80 | if (!isset(self::$activityType[$cacheKey])) { | |
81 | $campaingCompId = CRM_Core_Component::getComponentID('CiviCampaign'); | |
82 | if ($campaingCompId) { | |
83 | self::$activityType[$cacheKey] = CRM_Core_OptionGroup::values('activity_type', | |
84 | FALSE, FALSE, FALSE, | |
85 | " AND v.component_id={$campaingCompId}", | |
86 | $returnColumn | |
87 | ); | |
88 | } | |
89 | } | |
90 | asort(self::$activityType[$cacheKey]); | |
91 | return self::$activityType[$cacheKey]; | |
92 | } | |
93 | ||
94 | /** | |
3f3a3ba0 | 95 | * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. |
6a488035 TO |
96 | * Get all campaign types. |
97 | * | |
98 | * The static array campaignType is returned | |
99 | * | |
100 | * @access public | |
101 | * @static | |
102 | * | |
103 | * @return array - array reference of all campaign types. | |
104 | * | |
105 | */ | |
106 | public static function &campaignType() { | |
107 | if (!self::$campaignType) { | |
108 | self::$campaignType = CRM_Core_OptionGroup::values('campaign_type'); | |
109 | } | |
110 | asort(self::$campaignType); | |
111 | return self::$campaignType; | |
112 | } | |
113 | ||
114 | /** | |
3f3a3ba0 | 115 | * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. |
6a488035 TO |
116 | * Get all campaign status. |
117 | * | |
118 | * The static array campaignStatus is returned | |
119 | * | |
120 | * @access public | |
121 | * @static | |
122 | * | |
123 | * @return array - array reference of all campaign status. | |
124 | * | |
125 | */ | |
126 | public static function &campaignStatus() { | |
127 | if (!self::$campaignStatus) { | |
128 | self::$campaignStatus = CRM_Core_OptionGroup::values('campaign_status'); | |
129 | } | |
130 | asort(self::$campaignStatus); | |
131 | return self::$campaignStatus; | |
132 | } | |
133 | ||
134 | /** | |
3f3a3ba0 | 135 | * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. |
6a488035 TO |
136 | * Get all Engagement Level. |
137 | * | |
138 | * The static array Engagement Level is returned | |
139 | * | |
140 | * @access public | |
141 | * @static | |
142 | * | |
143 | * @return array - array reference of all Engagement Level. | |
144 | */ | |
145 | public static function &engagementLevel() { | |
146 | if (!isset(self::$engagementLevel)) { | |
147 | self::$engagementLevel = CRM_Core_OptionGroup::values('engagement_index'); | |
148 | } | |
149 | ||
150 | return self::$engagementLevel; | |
151 | } | |
152 | ||
153 | /** | |
154 | * Flush given pseudoconstant so it can be reread from db | |
3f3a3ba0 | 155 | * next time it's requested. |
6a488035 TO |
156 | * |
157 | * @access public | |
158 | * @static | |
159 | * | |
160 | * @param boolean $name pseudoconstant to be flushed | |
161 | * | |
162 | */ | |
3f3a3ba0 | 163 | public static function flush($name = 'cache') { |
fa56270d CW |
164 | if (isset(self::$$name)) { |
165 | self::$$name = NULL; | |
166 | } | |
6a488035 TO |
167 | } |
168 | } | |
169 |