Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
6b83d5bd | 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Campaign/Campaign.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e380ee3b | 9 | * (GenCodeChecksum:c6ffa4ea926f3a52afc754bf44ef8586) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Campaign entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
22 | static $_tableName = 'civicrm_campaign'; | |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
c3fc2621 CW |
29 | static $_log = FALSE; |
30 | ||
e501603b TO |
31 | /** |
32 | * Unique Campaign ID. | |
33 | * | |
34 | * @var int unsigned | |
35 | */ | |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * Name of the Campaign. | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | public $name; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Title of the Campaign. | |
47 | * | |
48 | * @var string | |
49 | */ | |
50 | public $title; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * Full description of Campaign. | |
54 | * | |
55 | * @var text | |
56 | */ | |
57 | public $description; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Date and time that Campaign starts. | |
61 | * | |
62 | * @var datetime | |
63 | */ | |
64 | public $start_date; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Date and time that Campaign ends. | |
68 | * | |
69 | * @var datetime | |
70 | */ | |
71 | public $end_date; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type | |
75 | * | |
76 | * @var int unsigned | |
77 | */ | |
78 | public $campaign_type_id; | |
c3fc2621 | 79 | |
e501603b TO |
80 | /** |
81 | * Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status | |
82 | * | |
83 | * @var int unsigned | |
84 | */ | |
85 | public $status_id; | |
c3fc2621 | 86 | |
e501603b TO |
87 | /** |
88 | * Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations. | |
89 | * | |
90 | * @var string | |
91 | */ | |
92 | public $external_identifier; | |
c3fc2621 | 93 | |
e501603b TO |
94 | /** |
95 | * Optional parent id for this Campaign. | |
96 | * | |
97 | * @var int unsigned | |
98 | */ | |
99 | public $parent_id; | |
c3fc2621 | 100 | |
e501603b TO |
101 | /** |
102 | * Is this Campaign enabled or disabled/cancelled? | |
103 | * | |
104 | * @var boolean | |
105 | */ | |
106 | public $is_active; | |
c3fc2621 | 107 | |
e501603b TO |
108 | /** |
109 | * FK to civicrm_contact, who created this Campaign. | |
110 | * | |
111 | * @var int unsigned | |
112 | */ | |
113 | public $created_id; | |
c3fc2621 | 114 | |
e501603b TO |
115 | /** |
116 | * Date and time that Campaign was created. | |
117 | * | |
118 | * @var datetime | |
119 | */ | |
120 | public $created_date; | |
c3fc2621 | 121 | |
e501603b TO |
122 | /** |
123 | * FK to civicrm_contact, who recently edited this Campaign. | |
124 | * | |
125 | * @var int unsigned | |
126 | */ | |
127 | public $last_modified_id; | |
c3fc2621 | 128 | |
e501603b TO |
129 | /** |
130 | * Date and time that Campaign was edited last time. | |
131 | * | |
132 | * @var datetime | |
133 | */ | |
134 | public $last_modified_date; | |
c3fc2621 | 135 | |
e501603b TO |
136 | /** |
137 | * General goals for Campaign. | |
138 | * | |
139 | * @var text | |
140 | */ | |
141 | public $goal_general; | |
c3fc2621 | 142 | |
e501603b TO |
143 | /** |
144 | * The target revenue for this campaign. | |
145 | * | |
146 | * @var float | |
147 | */ | |
148 | public $goal_revenue; | |
c3fc2621 | 149 | |
e501603b | 150 | /** |
f41f0342 | 151 | * Class constructor. |
e501603b | 152 | */ |
c3fc2621 | 153 | public function __construct() { |
e501603b TO |
154 | $this->__table = 'civicrm_campaign'; |
155 | parent::__construct(); | |
156 | } | |
c3fc2621 | 157 | |
e501603b | 158 | /** |
f41f0342 | 159 | * Returns foreign keys and entity references. |
e501603b TO |
160 | * |
161 | * @return array | |
162 | * [CRM_Core_Reference_Interface] | |
163 | */ | |
c3fc2621 | 164 | public static function getReferenceColumns() { |
346aaaba TO |
165 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
166 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
c3fc2621 CW |
167 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_campaign', 'id'); |
168 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); | |
169 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'last_modified_id', 'civicrm_contact', 'id'); | |
346aaaba | 170 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 171 | } |
346aaaba | 172 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 173 | } |
c3fc2621 | 174 | |
e501603b TO |
175 | /** |
176 | * Returns all the column names of this table | |
177 | * | |
178 | * @return array | |
179 | */ | |
c3fc2621 | 180 | public static function &fields() { |
346aaaba | 181 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
182 | Civi::$statics[__CLASS__]['fields'] = [ |
183 | 'id' => [ | |
e501603b TO |
184 | 'name' => 'id', |
185 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 186 | 'title' => ts('Campaign ID'), |
215b423e | 187 | 'description' => ts('Unique Campaign ID.'), |
c3fc2621 CW |
188 | 'required' => TRUE, |
189 | 'import' => TRUE, | |
e501603b TO |
190 | 'where' => 'civicrm_campaign.id', |
191 | 'headerPattern' => '', | |
192 | 'dataPattern' => '', | |
c3fc2621 | 193 | 'export' => TRUE, |
522a26c9 | 194 | 'table_name' => 'civicrm_campaign', |
195 | 'entity' => 'Campaign', | |
196 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 197 | 'localizable' => 0, |
c3fc2621 CW |
198 | ], |
199 | 'name' => [ | |
e501603b TO |
200 | 'name' => 'name', |
201 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 202 | 'title' => ts('Campaign Name'), |
215b423e | 203 | 'description' => ts('Name of the Campaign.'), |
c3fc2621 | 204 | 'required' => TRUE, |
e501603b TO |
205 | 'maxlength' => 255, |
206 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 207 | 'import' => TRUE, |
e501603b TO |
208 | 'where' => 'civicrm_campaign.name', |
209 | 'headerPattern' => '', | |
210 | 'dataPattern' => '', | |
c3fc2621 | 211 | 'export' => TRUE, |
522a26c9 | 212 | 'table_name' => 'civicrm_campaign', |
213 | 'entity' => 'Campaign', | |
214 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 215 | 'localizable' => 0, |
c3fc2621 | 216 | 'html' => [ |
e501603b | 217 | 'type' => 'Text', |
c3fc2621 CW |
218 | ], |
219 | ], | |
220 | 'title' => [ | |
e501603b TO |
221 | 'name' => 'title', |
222 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 223 | 'title' => ts('Campaign Title'), |
215b423e | 224 | 'description' => ts('Title of the Campaign.'), |
e501603b TO |
225 | 'maxlength' => 255, |
226 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 227 | 'import' => TRUE, |
e501603b TO |
228 | 'where' => 'civicrm_campaign.title', |
229 | 'headerPattern' => '', | |
230 | 'dataPattern' => '', | |
c3fc2621 | 231 | 'export' => TRUE, |
522a26c9 | 232 | 'table_name' => 'civicrm_campaign', |
233 | 'entity' => 'Campaign', | |
234 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 235 | 'localizable' => 0, |
c3fc2621 | 236 | 'html' => [ |
e501603b | 237 | 'type' => 'Text', |
c3fc2621 CW |
238 | ], |
239 | ], | |
240 | 'description' => [ | |
e501603b TO |
241 | 'name' => 'description', |
242 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 243 | 'title' => ts('Campaign Description'), |
215b423e | 244 | 'description' => ts('Full description of Campaign.'), |
e501603b TO |
245 | 'rows' => 8, |
246 | 'cols' => 60, | |
522a26c9 | 247 | 'table_name' => 'civicrm_campaign', |
248 | 'entity' => 'Campaign', | |
249 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 250 | 'localizable' => 0, |
c3fc2621 | 251 | 'html' => [ |
e501603b | 252 | 'type' => 'TextArea', |
c3fc2621 CW |
253 | ], |
254 | ], | |
255 | 'start_date' => [ | |
e501603b TO |
256 | 'name' => 'start_date', |
257 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 258 | 'title' => ts('Campaign Start Date'), |
215b423e | 259 | 'description' => ts('Date and time that Campaign starts.'), |
c3fc2621 | 260 | 'import' => TRUE, |
e501603b TO |
261 | 'where' => 'civicrm_campaign.start_date', |
262 | 'headerPattern' => '/^start|(s(tart\s)?date)$/i', | |
263 | 'dataPattern' => '', | |
c3fc2621 | 264 | 'export' => TRUE, |
522a26c9 | 265 | 'table_name' => 'civicrm_campaign', |
266 | 'entity' => 'Campaign', | |
267 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 268 | 'localizable' => 0, |
c3fc2621 | 269 | 'html' => [ |
e501603b | 270 | 'type' => 'Select Date', |
c3fc2621 CW |
271 | ], |
272 | ], | |
273 | 'end_date' => [ | |
e501603b TO |
274 | 'name' => 'end_date', |
275 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 276 | 'title' => ts('Campaign End Date'), |
215b423e | 277 | 'description' => ts('Date and time that Campaign ends.'), |
c3fc2621 | 278 | 'import' => TRUE, |
e501603b TO |
279 | 'where' => 'civicrm_campaign.end_date', |
280 | 'headerPattern' => '/^end|(e(nd\s)?date)$/i', | |
281 | 'dataPattern' => '', | |
c3fc2621 | 282 | 'export' => TRUE, |
522a26c9 | 283 | 'table_name' => 'civicrm_campaign', |
284 | 'entity' => 'Campaign', | |
285 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 286 | 'localizable' => 0, |
c3fc2621 | 287 | 'html' => [ |
e501603b | 288 | 'type' => 'Select Date', |
c3fc2621 CW |
289 | ], |
290 | ], | |
291 | 'campaign_type_id' => [ | |
e501603b TO |
292 | 'name' => 'campaign_type_id', |
293 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 294 | 'title' => ts('Campaign Type'), |
215b423e | 295 | 'description' => ts('Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type'), |
c3fc2621 | 296 | 'import' => TRUE, |
e501603b TO |
297 | 'where' => 'civicrm_campaign.campaign_type_id', |
298 | 'headerPattern' => '', | |
299 | 'dataPattern' => '', | |
c3fc2621 | 300 | 'export' => TRUE, |
e501603b | 301 | 'default' => 'NULL', |
522a26c9 | 302 | 'table_name' => 'civicrm_campaign', |
303 | 'entity' => 'Campaign', | |
304 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 305 | 'localizable' => 0, |
c3fc2621 | 306 | 'html' => [ |
e501603b | 307 | 'type' => 'Select', |
c3fc2621 CW |
308 | ], |
309 | 'pseudoconstant' => [ | |
e501603b TO |
310 | 'optionGroupName' => 'campaign_type', |
311 | 'optionEditPath' => 'civicrm/admin/options/campaign_type', | |
c3fc2621 CW |
312 | ] |
313 | ], | |
314 | 'status_id' => [ | |
e501603b TO |
315 | 'name' => 'status_id', |
316 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 317 | 'title' => ts('Campaign Status'), |
215b423e | 318 | 'description' => ts('Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status'), |
c3fc2621 | 319 | 'import' => TRUE, |
e501603b TO |
320 | 'where' => 'civicrm_campaign.status_id', |
321 | 'headerPattern' => '', | |
322 | 'dataPattern' => '', | |
c3fc2621 | 323 | 'export' => TRUE, |
e501603b | 324 | 'default' => 'NULL', |
522a26c9 | 325 | 'table_name' => 'civicrm_campaign', |
326 | 'entity' => 'Campaign', | |
327 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 328 | 'localizable' => 0, |
c3fc2621 | 329 | 'html' => [ |
e501603b | 330 | 'type' => 'Select', |
c3fc2621 CW |
331 | ], |
332 | 'pseudoconstant' => [ | |
e501603b TO |
333 | 'optionGroupName' => 'campaign_status', |
334 | 'optionEditPath' => 'civicrm/admin/options/campaign_status', | |
c3fc2621 CW |
335 | ] |
336 | ], | |
337 | 'external_identifier' => [ | |
e501603b TO |
338 | 'name' => 'external_identifier', |
339 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 340 | 'title' => ts('Campaign External ID'), |
215b423e | 341 | 'description' => ts('Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.'), |
e501603b TO |
342 | 'maxlength' => 32, |
343 | 'size' => CRM_Utils_Type::MEDIUM, | |
c3fc2621 | 344 | 'import' => TRUE, |
e501603b TO |
345 | 'where' => 'civicrm_campaign.external_identifier', |
346 | 'headerPattern' => '/external\s?id/i', | |
347 | 'dataPattern' => '/^\d{11,}$/', | |
c3fc2621 | 348 | 'export' => TRUE, |
522a26c9 | 349 | 'table_name' => 'civicrm_campaign', |
350 | 'entity' => 'Campaign', | |
351 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 352 | 'localizable' => 0, |
c3fc2621 | 353 | 'html' => [ |
e501603b | 354 | 'type' => 'Text', |
c3fc2621 CW |
355 | ], |
356 | ], | |
357 | 'parent_id' => [ | |
e501603b TO |
358 | 'name' => 'parent_id', |
359 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 360 | 'title' => ts('Parent Campaign'), |
215b423e | 361 | 'description' => ts('Optional parent id for this Campaign.'), |
c3fc2621 | 362 | 'import' => TRUE, |
e501603b TO |
363 | 'where' => 'civicrm_campaign.parent_id', |
364 | 'headerPattern' => '', | |
365 | 'dataPattern' => '', | |
c3fc2621 | 366 | 'export' => TRUE, |
e501603b | 367 | 'default' => 'NULL', |
522a26c9 | 368 | 'table_name' => 'civicrm_campaign', |
369 | 'entity' => 'Campaign', | |
370 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 371 | 'localizable' => 0, |
e501603b | 372 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', |
c3fc2621 | 373 | 'html' => [ |
e501603b | 374 | 'type' => 'EntityRef', |
c3fc2621 CW |
375 | ], |
376 | ], | |
377 | 'is_active' => [ | |
e501603b TO |
378 | 'name' => 'is_active', |
379 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 380 | 'title' => ts('Is Campaign Active?'), |
215b423e | 381 | 'description' => ts('Is this Campaign enabled or disabled/cancelled?'), |
e501603b | 382 | 'default' => '1', |
522a26c9 | 383 | 'table_name' => 'civicrm_campaign', |
384 | 'entity' => 'Campaign', | |
385 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 386 | 'localizable' => 0, |
c3fc2621 | 387 | 'html' => [ |
e501603b | 388 | 'type' => 'CheckBox', |
c3fc2621 CW |
389 | ], |
390 | ], | |
391 | 'created_id' => [ | |
e501603b TO |
392 | 'name' => 'created_id', |
393 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 394 | 'title' => ts('Campaign Created By'), |
215b423e | 395 | 'description' => ts('FK to civicrm_contact, who created this Campaign.'), |
522a26c9 | 396 | 'table_name' => 'civicrm_campaign', |
397 | 'entity' => 'Campaign', | |
398 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 399 | 'localizable' => 0, |
e501603b | 400 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 CW |
401 | ], |
402 | 'created_date' => [ | |
e501603b TO |
403 | 'name' => 'created_date', |
404 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 405 | 'title' => ts('Campaign Created Date'), |
215b423e | 406 | 'description' => ts('Date and time that Campaign was created.'), |
522a26c9 | 407 | 'table_name' => 'civicrm_campaign', |
408 | 'entity' => 'Campaign', | |
409 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 410 | 'localizable' => 0, |
c3fc2621 | 411 | 'html' => [ |
e501603b | 412 | 'type' => 'Select Date', |
c3fc2621 CW |
413 | ], |
414 | ], | |
415 | 'last_modified_id' => [ | |
e501603b TO |
416 | 'name' => 'last_modified_id', |
417 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 418 | 'title' => ts('Campaign Modified By'), |
215b423e | 419 | 'description' => ts('FK to civicrm_contact, who recently edited this Campaign.'), |
522a26c9 | 420 | 'table_name' => 'civicrm_campaign', |
421 | 'entity' => 'Campaign', | |
422 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 423 | 'localizable' => 0, |
e501603b | 424 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 CW |
425 | ], |
426 | 'last_modified_date' => [ | |
e501603b TO |
427 | 'name' => 'last_modified_date', |
428 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 429 | 'title' => ts('Campaign Modified Date'), |
215b423e | 430 | 'description' => ts('Date and time that Campaign was edited last time.'), |
522a26c9 | 431 | 'table_name' => 'civicrm_campaign', |
432 | 'entity' => 'Campaign', | |
433 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 434 | 'localizable' => 0, |
c3fc2621 CW |
435 | ], |
436 | 'goal_general' => [ | |
e501603b TO |
437 | 'name' => 'goal_general', |
438 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 439 | 'title' => ts('Campaign Goals'), |
215b423e | 440 | 'description' => ts('General goals for Campaign.'), |
522a26c9 | 441 | 'table_name' => 'civicrm_campaign', |
442 | 'entity' => 'Campaign', | |
443 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 444 | 'localizable' => 0, |
c3fc2621 | 445 | 'html' => [ |
e501603b | 446 | 'type' => 'RichTextEditor', |
c3fc2621 CW |
447 | ], |
448 | ], | |
449 | 'goal_revenue' => [ | |
e501603b TO |
450 | 'name' => 'goal_revenue', |
451 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 452 | 'title' => ts('Goal Revenue'), |
215b423e | 453 | 'description' => ts('The target revenue for this campaign.'), |
c3fc2621 | 454 | 'precision' => [ |
e501603b TO |
455 | 20, |
456 | 2 | |
c3fc2621 | 457 | ], |
522a26c9 | 458 | 'table_name' => 'civicrm_campaign', |
459 | 'entity' => 'Campaign', | |
460 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 461 | 'localizable' => 0, |
c3fc2621 | 462 | 'html' => [ |
e501603b | 463 | 'type' => 'Text', |
c3fc2621 CW |
464 | ], |
465 | ], | |
466 | ]; | |
346aaaba | 467 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 468 | } |
346aaaba | 469 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 470 | } |
c3fc2621 | 471 | |
e501603b | 472 | /** |
bd8e0b14 | 473 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
474 | * |
475 | * @return array | |
bd8e0b14 | 476 | * Array(string $name => string $uniqueName). |
e501603b | 477 | */ |
c3fc2621 | 478 | public static function &fieldKeys() { |
bd8e0b14 TO |
479 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
480 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 481 | } |
bd8e0b14 | 482 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 483 | } |
c3fc2621 | 484 | |
e501603b TO |
485 | /** |
486 | * Returns the names of this table | |
487 | * | |
488 | * @return string | |
489 | */ | |
c3fc2621 | 490 | public static function getTableName() { |
e501603b TO |
491 | return self::$_tableName; |
492 | } | |
c3fc2621 | 493 | |
e501603b TO |
494 | /** |
495 | * Returns if this table needs to be logged | |
496 | * | |
c3fc2621 | 497 | * @return bool |
e501603b | 498 | */ |
c3fc2621 | 499 | public function getLog() { |
e501603b TO |
500 | return self::$_log; |
501 | } | |
c3fc2621 | 502 | |
e501603b TO |
503 | /** |
504 | * Returns the list of fields that can be imported | |
505 | * | |
506 | * @param bool $prefix | |
507 | * | |
508 | * @return array | |
509 | */ | |
c3fc2621 CW |
510 | public static function &import($prefix = FALSE) { |
511 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'campaign', $prefix, []); | |
60808919 | 512 | return $r; |
e501603b | 513 | } |
c3fc2621 | 514 | |
e501603b TO |
515 | /** |
516 | * Returns the list of fields that can be exported | |
517 | * | |
518 | * @param bool $prefix | |
519 | * | |
520 | * @return array | |
521 | */ | |
c3fc2621 CW |
522 | public static function &export($prefix = FALSE) { |
523 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'campaign', $prefix, []); | |
60808919 | 524 | return $r; |
e501603b | 525 | } |
c3fc2621 | 526 | |
e7a6b91a AS |
527 | /** |
528 | * Returns the list of indices | |
c3fc2621 CW |
529 | * |
530 | * @param bool $localize | |
531 | * | |
532 | * @return array | |
e7a6b91a AS |
533 | */ |
534 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
535 | $indices = [ |
536 | 'UI_campaign_type_id' => [ | |
e7a6b91a | 537 | 'name' => 'UI_campaign_type_id', |
c3fc2621 | 538 | 'field' => [ |
e7a6b91a | 539 | 0 => 'campaign_type_id', |
c3fc2621 CW |
540 | ], |
541 | 'localizable' => FALSE, | |
e7a6b91a | 542 | 'sig' => 'civicrm_campaign::0::campaign_type_id', |
c3fc2621 CW |
543 | ], |
544 | 'UI_campaign_status_id' => [ | |
e7a6b91a | 545 | 'name' => 'UI_campaign_status_id', |
c3fc2621 | 546 | 'field' => [ |
e7a6b91a | 547 | 0 => 'status_id', |
c3fc2621 CW |
548 | ], |
549 | 'localizable' => FALSE, | |
e7a6b91a | 550 | 'sig' => 'civicrm_campaign::0::status_id', |
c3fc2621 CW |
551 | ], |
552 | 'UI_external_identifier' => [ | |
e7a6b91a | 553 | 'name' => 'UI_external_identifier', |
c3fc2621 | 554 | 'field' => [ |
e7a6b91a | 555 | 0 => 'external_identifier', |
c3fc2621 CW |
556 | ], |
557 | 'localizable' => FALSE, | |
558 | 'unique' => TRUE, | |
e7a6b91a | 559 | 'sig' => 'civicrm_campaign::1::external_identifier', |
c3fc2621 CW |
560 | ], |
561 | ]; | |
e7a6b91a AS |
562 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
563 | } | |
c3fc2621 | 564 | |
e501603b | 565 | } |