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:2c73452082011f01b04978515f1bde2a)
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',
249 'type' => CRM_Utils_Type
::T_STRING
,
250 'title' => ts('Survey Title'),
251 'description' => ts('Title of the Survey.'),
254 'size' => CRM_Utils_Type
::HUGE
,
256 'where' => 'civicrm_survey.title',
258 'table_name' => 'civicrm_survey',
259 'entity' => 'Survey',
260 'bao' => 'CRM_Campaign_BAO_Survey',
265 'name' => 'campaign_id',
266 'type' => CRM_Utils_Type
::T_INT
,
267 'title' => ts('Campaign ID'),
268 'description' => ts('Foreign key to the Campaign.'),
269 'where' => 'civicrm_survey.campaign_id',
271 'table_name' => 'civicrm_survey',
272 'entity' => 'Survey',
273 'bao' => 'CRM_Campaign_BAO_Survey',
275 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
277 'label' => ts("Campaign"),
281 'activity_type_id' => [
282 'name' => 'activity_type_id',
283 'type' => CRM_Utils_Type
::T_INT
,
284 'title' => ts('Activity Type'),
285 'description' => ts('Implicit FK to civicrm_option_value where option_group = activity_type'),
287 'where' => 'civicrm_survey.activity_type_id',
290 'table_name' => 'civicrm_survey',
291 'entity' => 'Survey',
292 'bao' => 'CRM_Campaign_BAO_Survey',
297 'pseudoconstant' => [
298 'optionGroupName' => 'activity_type',
299 'optionEditPath' => 'civicrm/admin/options/activity_type',
303 'recontact_interval' => [
304 'name' => 'recontact_interval',
305 'type' => CRM_Utils_Type
::T_TEXT
,
306 'title' => ts('Follow up Interval'),
307 'description' => ts('Recontact intervals for each status.'),
310 'where' => 'civicrm_survey.recontact_interval',
311 'table_name' => 'civicrm_survey',
312 'entity' => 'Survey',
313 'bao' => 'CRM_Campaign_BAO_Survey',
316 'type' => 'TextArea',
321 'name' => 'instructions',
322 'type' => CRM_Utils_Type
::T_TEXT
,
323 'title' => ts('Instructions'),
324 'description' => ts('Script instructions for volunteers to use for the survey.'),
327 'where' => 'civicrm_survey.instructions',
328 'table_name' => 'civicrm_survey',
329 'entity' => 'Survey',
330 'bao' => 'CRM_Campaign_BAO_Survey',
333 'type' => 'TextArea',
337 'release_frequency' => [
338 'name' => 'release_frequency',
339 'type' => CRM_Utils_Type
::T_INT
,
340 'title' => ts('Survey Hold Duration'),
341 'description' => ts('Number of days for recurrence of release.'),
342 'where' => 'civicrm_survey.release_frequency',
344 'table_name' => 'civicrm_survey',
345 'entity' => 'Survey',
346 'bao' => 'CRM_Campaign_BAO_Survey',
350 'max_number_of_contacts' => [
351 'name' => 'max_number_of_contacts',
352 'type' => CRM_Utils_Type
::T_INT
,
353 'title' => ts('Maximum number of contacts'),
354 'description' => ts('Maximum number of contacts to allow for survey.'),
355 'where' => 'civicrm_survey.max_number_of_contacts',
357 'table_name' => 'civicrm_survey',
358 'entity' => 'Survey',
359 'bao' => 'CRM_Campaign_BAO_Survey',
363 'default_number_of_contacts' => [
364 'name' => 'default_number_of_contacts',
365 'type' => CRM_Utils_Type
::T_INT
,
366 'title' => ts('Default number of contacts'),
367 'description' => ts('Default number of contacts to allow for survey.'),
368 'where' => 'civicrm_survey.default_number_of_contacts',
370 'table_name' => 'civicrm_survey',
371 'entity' => 'Survey',
372 'bao' => 'CRM_Campaign_BAO_Survey',
377 'name' => 'is_active',
378 'type' => CRM_Utils_Type
::T_BOOLEAN
,
379 'title' => ts('Survey Is Active'),
380 'description' => ts('Is this survey enabled or disabled/cancelled?'),
381 'where' => 'civicrm_survey.is_active',
383 'table_name' => 'civicrm_survey',
384 'entity' => 'Survey',
385 'bao' => 'CRM_Campaign_BAO_Survey',
390 'name' => 'is_default',
391 'type' => CRM_Utils_Type
::T_BOOLEAN
,
392 'title' => ts('Is Default Survey'),
393 'description' => ts('Is this default survey?'),
394 'where' => 'civicrm_survey.is_default',
396 'table_name' => 'civicrm_survey',
397 'entity' => 'Survey',
398 'bao' => 'CRM_Campaign_BAO_Survey',
403 'name' => 'created_id',
404 'type' => CRM_Utils_Type
::T_INT
,
405 'title' => ts('Created By Contact ID'),
406 'description' => ts('FK to civicrm_contact, who created this Survey.'),
407 'where' => 'civicrm_survey.created_id',
408 'table_name' => 'civicrm_survey',
409 'entity' => 'Survey',
410 'bao' => 'CRM_Campaign_BAO_Survey',
412 'FKClassName' => 'CRM_Contact_DAO_Contact',
414 'label' => ts("Created By"),
419 'name' => 'created_date',
420 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
421 'title' => ts('Campaign Created Date'),
422 'description' => ts('Date and time that Survey was created.'),
423 'where' => 'civicrm_survey.created_date',
424 'table_name' => 'civicrm_survey',
425 'entity' => 'Survey',
426 'bao' => 'CRM_Campaign_BAO_Survey',
430 'last_modified_id' => [
431 'name' => 'last_modified_id',
432 'type' => CRM_Utils_Type
::T_INT
,
433 'title' => ts('Modified By Contact ID'),
434 'description' => ts('FK to civicrm_contact, who recently edited this Survey.'),
435 'where' => 'civicrm_survey.last_modified_id',
436 'table_name' => 'civicrm_survey',
437 'entity' => 'Survey',
438 'bao' => 'CRM_Campaign_BAO_Survey',
440 'FKClassName' => 'CRM_Contact_DAO_Contact',
442 'label' => ts("Modified By"),
446 'last_modified_date' => [
447 'name' => 'last_modified_date',
448 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
449 'title' => ts('Survey Modified On'),
450 'description' => ts('Date and time that Survey was edited last time.'),
451 'where' => 'civicrm_survey.last_modified_date',
452 'table_name' => 'civicrm_survey',
453 'entity' => 'Survey',
454 'bao' => 'CRM_Campaign_BAO_Survey',
459 'name' => 'result_id',
460 'type' => CRM_Utils_Type
::T_INT
,
461 'title' => ts('Survey Result'),
462 'description' => ts('Used to store option group id.'),
463 'where' => 'civicrm_survey.result_id',
465 'table_name' => 'civicrm_survey',
466 'entity' => 'Survey',
467 'bao' => 'CRM_Campaign_BAO_Survey',
471 'bypass_confirm' => [
472 'name' => 'bypass_confirm',
473 'type' => CRM_Utils_Type
::T_BOOLEAN
,
474 'title' => ts('No Email Verification'),
475 'description' => ts('Bypass the email verification.'),
476 'where' => 'civicrm_survey.bypass_confirm',
478 'table_name' => 'civicrm_survey',
479 'entity' => 'Survey',
480 'bao' => 'CRM_Campaign_BAO_Survey',
484 'thankyou_title' => [
485 'name' => 'thankyou_title',
486 'type' => CRM_Utils_Type
::T_STRING
,
487 'title' => ts('Thank-you Title'),
488 'description' => ts('Title for Thank-you page (header title tag, and display at the top of the page).'),
490 'size' => CRM_Utils_Type
::HUGE
,
491 'where' => 'civicrm_survey.thankyou_title',
492 'table_name' => 'civicrm_survey',
493 'entity' => 'Survey',
494 'bao' => 'CRM_Campaign_BAO_Survey',
499 'name' => 'thankyou_text',
500 'type' => CRM_Utils_Type
::T_TEXT
,
501 'title' => ts('Thank-you Text'),
502 'description' => ts('text and html allowed. displayed above result on success page'),
505 'where' => 'civicrm_survey.thankyou_text',
506 'table_name' => 'civicrm_survey',
507 'entity' => 'Survey',
508 'bao' => 'CRM_Campaign_BAO_Survey',
511 'type' => 'TextArea',
516 'name' => 'is_share',
517 'type' => CRM_Utils_Type
::T_BOOLEAN
,
518 'title' => ts('Is shared through social media'),
519 'description' => ts('Can people share the petition through social media?'),
520 'where' => 'civicrm_survey.is_share',
522 'table_name' => 'civicrm_survey',
523 'entity' => 'Survey',
524 'bao' => 'CRM_Campaign_BAO_Survey',
529 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
531 return Civi
::$statics[__CLASS__
]['fields'];
535 * Return a mapping from field-name to the corresponding key (as used in fields()).
538 * Array(string $name => string $uniqueName).
540 public static function &fieldKeys() {
541 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
542 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
544 return Civi
::$statics[__CLASS__
]['fieldKeys'];
548 * Returns the names of this table
552 public static function getTableName() {
553 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
557 * Returns if this table needs to be logged
561 public function getLog() {
566 * Returns the list of fields that can be imported
568 * @param bool $prefix
572 public static function &import($prefix = FALSE) {
573 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'survey', $prefix, []);
578 * Returns the list of fields that can be exported
580 * @param bool $prefix
584 public static function &export($prefix = FALSE) {
585 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'survey', $prefix, []);
590 * Returns the list of indices
592 * @param bool $localize
596 public static function indices($localize = TRUE) {
598 'UI_activity_type_id' => [
599 'name' => 'UI_activity_type_id',
601 0 => 'activity_type_id',
603 'localizable' => FALSE,
604 'sig' => 'civicrm_survey::0::activity_type_id',
607 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;