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:e955546c8081852591bc08b1fdee4213)
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';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_survey';
27 * Icon associated with this entity.
31 public static $_icon = 'fa-clipboard';
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
38 public static $_log = FALSE;
48 * Title of the Survey.
55 * Foreign key to the Campaign.
62 * Implicit FK to civicrm_option_value where option_group = activity_type
66 public $activity_type_id;
69 * Recontact intervals for each status.
73 public $recontact_interval;
76 * Script instructions for volunteers to use for the survey.
83 * Number of days for recurrence of release.
87 public $release_frequency;
90 * Maximum number of contacts to allow for survey.
94 public $max_number_of_contacts;
97 * Default number of contacts to allow for survey.
101 public $default_number_of_contacts;
104 * Is this survey enabled or disabled/cancelled?
111 * Is this default survey?
118 * FK to civicrm_contact, who created this Survey.
125 * Date and time that Survey was created.
129 public $created_date;
132 * FK to civicrm_contact, who recently edited this Survey.
136 public $last_modified_id;
139 * Date and time that Survey was edited last time.
143 public $last_modified_date;
146 * Used to store option group id.
153 * Bypass the email verification.
157 public $bypass_confirm;
160 * Title for Thank-you page (header title tag, and display at the top of the page).
164 public $thankyou_title;
167 * text and html allowed. displayed above result on success page
171 public $thankyou_text;
174 * Can people share the petition through social media?
183 public function __construct() {
184 $this->__table
= 'civicrm_survey';
185 parent
::__construct();
189 * Returns localized title of this entity.
191 public static function getEntityTitle() {
192 return ts('Surveys');
196 * Returns foreign keys and entity references.
199 * [CRM_Core_Reference_Interface]
201 public static function getReferenceColumns() {
202 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
203 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
204 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
205 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
206 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'last_modified_id', 'civicrm_contact', 'id');
207 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
209 return Civi
::$statics[__CLASS__
]['links'];
213 * Returns all the column names of this table
217 public static function &fields() {
218 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
219 Civi
::$statics[__CLASS__
]['fields'] = [
222 'type' => CRM_Utils_Type
::T_INT
,
223 'title' => ts('Survey ID'),
224 'description' => ts('Survey id.'),
226 'where' => 'civicrm_survey.id',
227 'table_name' => 'civicrm_survey',
228 'entity' => 'Survey',
229 'bao' => 'CRM_Campaign_BAO_Survey',
235 'type' => CRM_Utils_Type
::T_STRING
,
236 'title' => ts('Survey Title'),
237 'description' => ts('Title of the Survey.'),
240 'size' => CRM_Utils_Type
::HUGE
,
242 'where' => 'civicrm_survey.title',
244 'table_name' => 'civicrm_survey',
245 'entity' => 'Survey',
246 'bao' => 'CRM_Campaign_BAO_Survey',
251 'name' => 'campaign_id',
252 'type' => CRM_Utils_Type
::T_INT
,
253 'title' => ts('Survey Campaign ID'),
254 'description' => ts('Foreign key to the Campaign.'),
255 'where' => 'civicrm_survey.campaign_id',
257 'table_name' => 'civicrm_survey',
258 'entity' => 'Survey',
259 'bao' => 'CRM_Campaign_BAO_Survey',
261 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
262 'pseudoconstant' => [
263 'table' => 'civicrm_campaign',
265 'labelColumn' => 'title',
269 'activity_type_id' => [
270 'name' => 'activity_type_id',
271 'type' => CRM_Utils_Type
::T_INT
,
272 'title' => ts('Activity Type'),
273 'description' => ts('Implicit FK to civicrm_option_value where option_group = activity_type'),
275 'where' => 'civicrm_survey.activity_type_id',
278 'table_name' => 'civicrm_survey',
279 'entity' => 'Survey',
280 'bao' => 'CRM_Campaign_BAO_Survey',
285 'pseudoconstant' => [
286 'optionGroupName' => 'activity_type',
287 'optionEditPath' => 'civicrm/admin/options/activity_type',
291 'recontact_interval' => [
292 'name' => 'recontact_interval',
293 'type' => CRM_Utils_Type
::T_TEXT
,
294 'title' => ts('Follow up Interval'),
295 'description' => ts('Recontact intervals for each status.'),
298 'where' => 'civicrm_survey.recontact_interval',
299 'table_name' => 'civicrm_survey',
300 'entity' => 'Survey',
301 'bao' => 'CRM_Campaign_BAO_Survey',
304 'type' => 'TextArea',
309 'name' => 'instructions',
310 'type' => CRM_Utils_Type
::T_TEXT
,
311 'title' => ts('Instructions'),
312 'description' => ts('Script instructions for volunteers to use for the survey.'),
315 'where' => 'civicrm_survey.instructions',
316 'table_name' => 'civicrm_survey',
317 'entity' => 'Survey',
318 'bao' => 'CRM_Campaign_BAO_Survey',
321 'type' => 'TextArea',
325 'release_frequency' => [
326 'name' => 'release_frequency',
327 'type' => CRM_Utils_Type
::T_INT
,
328 'title' => ts('Survey Hold Duration'),
329 'description' => ts('Number of days for recurrence of release.'),
330 'where' => 'civicrm_survey.release_frequency',
332 'table_name' => 'civicrm_survey',
333 'entity' => 'Survey',
334 'bao' => 'CRM_Campaign_BAO_Survey',
338 'max_number_of_contacts' => [
339 'name' => 'max_number_of_contacts',
340 'type' => CRM_Utils_Type
::T_INT
,
341 'title' => ts('Maximum number of contacts'),
342 'description' => ts('Maximum number of contacts to allow for survey.'),
343 'where' => 'civicrm_survey.max_number_of_contacts',
345 'table_name' => 'civicrm_survey',
346 'entity' => 'Survey',
347 'bao' => 'CRM_Campaign_BAO_Survey',
351 'default_number_of_contacts' => [
352 'name' => 'default_number_of_contacts',
353 'type' => CRM_Utils_Type
::T_INT
,
354 'title' => ts('Default number of contacts'),
355 'description' => ts('Default number of contacts to allow for survey.'),
356 'where' => 'civicrm_survey.default_number_of_contacts',
358 'table_name' => 'civicrm_survey',
359 'entity' => 'Survey',
360 'bao' => 'CRM_Campaign_BAO_Survey',
365 'name' => 'is_active',
366 'type' => CRM_Utils_Type
::T_BOOLEAN
,
367 'title' => ts('Survey Is Active'),
368 'description' => ts('Is this survey enabled or disabled/cancelled?'),
369 'where' => 'civicrm_survey.is_active',
371 'table_name' => 'civicrm_survey',
372 'entity' => 'Survey',
373 'bao' => 'CRM_Campaign_BAO_Survey',
378 'name' => 'is_default',
379 'type' => CRM_Utils_Type
::T_BOOLEAN
,
380 'title' => ts('Is Default Survey'),
381 'description' => ts('Is this default survey?'),
382 'where' => 'civicrm_survey.is_default',
384 'table_name' => 'civicrm_survey',
385 'entity' => 'Survey',
386 'bao' => 'CRM_Campaign_BAO_Survey',
391 'name' => 'created_id',
392 'type' => CRM_Utils_Type
::T_INT
,
393 'title' => ts('Survey Created By'),
394 'description' => ts('FK to civicrm_contact, who created this Survey.'),
395 'where' => 'civicrm_survey.created_id',
396 'table_name' => 'civicrm_survey',
397 'entity' => 'Survey',
398 'bao' => 'CRM_Campaign_BAO_Survey',
400 'FKClassName' => 'CRM_Contact_DAO_Contact',
404 'name' => 'created_date',
405 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
406 'title' => ts('Campaign Created Date'),
407 'description' => ts('Date and time that Survey was created.'),
408 'where' => 'civicrm_survey.created_date',
409 'table_name' => 'civicrm_survey',
410 'entity' => 'Survey',
411 'bao' => 'CRM_Campaign_BAO_Survey',
415 'last_modified_id' => [
416 'name' => 'last_modified_id',
417 'type' => CRM_Utils_Type
::T_INT
,
418 'title' => ts('Survey Modified'),
419 'description' => ts('FK to civicrm_contact, who recently edited this Survey.'),
420 'where' => 'civicrm_survey.last_modified_id',
421 'table_name' => 'civicrm_survey',
422 'entity' => 'Survey',
423 'bao' => 'CRM_Campaign_BAO_Survey',
425 'FKClassName' => 'CRM_Contact_DAO_Contact',
428 'last_modified_date' => [
429 'name' => 'last_modified_date',
430 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
431 'title' => ts('Survey Modified On'),
432 'description' => ts('Date and time that Survey was edited last time.'),
433 'where' => 'civicrm_survey.last_modified_date',
434 'table_name' => 'civicrm_survey',
435 'entity' => 'Survey',
436 'bao' => 'CRM_Campaign_BAO_Survey',
441 'name' => 'result_id',
442 'type' => CRM_Utils_Type
::T_INT
,
443 'title' => ts('Survey Result'),
444 'description' => ts('Used to store option group id.'),
445 'where' => 'civicrm_survey.result_id',
447 'table_name' => 'civicrm_survey',
448 'entity' => 'Survey',
449 'bao' => 'CRM_Campaign_BAO_Survey',
453 'bypass_confirm' => [
454 'name' => 'bypass_confirm',
455 'type' => CRM_Utils_Type
::T_BOOLEAN
,
456 'title' => ts('No Email Verification'),
457 'description' => ts('Bypass the email verification.'),
458 'where' => 'civicrm_survey.bypass_confirm',
460 'table_name' => 'civicrm_survey',
461 'entity' => 'Survey',
462 'bao' => 'CRM_Campaign_BAO_Survey',
466 'thankyou_title' => [
467 'name' => 'thankyou_title',
468 'type' => CRM_Utils_Type
::T_STRING
,
469 'title' => ts('Thank-you Title'),
470 'description' => ts('Title for Thank-you page (header title tag, and display at the top of the page).'),
472 'size' => CRM_Utils_Type
::HUGE
,
473 'where' => 'civicrm_survey.thankyou_title',
474 'table_name' => 'civicrm_survey',
475 'entity' => 'Survey',
476 'bao' => 'CRM_Campaign_BAO_Survey',
481 'name' => 'thankyou_text',
482 'type' => CRM_Utils_Type
::T_TEXT
,
483 'title' => ts('Thank-you Text'),
484 'description' => ts('text and html allowed. displayed above result on success page'),
487 'where' => 'civicrm_survey.thankyou_text',
488 'table_name' => 'civicrm_survey',
489 'entity' => 'Survey',
490 'bao' => 'CRM_Campaign_BAO_Survey',
493 'type' => 'TextArea',
498 'name' => 'is_share',
499 'type' => CRM_Utils_Type
::T_BOOLEAN
,
500 'title' => ts('Is shared through social media'),
501 'description' => ts('Can people share the petition through social media?'),
502 'where' => 'civicrm_survey.is_share',
504 'table_name' => 'civicrm_survey',
505 'entity' => 'Survey',
506 'bao' => 'CRM_Campaign_BAO_Survey',
511 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
513 return Civi
::$statics[__CLASS__
]['fields'];
517 * Return a mapping from field-name to the corresponding key (as used in fields()).
520 * Array(string $name => string $uniqueName).
522 public static function &fieldKeys() {
523 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
524 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
526 return Civi
::$statics[__CLASS__
]['fieldKeys'];
530 * Returns the names of this table
534 public static function getTableName() {
535 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
539 * Returns if this table needs to be logged
543 public function getLog() {
548 * Returns the list of fields that can be imported
550 * @param bool $prefix
554 public static function &import($prefix = FALSE) {
555 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'survey', $prefix, []);
560 * Returns the list of fields that can be exported
562 * @param bool $prefix
566 public static function &export($prefix = FALSE) {
567 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'survey', $prefix, []);
572 * Returns the list of indices
574 * @param bool $localize
578 public static function indices($localize = TRUE) {
580 'UI_activity_type_id' => [
581 'name' => 'UI_activity_type_id',
583 0 => 'activity_type_id',
585 'localizable' => FALSE,
586 'sig' => 'civicrm_survey::0::activity_type_id',
589 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;