5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Campaign/Survey.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:bf281972fa5b1efaa8801eb9a47e42ae)
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 static $_tableName = 'civicrm_survey';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 'table_name' => 'civicrm_survey',
211 'entity' => 'Survey',
212 'bao' => 'CRM_Campaign_BAO_Survey',
217 'type' => CRM_Utils_Type
::T_STRING
,
218 'title' => ts('Survey Title'),
219 'description' => ts('Title of the Survey.'),
222 'size' => CRM_Utils_Type
::HUGE
,
224 'where' => 'civicrm_survey.title',
225 'headerPattern' => '',
228 'table_name' => 'civicrm_survey',
229 'entity' => 'Survey',
230 'bao' => 'CRM_Campaign_BAO_Survey',
234 'name' => 'campaign_id',
235 'type' => CRM_Utils_Type
::T_INT
,
236 'title' => ts('Survey Campaign ID'),
237 'description' => ts('Foreign key to the Campaign.'),
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',
257 'headerPattern' => '',
261 'table_name' => 'civicrm_survey',
262 'entity' => 'Survey',
263 'bao' => 'CRM_Campaign_BAO_Survey',
268 'pseudoconstant' => [
269 'optionGroupName' => 'activity_type',
270 'optionEditPath' => 'civicrm/admin/options/activity_type',
273 'recontact_interval' => [
274 'name' => 'recontact_interval',
275 'type' => CRM_Utils_Type
::T_TEXT
,
276 'title' => ts('Follow up Interval'),
277 'description' => ts('Recontact intervals for each status.'),
280 'table_name' => 'civicrm_survey',
281 'entity' => 'Survey',
282 'bao' => 'CRM_Campaign_BAO_Survey',
285 'type' => 'TextArea',
289 'name' => 'instructions',
290 'type' => CRM_Utils_Type
::T_TEXT
,
291 'title' => ts('Instructions'),
292 'description' => ts('Script instructions for volunteers to use for the survey.'),
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.'),
309 'table_name' => 'civicrm_survey',
310 'entity' => 'Survey',
311 'bao' => 'CRM_Campaign_BAO_Survey',
314 'max_number_of_contacts' => [
315 'name' => 'max_number_of_contacts',
316 'type' => CRM_Utils_Type
::T_INT
,
317 'title' => ts('Maximum number of contacts'),
318 'description' => ts('Maximum number of contacts to allow for survey.'),
320 'table_name' => 'civicrm_survey',
321 'entity' => 'Survey',
322 'bao' => 'CRM_Campaign_BAO_Survey',
325 'default_number_of_contacts' => [
326 'name' => 'default_number_of_contacts',
327 'type' => CRM_Utils_Type
::T_INT
,
328 'title' => ts('Default number of contacts'),
329 'description' => ts('Default number of contacts to allow for survey.'),
331 'table_name' => 'civicrm_survey',
332 'entity' => 'Survey',
333 'bao' => 'CRM_Campaign_BAO_Survey',
337 'name' => 'is_active',
338 'type' => CRM_Utils_Type
::T_BOOLEAN
,
339 'title' => ts('Survey Is Active'),
340 'description' => ts('Is this survey enabled or disabled/cancelled?'),
342 'table_name' => 'civicrm_survey',
343 'entity' => 'Survey',
344 'bao' => 'CRM_Campaign_BAO_Survey',
348 'name' => 'is_default',
349 'type' => CRM_Utils_Type
::T_BOOLEAN
,
350 'title' => ts('Is Default Survey'),
351 'description' => ts('Is this default survey?'),
353 'table_name' => 'civicrm_survey',
354 'entity' => 'Survey',
355 'bao' => 'CRM_Campaign_BAO_Survey',
359 'name' => 'created_id',
360 'type' => CRM_Utils_Type
::T_INT
,
361 'title' => ts('Survey Created By'),
362 'description' => ts('FK to civicrm_contact, who created this Survey.'),
363 'table_name' => 'civicrm_survey',
364 'entity' => 'Survey',
365 'bao' => 'CRM_Campaign_BAO_Survey',
367 'FKClassName' => 'CRM_Contact_DAO_Contact',
370 'name' => 'created_date',
371 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
372 'title' => ts('Campaign Created Date'),
373 'description' => ts('Date and time that Survey was created.'),
374 'table_name' => 'civicrm_survey',
375 'entity' => 'Survey',
376 'bao' => 'CRM_Campaign_BAO_Survey',
379 'last_modified_id' => [
380 'name' => 'last_modified_id',
381 'type' => CRM_Utils_Type
::T_INT
,
382 'title' => ts('Survey Modified'),
383 'description' => ts('FK to civicrm_contact, who recently edited this Survey.'),
384 'table_name' => 'civicrm_survey',
385 'entity' => 'Survey',
386 'bao' => 'CRM_Campaign_BAO_Survey',
388 'FKClassName' => 'CRM_Contact_DAO_Contact',
390 'last_modified_date' => [
391 'name' => 'last_modified_date',
392 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
393 'title' => ts('Survey Modified On'),
394 'description' => ts('Date and time that Survey was edited last time.'),
395 'table_name' => 'civicrm_survey',
396 'entity' => 'Survey',
397 'bao' => 'CRM_Campaign_BAO_Survey',
401 'name' => 'result_id',
402 'type' => CRM_Utils_Type
::T_INT
,
403 'title' => ts('Survey Result'),
404 'description' => ts('Used to store option group id.'),
406 'table_name' => 'civicrm_survey',
407 'entity' => 'Survey',
408 'bao' => 'CRM_Campaign_BAO_Survey',
411 'bypass_confirm' => [
412 'name' => 'bypass_confirm',
413 'type' => CRM_Utils_Type
::T_BOOLEAN
,
414 'title' => ts('No Email Verification'),
415 'description' => ts('Bypass the email verification.'),
417 'table_name' => 'civicrm_survey',
418 'entity' => 'Survey',
419 'bao' => 'CRM_Campaign_BAO_Survey',
422 'thankyou_title' => [
423 'name' => 'thankyou_title',
424 'type' => CRM_Utils_Type
::T_STRING
,
425 'title' => ts('Thank-you Title'),
426 'description' => ts('Title for Thank-you page (header title tag, and display at the top of the page).'),
428 'size' => CRM_Utils_Type
::HUGE
,
429 'table_name' => 'civicrm_survey',
430 'entity' => 'Survey',
431 'bao' => 'CRM_Campaign_BAO_Survey',
435 'name' => 'thankyou_text',
436 'type' => CRM_Utils_Type
::T_TEXT
,
437 'title' => ts('Thank-you Text'),
438 'description' => ts('text and html allowed. displayed above result on success page'),
441 'table_name' => 'civicrm_survey',
442 'entity' => 'Survey',
443 'bao' => 'CRM_Campaign_BAO_Survey',
446 'type' => 'TextArea',
450 'name' => 'is_share',
451 'type' => CRM_Utils_Type
::T_BOOLEAN
,
452 'title' => ts('Is shared through social media'),
453 'description' => ts('Can people share the petition through social media?'),
455 'table_name' => 'civicrm_survey',
456 'entity' => 'Survey',
457 'bao' => 'CRM_Campaign_BAO_Survey',
461 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
463 return Civi
::$statics[__CLASS__
]['fields'];
467 * Return a mapping from field-name to the corresponding key (as used in fields()).
470 * Array(string $name => string $uniqueName).
472 public static function &fieldKeys() {
473 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
474 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
476 return Civi
::$statics[__CLASS__
]['fieldKeys'];
480 * Returns the names of this table
484 public static function getTableName() {
485 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
489 * Returns if this table needs to be logged
493 public function getLog() {
498 * Returns the list of fields that can be imported
500 * @param bool $prefix
504 public static function &import($prefix = FALSE) {
505 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'survey', $prefix, []);
510 * Returns the list of fields that can be exported
512 * @param bool $prefix
516 public static function &export($prefix = FALSE) {
517 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'survey', $prefix, []);
522 * Returns the list of indices
524 * @param bool $localize
528 public static function indices($localize = TRUE) {
530 'UI_activity_type_id' => [
531 'name' => 'UI_activity_type_id',
533 0 => 'activity_type_id',
535 'localizable' => FALSE,
536 'sig' => 'civicrm_survey::0::activity_type_id',
539 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;