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:44d3b1a60152ac9eb8080e80b3b11d2c)
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',
232 'type' => CRM_Utils_Type
::T_STRING
,
233 'title' => ts('Survey Title'),
234 'description' => ts('Title of the Survey.'),
237 'size' => CRM_Utils_Type
::HUGE
,
239 'where' => 'civicrm_survey.title',
241 'table_name' => 'civicrm_survey',
242 'entity' => 'Survey',
243 'bao' => 'CRM_Campaign_BAO_Survey',
247 'name' => 'campaign_id',
248 'type' => CRM_Utils_Type
::T_INT
,
249 'title' => ts('Survey Campaign ID'),
250 'description' => ts('Foreign key to the Campaign.'),
251 'where' => 'civicrm_survey.campaign_id',
253 'table_name' => 'civicrm_survey',
254 'entity' => 'Survey',
255 'bao' => 'CRM_Campaign_BAO_Survey',
257 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
258 'pseudoconstant' => [
259 'table' => 'civicrm_campaign',
261 'labelColumn' => 'title',
264 'activity_type_id' => [
265 'name' => 'activity_type_id',
266 'type' => CRM_Utils_Type
::T_INT
,
267 'title' => ts('Activity Type'),
268 'description' => ts('Implicit FK to civicrm_option_value where option_group = activity_type'),
270 'where' => 'civicrm_survey.activity_type_id',
273 'table_name' => 'civicrm_survey',
274 'entity' => 'Survey',
275 'bao' => 'CRM_Campaign_BAO_Survey',
280 'pseudoconstant' => [
281 'optionGroupName' => 'activity_type',
282 'optionEditPath' => 'civicrm/admin/options/activity_type',
285 'recontact_interval' => [
286 'name' => 'recontact_interval',
287 'type' => CRM_Utils_Type
::T_TEXT
,
288 'title' => ts('Follow up Interval'),
289 'description' => ts('Recontact intervals for each status.'),
292 'where' => 'civicrm_survey.recontact_interval',
293 'table_name' => 'civicrm_survey',
294 'entity' => 'Survey',
295 'bao' => 'CRM_Campaign_BAO_Survey',
298 'type' => 'TextArea',
302 'name' => 'instructions',
303 'type' => CRM_Utils_Type
::T_TEXT
,
304 'title' => ts('Instructions'),
305 'description' => ts('Script instructions for volunteers to use for the survey.'),
308 'where' => 'civicrm_survey.instructions',
309 'table_name' => 'civicrm_survey',
310 'entity' => 'Survey',
311 'bao' => 'CRM_Campaign_BAO_Survey',
314 'type' => 'TextArea',
317 'release_frequency' => [
318 'name' => 'release_frequency',
319 'type' => CRM_Utils_Type
::T_INT
,
320 'title' => ts('Survey Hold Duration'),
321 'description' => ts('Number of days for recurrence of release.'),
322 'where' => 'civicrm_survey.release_frequency',
324 'table_name' => 'civicrm_survey',
325 'entity' => 'Survey',
326 'bao' => 'CRM_Campaign_BAO_Survey',
329 'max_number_of_contacts' => [
330 'name' => 'max_number_of_contacts',
331 'type' => CRM_Utils_Type
::T_INT
,
332 'title' => ts('Maximum number of contacts'),
333 'description' => ts('Maximum number of contacts to allow for survey.'),
334 'where' => 'civicrm_survey.max_number_of_contacts',
336 'table_name' => 'civicrm_survey',
337 'entity' => 'Survey',
338 'bao' => 'CRM_Campaign_BAO_Survey',
341 'default_number_of_contacts' => [
342 'name' => 'default_number_of_contacts',
343 'type' => CRM_Utils_Type
::T_INT
,
344 'title' => ts('Default number of contacts'),
345 'description' => ts('Default number of contacts to allow for survey.'),
346 'where' => 'civicrm_survey.default_number_of_contacts',
348 'table_name' => 'civicrm_survey',
349 'entity' => 'Survey',
350 'bao' => 'CRM_Campaign_BAO_Survey',
354 'name' => 'is_active',
355 'type' => CRM_Utils_Type
::T_BOOLEAN
,
356 'title' => ts('Survey Is Active'),
357 'description' => ts('Is this survey enabled or disabled/cancelled?'),
358 'where' => 'civicrm_survey.is_active',
360 'table_name' => 'civicrm_survey',
361 'entity' => 'Survey',
362 'bao' => 'CRM_Campaign_BAO_Survey',
366 'name' => 'is_default',
367 'type' => CRM_Utils_Type
::T_BOOLEAN
,
368 'title' => ts('Is Default Survey'),
369 'description' => ts('Is this default survey?'),
370 'where' => 'civicrm_survey.is_default',
372 'table_name' => 'civicrm_survey',
373 'entity' => 'Survey',
374 'bao' => 'CRM_Campaign_BAO_Survey',
378 'name' => 'created_id',
379 'type' => CRM_Utils_Type
::T_INT
,
380 'title' => ts('Survey Created By'),
381 'description' => ts('FK to civicrm_contact, who created this Survey.'),
382 'where' => 'civicrm_survey.created_id',
383 'table_name' => 'civicrm_survey',
384 'entity' => 'Survey',
385 'bao' => 'CRM_Campaign_BAO_Survey',
387 'FKClassName' => 'CRM_Contact_DAO_Contact',
390 'name' => 'created_date',
391 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
392 'title' => ts('Campaign Created Date'),
393 'description' => ts('Date and time that Survey was created.'),
394 'where' => 'civicrm_survey.created_date',
395 'table_name' => 'civicrm_survey',
396 'entity' => 'Survey',
397 'bao' => 'CRM_Campaign_BAO_Survey',
400 'last_modified_id' => [
401 'name' => 'last_modified_id',
402 'type' => CRM_Utils_Type
::T_INT
,
403 'title' => ts('Survey Modified'),
404 'description' => ts('FK to civicrm_contact, who recently edited this Survey.'),
405 'where' => 'civicrm_survey.last_modified_id',
406 'table_name' => 'civicrm_survey',
407 'entity' => 'Survey',
408 'bao' => 'CRM_Campaign_BAO_Survey',
410 'FKClassName' => 'CRM_Contact_DAO_Contact',
412 'last_modified_date' => [
413 'name' => 'last_modified_date',
414 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
415 'title' => ts('Survey Modified On'),
416 'description' => ts('Date and time that Survey was edited last time.'),
417 'where' => 'civicrm_survey.last_modified_date',
418 'table_name' => 'civicrm_survey',
419 'entity' => 'Survey',
420 'bao' => 'CRM_Campaign_BAO_Survey',
424 'name' => 'result_id',
425 'type' => CRM_Utils_Type
::T_INT
,
426 'title' => ts('Survey Result'),
427 'description' => ts('Used to store option group id.'),
428 'where' => 'civicrm_survey.result_id',
430 'table_name' => 'civicrm_survey',
431 'entity' => 'Survey',
432 'bao' => 'CRM_Campaign_BAO_Survey',
435 'bypass_confirm' => [
436 'name' => 'bypass_confirm',
437 'type' => CRM_Utils_Type
::T_BOOLEAN
,
438 'title' => ts('No Email Verification'),
439 'description' => ts('Bypass the email verification.'),
440 'where' => 'civicrm_survey.bypass_confirm',
442 'table_name' => 'civicrm_survey',
443 'entity' => 'Survey',
444 'bao' => 'CRM_Campaign_BAO_Survey',
447 'thankyou_title' => [
448 'name' => 'thankyou_title',
449 'type' => CRM_Utils_Type
::T_STRING
,
450 'title' => ts('Thank-you Title'),
451 'description' => ts('Title for Thank-you page (header title tag, and display at the top of the page).'),
453 'size' => CRM_Utils_Type
::HUGE
,
454 'where' => 'civicrm_survey.thankyou_title',
455 'table_name' => 'civicrm_survey',
456 'entity' => 'Survey',
457 'bao' => 'CRM_Campaign_BAO_Survey',
461 'name' => 'thankyou_text',
462 'type' => CRM_Utils_Type
::T_TEXT
,
463 'title' => ts('Thank-you Text'),
464 'description' => ts('text and html allowed. displayed above result on success page'),
467 'where' => 'civicrm_survey.thankyou_text',
468 'table_name' => 'civicrm_survey',
469 'entity' => 'Survey',
470 'bao' => 'CRM_Campaign_BAO_Survey',
473 'type' => 'TextArea',
477 'name' => 'is_share',
478 'type' => CRM_Utils_Type
::T_BOOLEAN
,
479 'title' => ts('Is shared through social media'),
480 'description' => ts('Can people share the petition through social media?'),
481 'where' => 'civicrm_survey.is_share',
483 'table_name' => 'civicrm_survey',
484 'entity' => 'Survey',
485 'bao' => 'CRM_Campaign_BAO_Survey',
489 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
491 return Civi
::$statics[__CLASS__
]['fields'];
495 * Return a mapping from field-name to the corresponding key (as used in fields()).
498 * Array(string $name => string $uniqueName).
500 public static function &fieldKeys() {
501 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
502 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
504 return Civi
::$statics[__CLASS__
]['fieldKeys'];
508 * Returns the names of this table
512 public static function getTableName() {
513 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
517 * Returns if this table needs to be logged
521 public function getLog() {
526 * Returns the list of fields that can be imported
528 * @param bool $prefix
532 public static function &import($prefix = FALSE) {
533 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'survey', $prefix, []);
538 * Returns the list of fields that can be exported
540 * @param bool $prefix
544 public static function &export($prefix = FALSE) {
545 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'survey', $prefix, []);
550 * Returns the list of indices
552 * @param bool $localize
556 public static function indices($localize = TRUE) {
558 'UI_activity_type_id' => [
559 'name' => 'UI_activity_type_id',
561 0 => 'activity_type_id',
563 'localizable' => FALSE,
564 'sig' => 'civicrm_survey::0::activity_type_id',
567 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;