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:b324203328e0c8d3dc10a4346a4db6f3)
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 * Should CiviCRM log any modifications to this table in the civicrm_log table.
39 public static $_log = FALSE;
49 * Title of the Survey.
56 * Foreign key to the Campaign.
63 * Implicit FK to civicrm_option_value where option_group = activity_type
67 public $activity_type_id;
70 * Recontact intervals for each status.
74 public $recontact_interval;
77 * Script instructions for volunteers to use for the survey.
84 * Number of days for recurrence of release.
88 public $release_frequency;
91 * Maximum number of contacts to allow for survey.
95 public $max_number_of_contacts;
98 * Default number of contacts to allow for survey.
102 public $default_number_of_contacts;
105 * Is this survey enabled or disabled/cancelled?
112 * Is this default survey?
119 * FK to civicrm_contact, who created this Survey.
126 * Date and time that Survey was created.
130 public $created_date;
133 * FK to civicrm_contact, who recently edited this Survey.
137 public $last_modified_id;
140 * Date and time that Survey was edited last time.
144 public $last_modified_date;
147 * Used to store option group id.
154 * Bypass the email verification.
158 public $bypass_confirm;
161 * Title for Thank-you page (header title tag, and display at the top of the page).
165 public $thankyou_title;
168 * text and html allowed. displayed above result on success page
172 public $thankyou_text;
175 * Can people share the petition through social media?
184 public function __construct() {
185 $this->__table
= 'civicrm_survey';
186 parent
::__construct();
190 * Returns localized title of this entity.
192 * @param bool $plural
193 * Whether to return the plural version of the title.
195 public static function getEntityTitle($plural = FALSE) {
196 return $plural ?
ts('Surveys') : ts('Survey');
200 * Returns foreign keys and entity references.
203 * [CRM_Core_Reference_Interface]
205 public static function getReferenceColumns() {
206 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
207 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
208 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
209 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
210 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'last_modified_id', 'civicrm_contact', 'id');
211 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
213 return Civi
::$statics[__CLASS__
]['links'];
217 * Returns all the column names of this table
221 public static function &fields() {
222 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
223 Civi
::$statics[__CLASS__
]['fields'] = [
226 'type' => CRM_Utils_Type
::T_INT
,
227 'title' => ts('Survey ID'),
228 'description' => ts('Survey id.'),
230 'where' => 'civicrm_survey.id',
231 'table_name' => 'civicrm_survey',
232 'entity' => 'Survey',
233 'bao' => 'CRM_Campaign_BAO_Survey',
239 'type' => CRM_Utils_Type
::T_STRING
,
240 'title' => ts('Survey Title'),
241 'description' => ts('Title of the Survey.'),
244 'size' => CRM_Utils_Type
::HUGE
,
246 'where' => 'civicrm_survey.title',
248 'table_name' => 'civicrm_survey',
249 'entity' => 'Survey',
250 'bao' => 'CRM_Campaign_BAO_Survey',
255 'name' => 'campaign_id',
256 'type' => CRM_Utils_Type
::T_INT
,
257 'title' => ts('Survey Campaign ID'),
258 'description' => ts('Foreign key to the Campaign.'),
259 'where' => 'civicrm_survey.campaign_id',
261 'table_name' => 'civicrm_survey',
262 'entity' => 'Survey',
263 'bao' => 'CRM_Campaign_BAO_Survey',
265 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
266 'pseudoconstant' => [
267 'table' => 'civicrm_campaign',
269 'labelColumn' => 'title',
273 'activity_type_id' => [
274 'name' => 'activity_type_id',
275 'type' => CRM_Utils_Type
::T_INT
,
276 'title' => ts('Activity Type'),
277 'description' => ts('Implicit FK to civicrm_option_value where option_group = activity_type'),
279 'where' => 'civicrm_survey.activity_type_id',
282 'table_name' => 'civicrm_survey',
283 'entity' => 'Survey',
284 'bao' => 'CRM_Campaign_BAO_Survey',
289 'pseudoconstant' => [
290 'optionGroupName' => 'activity_type',
291 'optionEditPath' => 'civicrm/admin/options/activity_type',
295 'recontact_interval' => [
296 'name' => 'recontact_interval',
297 'type' => CRM_Utils_Type
::T_TEXT
,
298 'title' => ts('Follow up Interval'),
299 'description' => ts('Recontact intervals for each status.'),
302 'where' => 'civicrm_survey.recontact_interval',
303 'table_name' => 'civicrm_survey',
304 'entity' => 'Survey',
305 'bao' => 'CRM_Campaign_BAO_Survey',
308 'type' => 'TextArea',
313 'name' => 'instructions',
314 'type' => CRM_Utils_Type
::T_TEXT
,
315 'title' => ts('Instructions'),
316 'description' => ts('Script instructions for volunteers to use for the survey.'),
319 'where' => 'civicrm_survey.instructions',
320 'table_name' => 'civicrm_survey',
321 'entity' => 'Survey',
322 'bao' => 'CRM_Campaign_BAO_Survey',
325 'type' => 'TextArea',
329 'release_frequency' => [
330 'name' => 'release_frequency',
331 'type' => CRM_Utils_Type
::T_INT
,
332 'title' => ts('Survey Hold Duration'),
333 'description' => ts('Number of days for recurrence of release.'),
334 'where' => 'civicrm_survey.release_frequency',
336 'table_name' => 'civicrm_survey',
337 'entity' => 'Survey',
338 'bao' => 'CRM_Campaign_BAO_Survey',
342 'max_number_of_contacts' => [
343 'name' => 'max_number_of_contacts',
344 'type' => CRM_Utils_Type
::T_INT
,
345 'title' => ts('Maximum number of contacts'),
346 'description' => ts('Maximum number of contacts to allow for survey.'),
347 'where' => 'civicrm_survey.max_number_of_contacts',
349 'table_name' => 'civicrm_survey',
350 'entity' => 'Survey',
351 'bao' => 'CRM_Campaign_BAO_Survey',
355 'default_number_of_contacts' => [
356 'name' => 'default_number_of_contacts',
357 'type' => CRM_Utils_Type
::T_INT
,
358 'title' => ts('Default number of contacts'),
359 'description' => ts('Default number of contacts to allow for survey.'),
360 'where' => 'civicrm_survey.default_number_of_contacts',
362 'table_name' => 'civicrm_survey',
363 'entity' => 'Survey',
364 'bao' => 'CRM_Campaign_BAO_Survey',
369 'name' => 'is_active',
370 'type' => CRM_Utils_Type
::T_BOOLEAN
,
371 'title' => ts('Survey Is Active'),
372 'description' => ts('Is this survey enabled or disabled/cancelled?'),
373 'where' => 'civicrm_survey.is_active',
375 'table_name' => 'civicrm_survey',
376 'entity' => 'Survey',
377 'bao' => 'CRM_Campaign_BAO_Survey',
382 'name' => 'is_default',
383 'type' => CRM_Utils_Type
::T_BOOLEAN
,
384 'title' => ts('Is Default Survey'),
385 'description' => ts('Is this default survey?'),
386 'where' => 'civicrm_survey.is_default',
388 'table_name' => 'civicrm_survey',
389 'entity' => 'Survey',
390 'bao' => 'CRM_Campaign_BAO_Survey',
395 'name' => 'created_id',
396 'type' => CRM_Utils_Type
::T_INT
,
397 'title' => ts('Survey Created By'),
398 'description' => ts('FK to civicrm_contact, who created this Survey.'),
399 'where' => 'civicrm_survey.created_id',
400 'table_name' => 'civicrm_survey',
401 'entity' => 'Survey',
402 'bao' => 'CRM_Campaign_BAO_Survey',
404 'FKClassName' => 'CRM_Contact_DAO_Contact',
408 'name' => 'created_date',
409 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
410 'title' => ts('Campaign Created Date'),
411 'description' => ts('Date and time that Survey was created.'),
412 'where' => 'civicrm_survey.created_date',
413 'table_name' => 'civicrm_survey',
414 'entity' => 'Survey',
415 'bao' => 'CRM_Campaign_BAO_Survey',
419 'last_modified_id' => [
420 'name' => 'last_modified_id',
421 'type' => CRM_Utils_Type
::T_INT
,
422 'title' => ts('Survey Modified'),
423 'description' => ts('FK to civicrm_contact, who recently edited this Survey.'),
424 'where' => 'civicrm_survey.last_modified_id',
425 'table_name' => 'civicrm_survey',
426 'entity' => 'Survey',
427 'bao' => 'CRM_Campaign_BAO_Survey',
429 'FKClassName' => 'CRM_Contact_DAO_Contact',
432 'last_modified_date' => [
433 'name' => 'last_modified_date',
434 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
435 'title' => ts('Survey Modified On'),
436 'description' => ts('Date and time that Survey was edited last time.'),
437 'where' => 'civicrm_survey.last_modified_date',
438 'table_name' => 'civicrm_survey',
439 'entity' => 'Survey',
440 'bao' => 'CRM_Campaign_BAO_Survey',
445 'name' => 'result_id',
446 'type' => CRM_Utils_Type
::T_INT
,
447 'title' => ts('Survey Result'),
448 'description' => ts('Used to store option group id.'),
449 'where' => 'civicrm_survey.result_id',
451 'table_name' => 'civicrm_survey',
452 'entity' => 'Survey',
453 'bao' => 'CRM_Campaign_BAO_Survey',
457 'bypass_confirm' => [
458 'name' => 'bypass_confirm',
459 'type' => CRM_Utils_Type
::T_BOOLEAN
,
460 'title' => ts('No Email Verification'),
461 'description' => ts('Bypass the email verification.'),
462 'where' => 'civicrm_survey.bypass_confirm',
464 'table_name' => 'civicrm_survey',
465 'entity' => 'Survey',
466 'bao' => 'CRM_Campaign_BAO_Survey',
470 'thankyou_title' => [
471 'name' => 'thankyou_title',
472 'type' => CRM_Utils_Type
::T_STRING
,
473 'title' => ts('Thank-you Title'),
474 'description' => ts('Title for Thank-you page (header title tag, and display at the top of the page).'),
476 'size' => CRM_Utils_Type
::HUGE
,
477 'where' => 'civicrm_survey.thankyou_title',
478 'table_name' => 'civicrm_survey',
479 'entity' => 'Survey',
480 'bao' => 'CRM_Campaign_BAO_Survey',
485 'name' => 'thankyou_text',
486 'type' => CRM_Utils_Type
::T_TEXT
,
487 'title' => ts('Thank-you Text'),
488 'description' => ts('text and html allowed. displayed above result on success page'),
491 'where' => 'civicrm_survey.thankyou_text',
492 'table_name' => 'civicrm_survey',
493 'entity' => 'Survey',
494 'bao' => 'CRM_Campaign_BAO_Survey',
497 'type' => 'TextArea',
502 'name' => 'is_share',
503 'type' => CRM_Utils_Type
::T_BOOLEAN
,
504 'title' => ts('Is shared through social media'),
505 'description' => ts('Can people share the petition through social media?'),
506 'where' => 'civicrm_survey.is_share',
508 'table_name' => 'civicrm_survey',
509 'entity' => 'Survey',
510 'bao' => 'CRM_Campaign_BAO_Survey',
515 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
517 return Civi
::$statics[__CLASS__
]['fields'];
521 * Return a mapping from field-name to the corresponding key (as used in fields()).
524 * Array(string $name => string $uniqueName).
526 public static function &fieldKeys() {
527 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
528 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
530 return Civi
::$statics[__CLASS__
]['fieldKeys'];
534 * Returns the names of this table
538 public static function getTableName() {
539 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
543 * Returns if this table needs to be logged
547 public function getLog() {
552 * Returns the list of fields that can be imported
554 * @param bool $prefix
558 public static function &import($prefix = FALSE) {
559 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'survey', $prefix, []);
564 * Returns the list of fields that can be exported
566 * @param bool $prefix
570 public static function &export($prefix = FALSE) {
571 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'survey', $prefix, []);
576 * Returns the list of indices
578 * @param bool $localize
582 public static function indices($localize = TRUE) {
584 'UI_activity_type_id' => [
585 'name' => 'UI_activity_type_id',
587 0 => 'activity_type_id',
589 'localizable' => FALSE,
590 'sig' => 'civicrm_survey::0::activity_type_id',
593 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;