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