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:80b92f90300f8e432ddd68e95d22b622)
13 * Database access object for the Survey entity.
15 class CRM_Campaign_DAO_Survey
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_survey';
25 * Icon associated with this entity.
29 public static $_icon = 'fa-clipboard';
32 * Should CiviCRM log any modifications to this table in the civicrm_log table.
36 public static $_log = FALSE;
46 * Title of the Survey.
53 * Foreign key to the Campaign.
60 * Implicit FK to civicrm_option_value where option_group = activity_type
64 public $activity_type_id;
67 * Recontact intervals for each status.
71 public $recontact_interval;
74 * Script instructions for volunteers to use for the survey.
81 * Number of days for recurrence of release.
85 public $release_frequency;
88 * Maximum number of contacts to allow for survey.
92 public $max_number_of_contacts;
95 * Default number of contacts to allow for survey.
99 public $default_number_of_contacts;
102 * Is this survey enabled or disabled/cancelled?
109 * Is this default survey?
116 * FK to civicrm_contact, who created this Survey.
123 * Date and time that Survey was created.
127 public $created_date;
130 * FK to civicrm_contact, who recently edited this Survey.
134 public $last_modified_id;
137 * Date and time that Survey was edited last time.
141 public $last_modified_date;
144 * Used to store option group id.
151 * Bypass the email verification.
155 public $bypass_confirm;
158 * Title for Thank-you page (header title tag, and display at the top of the page).
162 public $thankyou_title;
165 * text and html allowed. displayed above result on success page
169 public $thankyou_text;
172 * Can people share the petition through social media?
181 public function __construct() {
182 $this->__table
= 'civicrm_survey';
183 parent
::__construct();
187 * Returns localized title of this entity.
189 public static function getEntityTitle() {
190 return ts('Surveys');
194 * Returns foreign keys and entity references.
197 * [CRM_Core_Reference_Interface]
199 public static function getReferenceColumns() {
200 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
201 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
202 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
203 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
204 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'last_modified_id', 'civicrm_contact', 'id');
205 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
207 return Civi
::$statics[__CLASS__
]['links'];
211 * Returns all the column names of this table
215 public static function &fields() {
216 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
217 Civi
::$statics[__CLASS__
]['fields'] = [
220 'type' => CRM_Utils_Type
::T_INT
,
221 'title' => ts('Survey ID'),
222 'description' => ts('Survey id.'),
224 'where' => 'civicrm_survey.id',
225 'table_name' => 'civicrm_survey',
226 'entity' => 'Survey',
227 'bao' => 'CRM_Campaign_BAO_Survey',
233 'type' => CRM_Utils_Type
::T_STRING
,
234 'title' => ts('Survey Title'),
235 'description' => ts('Title of the Survey.'),
238 'size' => CRM_Utils_Type
::HUGE
,
240 'where' => 'civicrm_survey.title',
242 'table_name' => 'civicrm_survey',
243 'entity' => 'Survey',
244 'bao' => 'CRM_Campaign_BAO_Survey',
249 'name' => 'campaign_id',
250 'type' => CRM_Utils_Type
::T_INT
,
251 'title' => ts('Survey Campaign ID'),
252 'description' => ts('Foreign key to the Campaign.'),
253 'where' => 'civicrm_survey.campaign_id',
255 'table_name' => 'civicrm_survey',
256 'entity' => 'Survey',
257 'bao' => 'CRM_Campaign_BAO_Survey',
259 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
260 'pseudoconstant' => [
261 'table' => 'civicrm_campaign',
263 'labelColumn' => 'title',
267 'activity_type_id' => [
268 'name' => 'activity_type_id',
269 'type' => CRM_Utils_Type
::T_INT
,
270 'title' => ts('Activity Type'),
271 'description' => ts('Implicit FK to civicrm_option_value where option_group = activity_type'),
273 'where' => 'civicrm_survey.activity_type_id',
276 'table_name' => 'civicrm_survey',
277 'entity' => 'Survey',
278 'bao' => 'CRM_Campaign_BAO_Survey',
283 'pseudoconstant' => [
284 'optionGroupName' => 'activity_type',
285 'optionEditPath' => 'civicrm/admin/options/activity_type',
289 'recontact_interval' => [
290 'name' => 'recontact_interval',
291 'type' => CRM_Utils_Type
::T_TEXT
,
292 'title' => ts('Follow up Interval'),
293 'description' => ts('Recontact intervals for each status.'),
296 'where' => 'civicrm_survey.recontact_interval',
297 'table_name' => 'civicrm_survey',
298 'entity' => 'Survey',
299 'bao' => 'CRM_Campaign_BAO_Survey',
302 'type' => 'TextArea',
307 'name' => 'instructions',
308 'type' => CRM_Utils_Type
::T_TEXT
,
309 'title' => ts('Instructions'),
310 'description' => ts('Script instructions for volunteers to use for the survey.'),
313 'where' => 'civicrm_survey.instructions',
314 'table_name' => 'civicrm_survey',
315 'entity' => 'Survey',
316 'bao' => 'CRM_Campaign_BAO_Survey',
319 'type' => 'TextArea',
323 'release_frequency' => [
324 'name' => 'release_frequency',
325 'type' => CRM_Utils_Type
::T_INT
,
326 'title' => ts('Survey Hold Duration'),
327 'description' => ts('Number of days for recurrence of release.'),
328 'where' => 'civicrm_survey.release_frequency',
330 'table_name' => 'civicrm_survey',
331 'entity' => 'Survey',
332 'bao' => 'CRM_Campaign_BAO_Survey',
336 'max_number_of_contacts' => [
337 'name' => 'max_number_of_contacts',
338 'type' => CRM_Utils_Type
::T_INT
,
339 'title' => ts('Maximum number of contacts'),
340 'description' => ts('Maximum number of contacts to allow for survey.'),
341 'where' => 'civicrm_survey.max_number_of_contacts',
343 'table_name' => 'civicrm_survey',
344 'entity' => 'Survey',
345 'bao' => 'CRM_Campaign_BAO_Survey',
349 'default_number_of_contacts' => [
350 'name' => 'default_number_of_contacts',
351 'type' => CRM_Utils_Type
::T_INT
,
352 'title' => ts('Default number of contacts'),
353 'description' => ts('Default number of contacts to allow for survey.'),
354 'where' => 'civicrm_survey.default_number_of_contacts',
356 'table_name' => 'civicrm_survey',
357 'entity' => 'Survey',
358 'bao' => 'CRM_Campaign_BAO_Survey',
363 'name' => 'is_active',
364 'type' => CRM_Utils_Type
::T_BOOLEAN
,
365 'title' => ts('Survey Is Active'),
366 'description' => ts('Is this survey enabled or disabled/cancelled?'),
367 'where' => 'civicrm_survey.is_active',
369 'table_name' => 'civicrm_survey',
370 'entity' => 'Survey',
371 'bao' => 'CRM_Campaign_BAO_Survey',
376 'name' => 'is_default',
377 'type' => CRM_Utils_Type
::T_BOOLEAN
,
378 'title' => ts('Is Default Survey'),
379 'description' => ts('Is this default survey?'),
380 'where' => 'civicrm_survey.is_default',
382 'table_name' => 'civicrm_survey',
383 'entity' => 'Survey',
384 'bao' => 'CRM_Campaign_BAO_Survey',
389 'name' => 'created_id',
390 'type' => CRM_Utils_Type
::T_INT
,
391 'title' => ts('Survey Created By'),
392 'description' => ts('FK to civicrm_contact, who created this Survey.'),
393 'where' => 'civicrm_survey.created_id',
394 'table_name' => 'civicrm_survey',
395 'entity' => 'Survey',
396 'bao' => 'CRM_Campaign_BAO_Survey',
398 'FKClassName' => 'CRM_Contact_DAO_Contact',
402 'name' => 'created_date',
403 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
404 'title' => ts('Campaign Created Date'),
405 'description' => ts('Date and time that Survey was created.'),
406 'where' => 'civicrm_survey.created_date',
407 'table_name' => 'civicrm_survey',
408 'entity' => 'Survey',
409 'bao' => 'CRM_Campaign_BAO_Survey',
413 'last_modified_id' => [
414 'name' => 'last_modified_id',
415 'type' => CRM_Utils_Type
::T_INT
,
416 'title' => ts('Survey Modified'),
417 'description' => ts('FK to civicrm_contact, who recently edited this Survey.'),
418 'where' => 'civicrm_survey.last_modified_id',
419 'table_name' => 'civicrm_survey',
420 'entity' => 'Survey',
421 'bao' => 'CRM_Campaign_BAO_Survey',
423 'FKClassName' => 'CRM_Contact_DAO_Contact',
426 'last_modified_date' => [
427 'name' => 'last_modified_date',
428 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
429 'title' => ts('Survey Modified On'),
430 'description' => ts('Date and time that Survey was edited last time.'),
431 'where' => 'civicrm_survey.last_modified_date',
432 'table_name' => 'civicrm_survey',
433 'entity' => 'Survey',
434 'bao' => 'CRM_Campaign_BAO_Survey',
439 'name' => 'result_id',
440 'type' => CRM_Utils_Type
::T_INT
,
441 'title' => ts('Survey Result'),
442 'description' => ts('Used to store option group id.'),
443 'where' => 'civicrm_survey.result_id',
445 'table_name' => 'civicrm_survey',
446 'entity' => 'Survey',
447 'bao' => 'CRM_Campaign_BAO_Survey',
451 'bypass_confirm' => [
452 'name' => 'bypass_confirm',
453 'type' => CRM_Utils_Type
::T_BOOLEAN
,
454 'title' => ts('No Email Verification'),
455 'description' => ts('Bypass the email verification.'),
456 'where' => 'civicrm_survey.bypass_confirm',
458 'table_name' => 'civicrm_survey',
459 'entity' => 'Survey',
460 'bao' => 'CRM_Campaign_BAO_Survey',
464 'thankyou_title' => [
465 'name' => 'thankyou_title',
466 'type' => CRM_Utils_Type
::T_STRING
,
467 'title' => ts('Thank-you Title'),
468 'description' => ts('Title for Thank-you page (header title tag, and display at the top of the page).'),
470 'size' => CRM_Utils_Type
::HUGE
,
471 'where' => 'civicrm_survey.thankyou_title',
472 'table_name' => 'civicrm_survey',
473 'entity' => 'Survey',
474 'bao' => 'CRM_Campaign_BAO_Survey',
479 'name' => 'thankyou_text',
480 'type' => CRM_Utils_Type
::T_TEXT
,
481 'title' => ts('Thank-you Text'),
482 'description' => ts('text and html allowed. displayed above result on success page'),
485 'where' => 'civicrm_survey.thankyou_text',
486 'table_name' => 'civicrm_survey',
487 'entity' => 'Survey',
488 'bao' => 'CRM_Campaign_BAO_Survey',
491 'type' => 'TextArea',
496 'name' => 'is_share',
497 'type' => CRM_Utils_Type
::T_BOOLEAN
,
498 'title' => ts('Is shared through social media'),
499 'description' => ts('Can people share the petition through social media?'),
500 'where' => 'civicrm_survey.is_share',
502 'table_name' => 'civicrm_survey',
503 'entity' => 'Survey',
504 'bao' => 'CRM_Campaign_BAO_Survey',
509 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
511 return Civi
::$statics[__CLASS__
]['fields'];
515 * Return a mapping from field-name to the corresponding key (as used in fields()).
518 * Array(string $name => string $uniqueName).
520 public static function &fieldKeys() {
521 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
522 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
524 return Civi
::$statics[__CLASS__
]['fieldKeys'];
528 * Returns the names of this table
532 public static function getTableName() {
533 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
537 * Returns if this table needs to be logged
541 public function getLog() {
546 * Returns the list of fields that can be imported
548 * @param bool $prefix
552 public static function &import($prefix = FALSE) {
553 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'survey', $prefix, []);
558 * Returns the list of fields that can be exported
560 * @param bool $prefix
564 public static function &export($prefix = FALSE) {
565 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'survey', $prefix, []);
570 * Returns the list of indices
572 * @param bool $localize
576 public static function indices($localize = TRUE) {
578 'UI_activity_type_id' => [
579 'name' => 'UI_activity_type_id',
581 0 => 'activity_type_id',
583 'localizable' => FALSE,
584 'sig' => 'civicrm_survey::0::activity_type_id',
587 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;