Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
39de6fd5 | 4 | | CiviCRM version 4.6 | |
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 | +--------------------------------------------------------------------+ | |
d25dd0ee | 26 | */ |
6a488035 TO |
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 | |
6a488035 TO |
45 | */ |
46 | private static $activityType; | |
47 | ||
48 | /** | |
49 | * Campaign Type | |
50 | * @var array | |
6a488035 TO |
51 | */ |
52 | private static $campaignType = array(); | |
53 | ||
54 | /** | |
55 | * Campaign Status | |
56 | * @var array | |
6a488035 TO |
57 | */ |
58 | private static $campaignStatus = array(); | |
59 | ||
60 | /** | |
61 | * Engagement Level | |
6a488035 TO |
62 | */ |
63 | private static $engagementLevel; | |
64 | ||
65 | /** | |
3f3a3ba0 | 66 | * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. |
6a488035 TO |
67 | * Get all the survey activity types |
68 | * | |
6a488035 | 69 | * |
dd244018 EM |
70 | * @param string $returnColumn |
71 | * | |
a6c01b45 CW |
72 | * @return array |
73 | * array reference of all survey activity types. | |
6a488035 TO |
74 | */ |
75 | public static function &activityType($returnColumn = 'name') { | |
76 | $cacheKey = $returnColumn; | |
77 | if (!isset(self::$activityType[$cacheKey])) { | |
78 | $campaingCompId = CRM_Core_Component::getComponentID('CiviCampaign'); | |
79 | if ($campaingCompId) { | |
80 | self::$activityType[$cacheKey] = CRM_Core_OptionGroup::values('activity_type', | |
81 | FALSE, FALSE, FALSE, | |
82 | " AND v.component_id={$campaingCompId}", | |
83 | $returnColumn | |
84 | ); | |
85 | } | |
86 | } | |
87 | asort(self::$activityType[$cacheKey]); | |
88 | return self::$activityType[$cacheKey]; | |
89 | } | |
90 | ||
91 | /** | |
3f3a3ba0 | 92 | * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. |
6a488035 TO |
93 | * Get all campaign types. |
94 | * | |
95 | * The static array campaignType is returned | |
96 | * | |
6a488035 | 97 | * |
a6c01b45 CW |
98 | * @return array |
99 | * array reference of all campaign types. | |
6a488035 TO |
100 | */ |
101 | public static function &campaignType() { | |
102 | if (!self::$campaignType) { | |
103 | self::$campaignType = CRM_Core_OptionGroup::values('campaign_type'); | |
104 | } | |
105 | asort(self::$campaignType); | |
106 | return self::$campaignType; | |
107 | } | |
108 | ||
109 | /** | |
3f3a3ba0 | 110 | * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. |
6a488035 TO |
111 | * Get all campaign status. |
112 | * | |
113 | * The static array campaignStatus is returned | |
114 | * | |
6a488035 | 115 | * |
a6c01b45 CW |
116 | * @return array |
117 | * array reference of all campaign status. | |
6a488035 TO |
118 | */ |
119 | public static function &campaignStatus() { | |
120 | if (!self::$campaignStatus) { | |
121 | self::$campaignStatus = CRM_Core_OptionGroup::values('campaign_status'); | |
122 | } | |
123 | asort(self::$campaignStatus); | |
124 | return self::$campaignStatus; | |
125 | } | |
126 | ||
127 | /** | |
3f3a3ba0 | 128 | * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. |
6a488035 TO |
129 | * Get all Engagement Level. |
130 | * | |
131 | * The static array Engagement Level is returned | |
132 | * | |
6a488035 | 133 | * |
a6c01b45 CW |
134 | * @return array |
135 | * array reference of all Engagement Level. | |
6a488035 TO |
136 | */ |
137 | public static function &engagementLevel() { | |
138 | if (!isset(self::$engagementLevel)) { | |
139 | self::$engagementLevel = CRM_Core_OptionGroup::values('engagement_index'); | |
140 | } | |
141 | ||
142 | return self::$engagementLevel; | |
143 | } | |
144 | ||
145 | /** | |
146 | * Flush given pseudoconstant so it can be reread from db | |
3f3a3ba0 | 147 | * next time it's requested. |
6a488035 | 148 | * |
6a488035 | 149 | * |
da6b46f4 | 150 | * @param bool|string $name pseudoconstant to be flushed |
6a488035 | 151 | */ |
3f3a3ba0 | 152 | public static function flush($name = 'cache') { |
94880218 | 153 | if (isset(self::$$name)) { |
fa56270d | 154 | self::$$name = NULL; |
353ffa53 | 155 | } |
6a488035 | 156 | } |
96025800 | 157 | |
6a488035 | 158 | } |