Minor tabs cleanup
[civicrm-core.git] / CRM / Campaign / PseudoConstant.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17
18 /**
19 * This class holds all the Pseudo constants those
20 * are specific to Campaign and Survey.
21 */
22 class CRM_Campaign_PseudoConstant extends CRM_Core_PseudoConstant {
23
24 /**
25 * Activity types
26 * @var array
27 */
28 private static $activityType;
29
30 /**
31 * Campaign Type
32 * @var array
33 */
34 private static $campaignType = [];
35
36 /**
37 * Campaign Status
38 * @var array
39 */
40 private static $campaignStatus = [];
41
42 /**
43 * Engagement Level
44 * @var int
45 */
46 private static $engagementLevel;
47
48 /**
49 * @deprecated. Please use the buildOptions() method in the appropriate BAO object.
50 * Get all the survey activity types
51 *
52 * @param string $returnColumn
53 *
54 * @return array
55 * array reference of all survey activity types.
56 */
57 public static function &activityType($returnColumn = 'name') {
58 $cacheKey = $returnColumn;
59 if (!isset(self::$activityType[$cacheKey])) {
60 $campaingCompId = CRM_Core_Component::getComponentID('CiviCampaign');
61 if ($campaingCompId) {
62 self::$activityType[$cacheKey] = CRM_Core_OptionGroup::values('activity_type',
63 FALSE, FALSE, FALSE,
64 " AND v.component_id={$campaingCompId}",
65 $returnColumn
66 );
67 }
68 }
69 asort(self::$activityType[$cacheKey]);
70 return self::$activityType[$cacheKey];
71 }
72
73 /**
74 * @deprecated. Please use the buildOptions() method in the appropriate BAO object.
75 * Get all campaign types.
76 *
77 * The static array campaignType is returned
78 *
79 *
80 * @return array
81 * array reference of all campaign types.
82 */
83 public static function &campaignType() {
84 if (!self::$campaignType) {
85 self::$campaignType = CRM_Core_OptionGroup::values('campaign_type');
86 }
87 asort(self::$campaignType);
88 return self::$campaignType;
89 }
90
91 /**
92 * @deprecated. Please use the buildOptions() method in the appropriate BAO object.
93 * Get all campaign status.
94 *
95 * The static array campaignStatus is returned
96 *
97 *
98 * @return array
99 * array reference of all campaign status.
100 */
101 public static function &campaignStatus() {
102 if (!self::$campaignStatus) {
103 self::$campaignStatus = CRM_Core_OptionGroup::values('campaign_status');
104 }
105 asort(self::$campaignStatus);
106 return self::$campaignStatus;
107 }
108
109 /**
110 * @deprecated. Please use the buildOptions() method in the appropriate BAO object.
111 * Get all Engagement Level.
112 *
113 * The static array Engagement Level is returned
114 *
115 *
116 * @return array
117 * array reference of all Engagement Level.
118 */
119 public static function &engagementLevel() {
120 if (!isset(self::$engagementLevel)) {
121 self::$engagementLevel = CRM_Core_OptionGroup::values('engagement_index');
122 }
123
124 return self::$engagementLevel;
125 }
126
127 /**
128 * Flush given pseudoconstant so it can be reread from db
129 * next time it's requested.
130 *
131 *
132 * @param bool|string $name pseudoconstant to be flushed
133 */
134 public static function flush($name = 'cache') {
135 if (isset(self::$$name)) {
136 self::$$name = NULL;
137 }
138 }
139
140 }