Merge pull request #18324 from mattwire/payproc_configoptional
[civicrm-core.git] / CRM / Campaign / DAO / Survey.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Campaign/Survey.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:afb7cfcccd2a6177b2b10e07afa92e8e)
10 */
11
12 /**
13 * Database access object for the Survey entity.
14 */
15 class CRM_Campaign_DAO_Survey extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.2';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_survey';
25
26 /**
27 * Icon associated with this entity.
28 *
29 * @var string
30 */
31 public static $_icon = 'fa-clipboard';
32
33 /**
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
35 *
36 * @var bool
37 */
38 public static $_log = FALSE;
39
40 /**
41 * Survey id.
42 *
43 * @var int
44 */
45 public $id;
46
47 /**
48 * Title of the Survey.
49 *
50 * @var string
51 */
52 public $title;
53
54 /**
55 * Foreign key to the Campaign.
56 *
57 * @var int
58 */
59 public $campaign_id;
60
61 /**
62 * Implicit FK to civicrm_option_value where option_group = activity_type
63 *
64 * @var int
65 */
66 public $activity_type_id;
67
68 /**
69 * Recontact intervals for each status.
70 *
71 * @var text
72 */
73 public $recontact_interval;
74
75 /**
76 * Script instructions for volunteers to use for the survey.
77 *
78 * @var text
79 */
80 public $instructions;
81
82 /**
83 * Number of days for recurrence of release.
84 *
85 * @var int
86 */
87 public $release_frequency;
88
89 /**
90 * Maximum number of contacts to allow for survey.
91 *
92 * @var int
93 */
94 public $max_number_of_contacts;
95
96 /**
97 * Default number of contacts to allow for survey.
98 *
99 * @var int
100 */
101 public $default_number_of_contacts;
102
103 /**
104 * Is this survey enabled or disabled/cancelled?
105 *
106 * @var bool
107 */
108 public $is_active;
109
110 /**
111 * Is this default survey?
112 *
113 * @var bool
114 */
115 public $is_default;
116
117 /**
118 * FK to civicrm_contact, who created this Survey.
119 *
120 * @var int
121 */
122 public $created_id;
123
124 /**
125 * Date and time that Survey was created.
126 *
127 * @var datetime
128 */
129 public $created_date;
130
131 /**
132 * FK to civicrm_contact, who recently edited this Survey.
133 *
134 * @var int
135 */
136 public $last_modified_id;
137
138 /**
139 * Date and time that Survey was edited last time.
140 *
141 * @var datetime
142 */
143 public $last_modified_date;
144
145 /**
146 * Used to store option group id.
147 *
148 * @var int
149 */
150 public $result_id;
151
152 /**
153 * Bypass the email verification.
154 *
155 * @var bool
156 */
157 public $bypass_confirm;
158
159 /**
160 * Title for Thank-you page (header title tag, and display at the top of the page).
161 *
162 * @var string
163 */
164 public $thankyou_title;
165
166 /**
167 * text and html allowed. displayed above result on success page
168 *
169 * @var text
170 */
171 public $thankyou_text;
172
173 /**
174 * Can people share the petition through social media?
175 *
176 * @var bool
177 */
178 public $is_share;
179
180 /**
181 * Class constructor.
182 */
183 public function __construct() {
184 $this->__table = 'civicrm_survey';
185 parent::__construct();
186 }
187
188 /**
189 * Returns localized title of this entity.
190 *
191 * @param bool $plural
192 * Whether to return the plural version of the title.
193 */
194 public static function getEntityTitle($plural = FALSE) {
195 return $plural ? ts('Surveys') : ts('Survey');
196 }
197
198 /**
199 * Returns foreign keys and entity references.
200 *
201 * @return array
202 * [CRM_Core_Reference_Interface]
203 */
204 public static function getReferenceColumns() {
205 if (!isset(Civi::$statics[__CLASS__]['links'])) {
206 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
207 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
208 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
209 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'last_modified_id', 'civicrm_contact', 'id');
210 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
211 }
212 return Civi::$statics[__CLASS__]['links'];
213 }
214
215 /**
216 * Returns all the column names of this table
217 *
218 * @return array
219 */
220 public static function &fields() {
221 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
222 Civi::$statics[__CLASS__]['fields'] = [
223 'id' => [
224 'name' => 'id',
225 'type' => CRM_Utils_Type::T_INT,
226 'title' => ts('Survey ID'),
227 'description' => ts('Survey id.'),
228 'required' => TRUE,
229 'where' => 'civicrm_survey.id',
230 'table_name' => 'civicrm_survey',
231 'entity' => 'Survey',
232 'bao' => 'CRM_Campaign_BAO_Survey',
233 'localizable' => 0,
234 'add' => '3.3',
235 ],
236 'title' => [
237 'name' => 'title',
238 'type' => CRM_Utils_Type::T_STRING,
239 'title' => ts('Survey Title'),
240 'description' => ts('Title of the Survey.'),
241 'required' => TRUE,
242 'maxlength' => 255,
243 'size' => CRM_Utils_Type::HUGE,
244 'import' => TRUE,
245 'where' => 'civicrm_survey.title',
246 'export' => TRUE,
247 'table_name' => 'civicrm_survey',
248 'entity' => 'Survey',
249 'bao' => 'CRM_Campaign_BAO_Survey',
250 'localizable' => 1,
251 'add' => '3.3',
252 ],
253 'campaign_id' => [
254 'name' => 'campaign_id',
255 'type' => CRM_Utils_Type::T_INT,
256 'title' => ts('Survey Campaign ID'),
257 'description' => ts('Foreign key to the Campaign.'),
258 'where' => 'civicrm_survey.campaign_id',
259 'default' => 'NULL',
260 'table_name' => 'civicrm_survey',
261 'entity' => 'Survey',
262 'bao' => 'CRM_Campaign_BAO_Survey',
263 'localizable' => 0,
264 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
265 'pseudoconstant' => [
266 'table' => 'civicrm_campaign',
267 'keyColumn' => 'id',
268 'labelColumn' => 'title',
269 ],
270 'add' => '3.3',
271 ],
272 'activity_type_id' => [
273 'name' => 'activity_type_id',
274 'type' => CRM_Utils_Type::T_INT,
275 'title' => ts('Activity Type'),
276 'description' => ts('Implicit FK to civicrm_option_value where option_group = activity_type'),
277 'import' => TRUE,
278 'where' => 'civicrm_survey.activity_type_id',
279 'export' => TRUE,
280 'default' => 'NULL',
281 'table_name' => 'civicrm_survey',
282 'entity' => 'Survey',
283 'bao' => 'CRM_Campaign_BAO_Survey',
284 'localizable' => 0,
285 'html' => [
286 'type' => 'Select',
287 ],
288 'pseudoconstant' => [
289 'optionGroupName' => 'activity_type',
290 'optionEditPath' => 'civicrm/admin/options/activity_type',
291 ],
292 'add' => '3.3',
293 ],
294 'recontact_interval' => [
295 'name' => 'recontact_interval',
296 'type' => CRM_Utils_Type::T_TEXT,
297 'title' => ts('Follow up Interval'),
298 'description' => ts('Recontact intervals for each status.'),
299 'rows' => 20,
300 'cols' => 80,
301 'where' => 'civicrm_survey.recontact_interval',
302 'table_name' => 'civicrm_survey',
303 'entity' => 'Survey',
304 'bao' => 'CRM_Campaign_BAO_Survey',
305 'localizable' => 0,
306 'html' => [
307 'type' => 'TextArea',
308 ],
309 'add' => '3.3',
310 ],
311 'instructions' => [
312 'name' => 'instructions',
313 'type' => CRM_Utils_Type::T_TEXT,
314 'title' => ts('Instructions'),
315 'description' => ts('Script instructions for volunteers to use for the survey.'),
316 'rows' => 20,
317 'cols' => 80,
318 'where' => 'civicrm_survey.instructions',
319 'table_name' => 'civicrm_survey',
320 'entity' => 'Survey',
321 'bao' => 'CRM_Campaign_BAO_Survey',
322 'localizable' => 1,
323 'html' => [
324 'type' => 'TextArea',
325 ],
326 'add' => '3.3',
327 ],
328 'release_frequency' => [
329 'name' => 'release_frequency',
330 'type' => CRM_Utils_Type::T_INT,
331 'title' => ts('Survey Hold Duration'),
332 'description' => ts('Number of days for recurrence of release.'),
333 'where' => 'civicrm_survey.release_frequency',
334 'default' => 'NULL',
335 'table_name' => 'civicrm_survey',
336 'entity' => 'Survey',
337 'bao' => 'CRM_Campaign_BAO_Survey',
338 'localizable' => 0,
339 'add' => '3.3',
340 ],
341 'max_number_of_contacts' => [
342 'name' => 'max_number_of_contacts',
343 'type' => CRM_Utils_Type::T_INT,
344 'title' => ts('Maximum number of contacts'),
345 'description' => ts('Maximum number of contacts to allow for survey.'),
346 'where' => 'civicrm_survey.max_number_of_contacts',
347 'default' => 'NULL',
348 'table_name' => 'civicrm_survey',
349 'entity' => 'Survey',
350 'bao' => 'CRM_Campaign_BAO_Survey',
351 'localizable' => 0,
352 'add' => '3.3',
353 ],
354 'default_number_of_contacts' => [
355 'name' => 'default_number_of_contacts',
356 'type' => CRM_Utils_Type::T_INT,
357 'title' => ts('Default number of contacts'),
358 'description' => ts('Default number of contacts to allow for survey.'),
359 'where' => 'civicrm_survey.default_number_of_contacts',
360 'default' => 'NULL',
361 'table_name' => 'civicrm_survey',
362 'entity' => 'Survey',
363 'bao' => 'CRM_Campaign_BAO_Survey',
364 'localizable' => 0,
365 'add' => '3.3',
366 ],
367 'is_active' => [
368 'name' => 'is_active',
369 'type' => CRM_Utils_Type::T_BOOLEAN,
370 'title' => ts('Survey Is Active'),
371 'description' => ts('Is this survey enabled or disabled/cancelled?'),
372 'where' => 'civicrm_survey.is_active',
373 'default' => '1',
374 'table_name' => 'civicrm_survey',
375 'entity' => 'Survey',
376 'bao' => 'CRM_Campaign_BAO_Survey',
377 'localizable' => 0,
378 'add' => '3.3',
379 ],
380 'is_default' => [
381 'name' => 'is_default',
382 'type' => CRM_Utils_Type::T_BOOLEAN,
383 'title' => ts('Is Default Survey'),
384 'description' => ts('Is this default survey?'),
385 'where' => 'civicrm_survey.is_default',
386 'default' => '0',
387 'table_name' => 'civicrm_survey',
388 'entity' => 'Survey',
389 'bao' => 'CRM_Campaign_BAO_Survey',
390 'localizable' => 0,
391 'add' => '3.3',
392 ],
393 'created_id' => [
394 'name' => 'created_id',
395 'type' => CRM_Utils_Type::T_INT,
396 'title' => ts('Survey Created By'),
397 'description' => ts('FK to civicrm_contact, who created this Survey.'),
398 'where' => 'civicrm_survey.created_id',
399 'table_name' => 'civicrm_survey',
400 'entity' => 'Survey',
401 'bao' => 'CRM_Campaign_BAO_Survey',
402 'localizable' => 0,
403 'FKClassName' => 'CRM_Contact_DAO_Contact',
404 'add' => '3.3',
405 ],
406 'created_date' => [
407 'name' => 'created_date',
408 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
409 'title' => ts('Campaign Created Date'),
410 'description' => ts('Date and time that Survey was created.'),
411 'where' => 'civicrm_survey.created_date',
412 'table_name' => 'civicrm_survey',
413 'entity' => 'Survey',
414 'bao' => 'CRM_Campaign_BAO_Survey',
415 'localizable' => 0,
416 'add' => '3.3',
417 ],
418 'last_modified_id' => [
419 'name' => 'last_modified_id',
420 'type' => CRM_Utils_Type::T_INT,
421 'title' => ts('Survey Modified'),
422 'description' => ts('FK to civicrm_contact, who recently edited this Survey.'),
423 'where' => 'civicrm_survey.last_modified_id',
424 'table_name' => 'civicrm_survey',
425 'entity' => 'Survey',
426 'bao' => 'CRM_Campaign_BAO_Survey',
427 'localizable' => 0,
428 'FKClassName' => 'CRM_Contact_DAO_Contact',
429 'add' => '3.3',
430 ],
431 'last_modified_date' => [
432 'name' => 'last_modified_date',
433 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
434 'title' => ts('Survey Modified On'),
435 'description' => ts('Date and time that Survey was edited last time.'),
436 'where' => 'civicrm_survey.last_modified_date',
437 'table_name' => 'civicrm_survey',
438 'entity' => 'Survey',
439 'bao' => 'CRM_Campaign_BAO_Survey',
440 'localizable' => 0,
441 'add' => '3.3',
442 ],
443 'result_id' => [
444 'name' => 'result_id',
445 'type' => CRM_Utils_Type::T_INT,
446 'title' => ts('Survey Result'),
447 'description' => ts('Used to store option group id.'),
448 'where' => 'civicrm_survey.result_id',
449 'default' => 'NULL',
450 'table_name' => 'civicrm_survey',
451 'entity' => 'Survey',
452 'bao' => 'CRM_Campaign_BAO_Survey',
453 'localizable' => 0,
454 'add' => '3.3',
455 ],
456 'bypass_confirm' => [
457 'name' => 'bypass_confirm',
458 'type' => CRM_Utils_Type::T_BOOLEAN,
459 'title' => ts('No Email Verification'),
460 'description' => ts('Bypass the email verification.'),
461 'where' => 'civicrm_survey.bypass_confirm',
462 'default' => '0',
463 'table_name' => 'civicrm_survey',
464 'entity' => 'Survey',
465 'bao' => 'CRM_Campaign_BAO_Survey',
466 'localizable' => 0,
467 'add' => '4.2',
468 ],
469 'thankyou_title' => [
470 'name' => 'thankyou_title',
471 'type' => CRM_Utils_Type::T_STRING,
472 'title' => ts('Thank-you Title'),
473 'description' => ts('Title for Thank-you page (header title tag, and display at the top of the page).'),
474 'maxlength' => 255,
475 'size' => CRM_Utils_Type::HUGE,
476 'where' => 'civicrm_survey.thankyou_title',
477 'table_name' => 'civicrm_survey',
478 'entity' => 'Survey',
479 'bao' => 'CRM_Campaign_BAO_Survey',
480 'localizable' => 1,
481 'add' => '4.2',
482 ],
483 'thankyou_text' => [
484 'name' => 'thankyou_text',
485 'type' => CRM_Utils_Type::T_TEXT,
486 'title' => ts('Thank-you Text'),
487 'description' => ts('text and html allowed. displayed above result on success page'),
488 'rows' => 8,
489 'cols' => 60,
490 'where' => 'civicrm_survey.thankyou_text',
491 'table_name' => 'civicrm_survey',
492 'entity' => 'Survey',
493 'bao' => 'CRM_Campaign_BAO_Survey',
494 'localizable' => 1,
495 'html' => [
496 'type' => 'TextArea',
497 ],
498 'add' => '4.2',
499 ],
500 'is_share' => [
501 'name' => 'is_share',
502 'type' => CRM_Utils_Type::T_BOOLEAN,
503 'title' => ts('Is shared through social media'),
504 'description' => ts('Can people share the petition through social media?'),
505 'where' => 'civicrm_survey.is_share',
506 'default' => '1',
507 'table_name' => 'civicrm_survey',
508 'entity' => 'Survey',
509 'bao' => 'CRM_Campaign_BAO_Survey',
510 'localizable' => 0,
511 'add' => '4.4',
512 ],
513 ];
514 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
515 }
516 return Civi::$statics[__CLASS__]['fields'];
517 }
518
519 /**
520 * Return a mapping from field-name to the corresponding key (as used in fields()).
521 *
522 * @return array
523 * Array(string $name => string $uniqueName).
524 */
525 public static function &fieldKeys() {
526 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
527 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
528 }
529 return Civi::$statics[__CLASS__]['fieldKeys'];
530 }
531
532 /**
533 * Returns the names of this table
534 *
535 * @return string
536 */
537 public static function getTableName() {
538 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
539 }
540
541 /**
542 * Returns if this table needs to be logged
543 *
544 * @return bool
545 */
546 public function getLog() {
547 return self::$_log;
548 }
549
550 /**
551 * Returns the list of fields that can be imported
552 *
553 * @param bool $prefix
554 *
555 * @return array
556 */
557 public static function &import($prefix = FALSE) {
558 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'survey', $prefix, []);
559 return $r;
560 }
561
562 /**
563 * Returns the list of fields that can be exported
564 *
565 * @param bool $prefix
566 *
567 * @return array
568 */
569 public static function &export($prefix = FALSE) {
570 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'survey', $prefix, []);
571 return $r;
572 }
573
574 /**
575 * Returns the list of indices
576 *
577 * @param bool $localize
578 *
579 * @return array
580 */
581 public static function indices($localize = TRUE) {
582 $indices = [
583 'UI_activity_type_id' => [
584 'name' => 'UI_activity_type_id',
585 'field' => [
586 0 => 'activity_type_id',
587 ],
588 'localizable' => FALSE,
589 'sig' => 'civicrm_survey::0::activity_type_id',
590 ],
591 ];
592 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
593 }
594
595 }