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