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:f7cedbe0c777cf7b99c543e80ff5cf0b)
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 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
39 * Title of the Survey.
46 * Foreign key to the Campaign.
53 * Implicit FK to civicrm_option_value where option_group = activity_type
57 public $activity_type_id;
60 * Recontact intervals for each status.
64 public $recontact_interval;
67 * Script instructions for volunteers to use for the survey.
74 * Number of days for recurrence of release.
78 public $release_frequency;
81 * Maximum number of contacts to allow for survey.
85 public $max_number_of_contacts;
88 * Default number of contacts to allow for survey.
92 public $default_number_of_contacts;
95 * Is this survey enabled or disabled/cancelled?
102 * Is this default survey?
109 * FK to civicrm_contact, who created this Survey.
116 * Date and time that Survey was created.
120 public $created_date;
123 * FK to civicrm_contact, who recently edited this Survey.
127 public $last_modified_id;
130 * Date and time that Survey was edited last time.
134 public $last_modified_date;
137 * Used to store option group id.
144 * Bypass the email verification.
148 public $bypass_confirm;
151 * Title for Thank-you page (header title tag, and display at the top of the page).
155 public $thankyou_title;
158 * text and html allowed. displayed above result on success page
162 public $thankyou_text;
165 * Can people share the petition through social media?
174 public function __construct() {
175 $this->__table
= 'civicrm_survey';
176 parent
::__construct();
180 * Returns foreign keys and entity references.
183 * [CRM_Core_Reference_Interface]
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']);
193 return Civi
::$statics[__CLASS__
]['links'];
197 * Returns all the column names of this table
201 public static function &fields() {
202 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
203 Civi
::$statics[__CLASS__
]['fields'] = [
206 'type' => CRM_Utils_Type
::T_INT
,
207 'title' => ts('Survey ID'),
208 'description' => ts('Survey id.'),
210 'where' => 'civicrm_survey.id',
211 'table_name' => 'civicrm_survey',
212 'entity' => 'Survey',
213 'bao' => 'CRM_Campaign_BAO_Survey',
218 'type' => CRM_Utils_Type
::T_STRING
,
219 'title' => ts('Survey Title'),
220 'description' => ts('Title of the Survey.'),
223 'size' => CRM_Utils_Type
::HUGE
,
225 'where' => 'civicrm_survey.title',
227 'table_name' => 'civicrm_survey',
228 'entity' => 'Survey',
229 'bao' => 'CRM_Campaign_BAO_Survey',
233 'name' => 'campaign_id',
234 'type' => CRM_Utils_Type
::T_INT
,
235 'title' => ts('Survey Campaign ID'),
236 'description' => ts('Foreign key to the Campaign.'),
237 'where' => 'civicrm_survey.campaign_id',
239 'table_name' => 'civicrm_survey',
240 'entity' => 'Survey',
241 'bao' => 'CRM_Campaign_BAO_Survey',
243 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
244 'pseudoconstant' => [
245 'table' => 'civicrm_campaign',
247 'labelColumn' => 'title',
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'),
256 'where' => 'civicrm_survey.activity_type_id',
259 'table_name' => 'civicrm_survey',
260 'entity' => 'Survey',
261 'bao' => 'CRM_Campaign_BAO_Survey',
266 'pseudoconstant' => [
267 'optionGroupName' => 'activity_type',
268 'optionEditPath' => 'civicrm/admin/options/activity_type',
271 'recontact_interval' => [
272 'name' => 'recontact_interval',
273 'type' => CRM_Utils_Type
::T_TEXT
,
274 'title' => ts('Follow up Interval'),
275 'description' => ts('Recontact intervals for each status.'),
278 'where' => 'civicrm_survey.recontact_interval',
279 'table_name' => 'civicrm_survey',
280 'entity' => 'Survey',
281 'bao' => 'CRM_Campaign_BAO_Survey',
284 'type' => 'TextArea',
288 'name' => 'instructions',
289 'type' => CRM_Utils_Type
::T_TEXT
,
290 'title' => ts('Instructions'),
291 'description' => ts('Script instructions for volunteers to use for the survey.'),
294 'where' => 'civicrm_survey.instructions',
295 'table_name' => 'civicrm_survey',
296 'entity' => 'Survey',
297 'bao' => 'CRM_Campaign_BAO_Survey',
300 'type' => 'TextArea',
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 'where' => 'civicrm_survey.release_frequency',
310 'table_name' => 'civicrm_survey',
311 'entity' => 'Survey',
312 'bao' => 'CRM_Campaign_BAO_Survey',
315 'max_number_of_contacts' => [
316 'name' => 'max_number_of_contacts',
317 'type' => CRM_Utils_Type
::T_INT
,
318 'title' => ts('Maximum number of contacts'),
319 'description' => ts('Maximum number of contacts to allow for survey.'),
320 'where' => 'civicrm_survey.max_number_of_contacts',
322 'table_name' => 'civicrm_survey',
323 'entity' => 'Survey',
324 'bao' => 'CRM_Campaign_BAO_Survey',
327 'default_number_of_contacts' => [
328 'name' => 'default_number_of_contacts',
329 'type' => CRM_Utils_Type
::T_INT
,
330 'title' => ts('Default number of contacts'),
331 'description' => ts('Default number of contacts to allow for survey.'),
332 'where' => 'civicrm_survey.default_number_of_contacts',
334 'table_name' => 'civicrm_survey',
335 'entity' => 'Survey',
336 'bao' => 'CRM_Campaign_BAO_Survey',
340 'name' => 'is_active',
341 'type' => CRM_Utils_Type
::T_BOOLEAN
,
342 'title' => ts('Survey Is Active'),
343 'description' => ts('Is this survey enabled or disabled/cancelled?'),
344 'where' => 'civicrm_survey.is_active',
346 'table_name' => 'civicrm_survey',
347 'entity' => 'Survey',
348 'bao' => 'CRM_Campaign_BAO_Survey',
352 'name' => 'is_default',
353 'type' => CRM_Utils_Type
::T_BOOLEAN
,
354 'title' => ts('Is Default Survey'),
355 'description' => ts('Is this default survey?'),
356 'where' => 'civicrm_survey.is_default',
358 'table_name' => 'civicrm_survey',
359 'entity' => 'Survey',
360 'bao' => 'CRM_Campaign_BAO_Survey',
364 'name' => 'created_id',
365 'type' => CRM_Utils_Type
::T_INT
,
366 'title' => ts('Survey Created By'),
367 'description' => ts('FK to civicrm_contact, who created this Survey.'),
368 'where' => 'civicrm_survey.created_id',
369 'table_name' => 'civicrm_survey',
370 'entity' => 'Survey',
371 'bao' => 'CRM_Campaign_BAO_Survey',
373 'FKClassName' => 'CRM_Contact_DAO_Contact',
376 'name' => 'created_date',
377 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
378 'title' => ts('Campaign Created Date'),
379 'description' => ts('Date and time that Survey was created.'),
380 'where' => 'civicrm_survey.created_date',
381 'table_name' => 'civicrm_survey',
382 'entity' => 'Survey',
383 'bao' => 'CRM_Campaign_BAO_Survey',
386 'last_modified_id' => [
387 'name' => 'last_modified_id',
388 'type' => CRM_Utils_Type
::T_INT
,
389 'title' => ts('Survey Modified'),
390 'description' => ts('FK to civicrm_contact, who recently edited this Survey.'),
391 'where' => 'civicrm_survey.last_modified_id',
392 'table_name' => 'civicrm_survey',
393 'entity' => 'Survey',
394 'bao' => 'CRM_Campaign_BAO_Survey',
396 'FKClassName' => 'CRM_Contact_DAO_Contact',
398 'last_modified_date' => [
399 'name' => 'last_modified_date',
400 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
401 'title' => ts('Survey Modified On'),
402 'description' => ts('Date and time that Survey was edited last time.'),
403 'where' => 'civicrm_survey.last_modified_date',
404 'table_name' => 'civicrm_survey',
405 'entity' => 'Survey',
406 'bao' => 'CRM_Campaign_BAO_Survey',
410 'name' => 'result_id',
411 'type' => CRM_Utils_Type
::T_INT
,
412 'title' => ts('Survey Result'),
413 'description' => ts('Used to store option group id.'),
414 'where' => 'civicrm_survey.result_id',
416 'table_name' => 'civicrm_survey',
417 'entity' => 'Survey',
418 'bao' => 'CRM_Campaign_BAO_Survey',
421 'bypass_confirm' => [
422 'name' => 'bypass_confirm',
423 'type' => CRM_Utils_Type
::T_BOOLEAN
,
424 'title' => ts('No Email Verification'),
425 'description' => ts('Bypass the email verification.'),
426 'where' => 'civicrm_survey.bypass_confirm',
428 'table_name' => 'civicrm_survey',
429 'entity' => 'Survey',
430 'bao' => 'CRM_Campaign_BAO_Survey',
433 'thankyou_title' => [
434 'name' => 'thankyou_title',
435 'type' => CRM_Utils_Type
::T_STRING
,
436 'title' => ts('Thank-you Title'),
437 'description' => ts('Title for Thank-you page (header title tag, and display at the top of the page).'),
439 'size' => CRM_Utils_Type
::HUGE
,
440 'where' => 'civicrm_survey.thankyou_title',
441 'table_name' => 'civicrm_survey',
442 'entity' => 'Survey',
443 'bao' => 'CRM_Campaign_BAO_Survey',
447 'name' => 'thankyou_text',
448 'type' => CRM_Utils_Type
::T_TEXT
,
449 'title' => ts('Thank-you Text'),
450 'description' => ts('text and html allowed. displayed above result on success page'),
453 'where' => 'civicrm_survey.thankyou_text',
454 'table_name' => 'civicrm_survey',
455 'entity' => 'Survey',
456 'bao' => 'CRM_Campaign_BAO_Survey',
459 'type' => 'TextArea',
463 'name' => 'is_share',
464 'type' => CRM_Utils_Type
::T_BOOLEAN
,
465 'title' => ts('Is shared through social media'),
466 'description' => ts('Can people share the petition through social media?'),
467 'where' => 'civicrm_survey.is_share',
469 'table_name' => 'civicrm_survey',
470 'entity' => 'Survey',
471 'bao' => 'CRM_Campaign_BAO_Survey',
475 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
477 return Civi
::$statics[__CLASS__
]['fields'];
481 * Return a mapping from field-name to the corresponding key (as used in fields()).
484 * Array(string $name => string $uniqueName).
486 public static function &fieldKeys() {
487 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
488 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
490 return Civi
::$statics[__CLASS__
]['fieldKeys'];
494 * Returns the names of this table
498 public static function getTableName() {
499 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
503 * Returns if this table needs to be logged
507 public function getLog() {
512 * Returns the list of fields that can be imported
514 * @param bool $prefix
518 public static function &import($prefix = FALSE) {
519 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'survey', $prefix, []);
524 * Returns the list of fields that can be exported
526 * @param bool $prefix
530 public static function &export($prefix = FALSE) {
531 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'survey', $prefix, []);
536 * Returns the list of indices
538 * @param bool $localize
542 public static function indices($localize = TRUE) {
544 'UI_activity_type_id' => [
545 'name' => 'UI_activity_type_id',
547 0 => 'activity_type_id',
549 'localizable' => FALSE,
550 'sig' => 'civicrm_survey::0::activity_type_id',
553 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;