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:afb7cfcccd2a6177b2b10e07afa92e8e)
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 * @param bool $plural
192 * Whether to return the plural version of the title.
194 public static function getEntityTitle($plural = FALSE) {
195 return $plural ?
ts('Surveys') : ts('Survey');
199 * Returns foreign keys and entity references.
202 * [CRM_Core_Reference_Interface]
204 public static function getReferenceColumns() {
205 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
206 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
207 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
208 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
209 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'last_modified_id', 'civicrm_contact', 'id');
210 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
212 return Civi
::$statics[__CLASS__
]['links'];
216 * Returns all the column names of this table
220 public static function &fields() {
221 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
222 Civi
::$statics[__CLASS__
]['fields'] = [
225 'type' => CRM_Utils_Type
::T_INT
,
226 'title' => ts('Survey ID'),
227 'description' => ts('Survey id.'),
229 'where' => 'civicrm_survey.id',
230 'table_name' => 'civicrm_survey',
231 'entity' => 'Survey',
232 'bao' => 'CRM_Campaign_BAO_Survey',
238 'type' => CRM_Utils_Type
::T_STRING
,
239 'title' => ts('Survey Title'),
240 'description' => ts('Title of the Survey.'),
243 'size' => CRM_Utils_Type
::HUGE
,
245 'where' => 'civicrm_survey.title',
247 'table_name' => 'civicrm_survey',
248 'entity' => 'Survey',
249 'bao' => 'CRM_Campaign_BAO_Survey',
254 'name' => 'campaign_id',
255 'type' => CRM_Utils_Type
::T_INT
,
256 'title' => ts('Survey Campaign ID'),
257 'description' => ts('Foreign key to the Campaign.'),
258 'where' => 'civicrm_survey.campaign_id',
260 'table_name' => 'civicrm_survey',
261 'entity' => 'Survey',
262 'bao' => 'CRM_Campaign_BAO_Survey',
264 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
265 'pseudoconstant' => [
266 'table' => 'civicrm_campaign',
268 'labelColumn' => 'title',
272 'activity_type_id' => [
273 'name' => 'activity_type_id',
274 'type' => CRM_Utils_Type
::T_INT
,
275 'title' => ts('Activity Type'),
276 'description' => ts('Implicit FK to civicrm_option_value where option_group = activity_type'),
278 'where' => 'civicrm_survey.activity_type_id',
281 'table_name' => 'civicrm_survey',
282 'entity' => 'Survey',
283 'bao' => 'CRM_Campaign_BAO_Survey',
288 'pseudoconstant' => [
289 'optionGroupName' => 'activity_type',
290 'optionEditPath' => 'civicrm/admin/options/activity_type',
294 'recontact_interval' => [
295 'name' => 'recontact_interval',
296 'type' => CRM_Utils_Type
::T_TEXT
,
297 'title' => ts('Follow up Interval'),
298 'description' => ts('Recontact intervals for each status.'),
301 'where' => 'civicrm_survey.recontact_interval',
302 'table_name' => 'civicrm_survey',
303 'entity' => 'Survey',
304 'bao' => 'CRM_Campaign_BAO_Survey',
307 'type' => 'TextArea',
312 'name' => 'instructions',
313 'type' => CRM_Utils_Type
::T_TEXT
,
314 'title' => ts('Instructions'),
315 'description' => ts('Script instructions for volunteers to use for the survey.'),
318 'where' => 'civicrm_survey.instructions',
319 'table_name' => 'civicrm_survey',
320 'entity' => 'Survey',
321 'bao' => 'CRM_Campaign_BAO_Survey',
324 'type' => 'TextArea',
328 'release_frequency' => [
329 'name' => 'release_frequency',
330 'type' => CRM_Utils_Type
::T_INT
,
331 'title' => ts('Survey Hold Duration'),
332 'description' => ts('Number of days for recurrence of release.'),
333 'where' => 'civicrm_survey.release_frequency',
335 'table_name' => 'civicrm_survey',
336 'entity' => 'Survey',
337 'bao' => 'CRM_Campaign_BAO_Survey',
341 'max_number_of_contacts' => [
342 'name' => 'max_number_of_contacts',
343 'type' => CRM_Utils_Type
::T_INT
,
344 'title' => ts('Maximum number of contacts'),
345 'description' => ts('Maximum number of contacts to allow for survey.'),
346 'where' => 'civicrm_survey.max_number_of_contacts',
348 'table_name' => 'civicrm_survey',
349 'entity' => 'Survey',
350 'bao' => 'CRM_Campaign_BAO_Survey',
354 'default_number_of_contacts' => [
355 'name' => 'default_number_of_contacts',
356 'type' => CRM_Utils_Type
::T_INT
,
357 'title' => ts('Default number of contacts'),
358 'description' => ts('Default number of contacts to allow for survey.'),
359 'where' => 'civicrm_survey.default_number_of_contacts',
361 'table_name' => 'civicrm_survey',
362 'entity' => 'Survey',
363 'bao' => 'CRM_Campaign_BAO_Survey',
368 'name' => 'is_active',
369 'type' => CRM_Utils_Type
::T_BOOLEAN
,
370 'title' => ts('Survey Is Active'),
371 'description' => ts('Is this survey enabled or disabled/cancelled?'),
372 'where' => 'civicrm_survey.is_active',
374 'table_name' => 'civicrm_survey',
375 'entity' => 'Survey',
376 'bao' => 'CRM_Campaign_BAO_Survey',
381 'name' => 'is_default',
382 'type' => CRM_Utils_Type
::T_BOOLEAN
,
383 'title' => ts('Is Default Survey'),
384 'description' => ts('Is this default survey?'),
385 'where' => 'civicrm_survey.is_default',
387 'table_name' => 'civicrm_survey',
388 'entity' => 'Survey',
389 'bao' => 'CRM_Campaign_BAO_Survey',
394 'name' => 'created_id',
395 'type' => CRM_Utils_Type
::T_INT
,
396 'title' => ts('Survey Created By'),
397 'description' => ts('FK to civicrm_contact, who created this Survey.'),
398 'where' => 'civicrm_survey.created_id',
399 'table_name' => 'civicrm_survey',
400 'entity' => 'Survey',
401 'bao' => 'CRM_Campaign_BAO_Survey',
403 'FKClassName' => 'CRM_Contact_DAO_Contact',
407 'name' => 'created_date',
408 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
409 'title' => ts('Campaign Created Date'),
410 'description' => ts('Date and time that Survey was created.'),
411 'where' => 'civicrm_survey.created_date',
412 'table_name' => 'civicrm_survey',
413 'entity' => 'Survey',
414 'bao' => 'CRM_Campaign_BAO_Survey',
418 'last_modified_id' => [
419 'name' => 'last_modified_id',
420 'type' => CRM_Utils_Type
::T_INT
,
421 'title' => ts('Survey Modified'),
422 'description' => ts('FK to civicrm_contact, who recently edited this Survey.'),
423 'where' => 'civicrm_survey.last_modified_id',
424 'table_name' => 'civicrm_survey',
425 'entity' => 'Survey',
426 'bao' => 'CRM_Campaign_BAO_Survey',
428 'FKClassName' => 'CRM_Contact_DAO_Contact',
431 'last_modified_date' => [
432 'name' => 'last_modified_date',
433 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
434 'title' => ts('Survey Modified On'),
435 'description' => ts('Date and time that Survey was edited last time.'),
436 'where' => 'civicrm_survey.last_modified_date',
437 'table_name' => 'civicrm_survey',
438 'entity' => 'Survey',
439 'bao' => 'CRM_Campaign_BAO_Survey',
444 'name' => 'result_id',
445 'type' => CRM_Utils_Type
::T_INT
,
446 'title' => ts('Survey Result'),
447 'description' => ts('Used to store option group id.'),
448 'where' => 'civicrm_survey.result_id',
450 'table_name' => 'civicrm_survey',
451 'entity' => 'Survey',
452 'bao' => 'CRM_Campaign_BAO_Survey',
456 'bypass_confirm' => [
457 'name' => 'bypass_confirm',
458 'type' => CRM_Utils_Type
::T_BOOLEAN
,
459 'title' => ts('No Email Verification'),
460 'description' => ts('Bypass the email verification.'),
461 'where' => 'civicrm_survey.bypass_confirm',
463 'table_name' => 'civicrm_survey',
464 'entity' => 'Survey',
465 'bao' => 'CRM_Campaign_BAO_Survey',
469 'thankyou_title' => [
470 'name' => 'thankyou_title',
471 'type' => CRM_Utils_Type
::T_STRING
,
472 'title' => ts('Thank-you Title'),
473 'description' => ts('Title for Thank-you page (header title tag, and display at the top of the page).'),
475 'size' => CRM_Utils_Type
::HUGE
,
476 'where' => 'civicrm_survey.thankyou_title',
477 'table_name' => 'civicrm_survey',
478 'entity' => 'Survey',
479 'bao' => 'CRM_Campaign_BAO_Survey',
484 'name' => 'thankyou_text',
485 'type' => CRM_Utils_Type
::T_TEXT
,
486 'title' => ts('Thank-you Text'),
487 'description' => ts('text and html allowed. displayed above result on success page'),
490 'where' => 'civicrm_survey.thankyou_text',
491 'table_name' => 'civicrm_survey',
492 'entity' => 'Survey',
493 'bao' => 'CRM_Campaign_BAO_Survey',
496 'type' => 'TextArea',
501 'name' => 'is_share',
502 'type' => CRM_Utils_Type
::T_BOOLEAN
,
503 'title' => ts('Is shared through social media'),
504 'description' => ts('Can people share the petition through social media?'),
505 'where' => 'civicrm_survey.is_share',
507 'table_name' => 'civicrm_survey',
508 'entity' => 'Survey',
509 'bao' => 'CRM_Campaign_BAO_Survey',
514 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
516 return Civi
::$statics[__CLASS__
]['fields'];
520 * Return a mapping from field-name to the corresponding key (as used in fields()).
523 * Array(string $name => string $uniqueName).
525 public static function &fieldKeys() {
526 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
527 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
529 return Civi
::$statics[__CLASS__
]['fieldKeys'];
533 * Returns the names of this table
537 public static function getTableName() {
538 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
542 * Returns if this table needs to be logged
546 public function getLog() {
551 * Returns the list of fields that can be imported
553 * @param bool $prefix
557 public static function &import($prefix = FALSE) {
558 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'survey', $prefix, []);
563 * Returns the list of fields that can be exported
565 * @param bool $prefix
569 public static function &export($prefix = FALSE) {
570 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'survey', $prefix, []);
575 * Returns the list of indices
577 * @param bool $localize
581 public static function indices($localize = TRUE) {
583 'UI_activity_type_id' => [
584 'name' => 'UI_activity_type_id',
586 0 => 'activity_type_id',
588 'localizable' => FALSE,
589 'sig' => 'civicrm_survey::0::activity_type_id',
592 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;