5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Campaign/Survey.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:1c74399d67561c75f39d8db59b04737d)
13 * Database access object for the Survey entity.
15 class CRM_Campaign_DAO_Survey
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '3.2';
18 const COMPONENT
= 'CiviCampaign';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_survey';
28 * Icon associated with this entity.
32 public static $_icon = 'fa-clipboard';
35 * Field to show when displaying a record.
39 public static $_labelField = 'title';
42 * Should CiviCRM log any modifications to this table in the civicrm_log table.
46 public static $_log = FALSE;
56 * Title of the Survey.
63 * Foreign key to the Campaign.
70 * Implicit FK to civicrm_option_value where option_group = activity_type
74 public $activity_type_id;
77 * Recontact intervals for each status.
81 public $recontact_interval;
84 * Script instructions for volunteers to use for the survey.
91 * Number of days for recurrence of release.
95 public $release_frequency;
98 * Maximum number of contacts to allow for survey.
102 public $max_number_of_contacts;
105 * Default number of contacts to allow for survey.
109 public $default_number_of_contacts;
112 * Is this survey enabled or disabled/cancelled?
119 * Is this default survey?
126 * FK to civicrm_contact, who created this Survey.
133 * Date and time that Survey was created.
137 public $created_date;
140 * FK to civicrm_contact, who recently edited this Survey.
144 public $last_modified_id;
147 * Date and time that Survey was edited last time.
151 public $last_modified_date;
154 * Used to store option group id.
161 * Bypass the email verification.
165 public $bypass_confirm;
168 * Title for Thank-you page (header title tag, and display at the top of the page).
172 public $thankyou_title;
175 * text and html allowed. displayed above result on success page
179 public $thankyou_text;
182 * Can people share the petition through social media?
191 public function __construct() {
192 $this->__table
= 'civicrm_survey';
193 parent
::__construct();
197 * Returns localized title of this entity.
199 * @param bool $plural
200 * Whether to return the plural version of the title.
202 public static function getEntityTitle($plural = FALSE) {
203 return $plural ?
ts('Surveys') : ts('Survey');
207 * Returns foreign keys and entity references.
210 * [CRM_Core_Reference_Interface]
212 public static function getReferenceColumns() {
213 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
214 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
215 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
216 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
217 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'last_modified_id', 'civicrm_contact', 'id');
218 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
220 return Civi
::$statics[__CLASS__
]['links'];
224 * Returns all the column names of this table
228 public static function &fields() {
229 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
230 Civi
::$statics[__CLASS__
]['fields'] = [
233 'type' => CRM_Utils_Type
::T_INT
,
234 'title' => ts('Survey ID'),
235 'description' => ts('Survey id.'),
237 'where' => 'civicrm_survey.id',
238 'table_name' => 'civicrm_survey',
239 'entity' => 'Survey',
240 'bao' => 'CRM_Campaign_BAO_Survey',
250 'type' => CRM_Utils_Type
::T_STRING
,
251 'title' => ts('Survey Title'),
252 'description' => ts('Title of the Survey.'),
255 'size' => CRM_Utils_Type
::HUGE
,
257 'where' => 'civicrm_survey.title',
259 'table_name' => 'civicrm_survey',
260 'entity' => 'Survey',
261 'bao' => 'CRM_Campaign_BAO_Survey',
266 'name' => 'campaign_id',
267 'type' => CRM_Utils_Type
::T_INT
,
268 'title' => ts('Campaign ID'),
269 'description' => ts('Foreign key to the Campaign.'),
270 'where' => 'civicrm_survey.campaign_id',
272 'table_name' => 'civicrm_survey',
273 'entity' => 'Survey',
274 'bao' => 'CRM_Campaign_BAO_Survey',
276 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
278 'label' => ts("Campaign"),
282 'activity_type_id' => [
283 'name' => 'activity_type_id',
284 'type' => CRM_Utils_Type
::T_INT
,
285 'title' => ts('Activity Type'),
286 'description' => ts('Implicit FK to civicrm_option_value where option_group = activity_type'),
288 'where' => 'civicrm_survey.activity_type_id',
291 'table_name' => 'civicrm_survey',
292 'entity' => 'Survey',
293 'bao' => 'CRM_Campaign_BAO_Survey',
298 'pseudoconstant' => [
299 'optionGroupName' => 'activity_type',
300 'optionEditPath' => 'civicrm/admin/options/activity_type',
304 'recontact_interval' => [
305 'name' => 'recontact_interval',
306 'type' => CRM_Utils_Type
::T_TEXT
,
307 'title' => ts('Follow up Interval'),
308 'description' => ts('Recontact intervals for each status.'),
311 'where' => 'civicrm_survey.recontact_interval',
312 'table_name' => 'civicrm_survey',
313 'entity' => 'Survey',
314 'bao' => 'CRM_Campaign_BAO_Survey',
317 'type' => 'TextArea',
322 'name' => 'instructions',
323 'type' => CRM_Utils_Type
::T_TEXT
,
324 'title' => ts('Instructions'),
325 'description' => ts('Script instructions for volunteers to use for the survey.'),
328 'where' => 'civicrm_survey.instructions',
329 'table_name' => 'civicrm_survey',
330 'entity' => 'Survey',
331 'bao' => 'CRM_Campaign_BAO_Survey',
334 'type' => 'TextArea',
338 'release_frequency' => [
339 'name' => 'release_frequency',
340 'type' => CRM_Utils_Type
::T_INT
,
341 'title' => ts('Survey Hold Duration'),
342 'description' => ts('Number of days for recurrence of release.'),
343 'where' => 'civicrm_survey.release_frequency',
345 'table_name' => 'civicrm_survey',
346 'entity' => 'Survey',
347 'bao' => 'CRM_Campaign_BAO_Survey',
351 'max_number_of_contacts' => [
352 'name' => 'max_number_of_contacts',
353 'type' => CRM_Utils_Type
::T_INT
,
354 'title' => ts('Maximum number of contacts'),
355 'description' => ts('Maximum number of contacts to allow for survey.'),
356 'where' => 'civicrm_survey.max_number_of_contacts',
358 'table_name' => 'civicrm_survey',
359 'entity' => 'Survey',
360 'bao' => 'CRM_Campaign_BAO_Survey',
364 'default_number_of_contacts' => [
365 'name' => 'default_number_of_contacts',
366 'type' => CRM_Utils_Type
::T_INT
,
367 'title' => ts('Default number of contacts'),
368 'description' => ts('Default number of contacts to allow for survey.'),
369 'where' => 'civicrm_survey.default_number_of_contacts',
371 'table_name' => 'civicrm_survey',
372 'entity' => 'Survey',
373 'bao' => 'CRM_Campaign_BAO_Survey',
378 'name' => 'is_active',
379 'type' => CRM_Utils_Type
::T_BOOLEAN
,
380 'title' => ts('Survey Is Active'),
381 'description' => ts('Is this survey enabled or disabled/cancelled?'),
382 'where' => 'civicrm_survey.is_active',
384 'table_name' => 'civicrm_survey',
385 'entity' => 'Survey',
386 'bao' => 'CRM_Campaign_BAO_Survey',
391 'name' => 'is_default',
392 'type' => CRM_Utils_Type
::T_BOOLEAN
,
393 'title' => ts('Is Default Survey'),
394 'description' => ts('Is this default survey?'),
395 'where' => 'civicrm_survey.is_default',
397 'table_name' => 'civicrm_survey',
398 'entity' => 'Survey',
399 'bao' => 'CRM_Campaign_BAO_Survey',
404 'name' => 'created_id',
405 'type' => CRM_Utils_Type
::T_INT
,
406 'title' => ts('Created By Contact ID'),
407 'description' => ts('FK to civicrm_contact, who created this Survey.'),
408 'where' => 'civicrm_survey.created_id',
409 'table_name' => 'civicrm_survey',
410 'entity' => 'Survey',
411 'bao' => 'CRM_Campaign_BAO_Survey',
413 'FKClassName' => 'CRM_Contact_DAO_Contact',
415 'label' => ts("Created By"),
420 'name' => 'created_date',
421 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
422 'title' => ts('Campaign Created Date'),
423 'description' => ts('Date and time that Survey was created.'),
424 'where' => 'civicrm_survey.created_date',
425 'table_name' => 'civicrm_survey',
426 'entity' => 'Survey',
427 'bao' => 'CRM_Campaign_BAO_Survey',
431 'last_modified_id' => [
432 'name' => 'last_modified_id',
433 'type' => CRM_Utils_Type
::T_INT
,
434 'title' => ts('Modified By Contact ID'),
435 'description' => ts('FK to civicrm_contact, who recently edited this Survey.'),
436 'where' => 'civicrm_survey.last_modified_id',
437 'table_name' => 'civicrm_survey',
438 'entity' => 'Survey',
439 'bao' => 'CRM_Campaign_BAO_Survey',
441 'FKClassName' => 'CRM_Contact_DAO_Contact',
443 'label' => ts("Modified By"),
447 'last_modified_date' => [
448 'name' => 'last_modified_date',
449 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
450 'title' => ts('Survey Modified On'),
451 'description' => ts('Date and time that Survey was edited last time.'),
452 'where' => 'civicrm_survey.last_modified_date',
453 'table_name' => 'civicrm_survey',
454 'entity' => 'Survey',
455 'bao' => 'CRM_Campaign_BAO_Survey',
460 'name' => 'result_id',
461 'type' => CRM_Utils_Type
::T_INT
,
462 'title' => ts('Survey Result'),
463 'description' => ts('Used to store option group id.'),
464 'where' => 'civicrm_survey.result_id',
466 'table_name' => 'civicrm_survey',
467 'entity' => 'Survey',
468 'bao' => 'CRM_Campaign_BAO_Survey',
472 'bypass_confirm' => [
473 'name' => 'bypass_confirm',
474 'type' => CRM_Utils_Type
::T_BOOLEAN
,
475 'title' => ts('No Email Verification'),
476 'description' => ts('Bypass the email verification.'),
477 'where' => 'civicrm_survey.bypass_confirm',
479 'table_name' => 'civicrm_survey',
480 'entity' => 'Survey',
481 'bao' => 'CRM_Campaign_BAO_Survey',
485 'thankyou_title' => [
486 'name' => 'thankyou_title',
487 'type' => CRM_Utils_Type
::T_STRING
,
488 'title' => ts('Thank-you Title'),
489 'description' => ts('Title for Thank-you page (header title tag, and display at the top of the page).'),
491 'size' => CRM_Utils_Type
::HUGE
,
492 'where' => 'civicrm_survey.thankyou_title',
493 'table_name' => 'civicrm_survey',
494 'entity' => 'Survey',
495 'bao' => 'CRM_Campaign_BAO_Survey',
500 'name' => 'thankyou_text',
501 'type' => CRM_Utils_Type
::T_TEXT
,
502 'title' => ts('Thank-you Text'),
503 'description' => ts('text and html allowed. displayed above result on success page'),
506 'where' => 'civicrm_survey.thankyou_text',
507 'table_name' => 'civicrm_survey',
508 'entity' => 'Survey',
509 'bao' => 'CRM_Campaign_BAO_Survey',
512 'type' => 'TextArea',
517 'name' => 'is_share',
518 'type' => CRM_Utils_Type
::T_BOOLEAN
,
519 'title' => ts('Is shared through social media'),
520 'description' => ts('Can people share the petition through social media?'),
521 'where' => 'civicrm_survey.is_share',
523 'table_name' => 'civicrm_survey',
524 'entity' => 'Survey',
525 'bao' => 'CRM_Campaign_BAO_Survey',
530 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
532 return Civi
::$statics[__CLASS__
]['fields'];
536 * Return a mapping from field-name to the corresponding key (as used in fields()).
539 * Array(string $name => string $uniqueName).
541 public static function &fieldKeys() {
542 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
543 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
545 return Civi
::$statics[__CLASS__
]['fieldKeys'];
549 * Returns the names of this table
553 public static function getTableName() {
554 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
558 * Returns if this table needs to be logged
562 public function getLog() {
567 * Returns the list of fields that can be imported
569 * @param bool $prefix
573 public static function &import($prefix = FALSE) {
574 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'survey', $prefix, []);
579 * Returns the list of fields that can be exported
581 * @param bool $prefix
585 public static function &export($prefix = FALSE) {
586 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'survey', $prefix, []);
591 * Returns the list of indices
593 * @param bool $localize
597 public static function indices($localize = TRUE) {
599 'UI_activity_type_id' => [
600 'name' => 'UI_activity_type_id',
602 0 => 'activity_type_id',
604 'localizable' => FALSE,
605 'sig' => 'civicrm_survey::0::activity_type_id',
608 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;