Merge pull request #22679 from mattwire/dummyreturn
[civicrm-core.git] / CRM / Campaign / DAO / Survey.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Campaign/Survey.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
28979d65 9 * (GenCodeChecksum:d0bc187a5dd2297f5c81a7a84460fc17)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Survey entity.
f41f0342 14 */
e501603b 15class CRM_Campaign_DAO_Survey extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.2';
d31fb4e3 18 const COMPONENT = 'CiviCampaign';
c3fc2621 19
e501603b 20 /**
f41f0342 21 * Static instance to hold the table name.
e501603b
TO
22 *
23 * @var string
24 */
fa45b5b9 25 public static $_tableName = 'civicrm_survey';
c3fc2621 26
449c4e6b
CW
27 /**
28 * Icon associated with this entity.
29 *
30 * @var string
31 */
32 public static $_icon = 'fa-clipboard';
33
8ab43c93
CW
34 /**
35 * Field to show when displaying a record.
36 *
37 * @var string
38 */
39 public static $_labelField = 'title';
40
e501603b 41 /**
f41f0342 42 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 43 *
c3fc2621 44 * @var bool
e501603b 45 */
fa45b5b9 46 public static $_log = FALSE;
c3fc2621 47
e501603b
TO
48 /**
49 * Survey id.
50 *
28979d65
CW
51 * @var int|string|null
52 * (SQL type: int unsigned)
53 * Note that values will be retrieved from the database as a string.
e501603b
TO
54 */
55 public $id;
c3fc2621 56
e501603b
TO
57 /**
58 * Title of the Survey.
59 *
60 * @var string
28979d65
CW
61 * (SQL type: varchar(255))
62 * Note that values will be retrieved from the database as a string.
e501603b
TO
63 */
64 public $title;
c3fc2621 65
e501603b
TO
66 /**
67 * Foreign key to the Campaign.
68 *
28979d65
CW
69 * @var int|string|null
70 * (SQL type: int unsigned)
71 * Note that values will be retrieved from the database as a string.
e501603b
TO
72 */
73 public $campaign_id;
c3fc2621 74
e501603b
TO
75 /**
76 * Implicit FK to civicrm_option_value where option_group = activity_type
77 *
28979d65
CW
78 * @var int|string|null
79 * (SQL type: int unsigned)
80 * Note that values will be retrieved from the database as a string.
e501603b
TO
81 */
82 public $activity_type_id;
c3fc2621 83
e501603b
TO
84 /**
85 * Recontact intervals for each status.
86 *
28979d65
CW
87 * @var string|null
88 * (SQL type: text)
89 * Note that values will be retrieved from the database as a string.
e501603b
TO
90 */
91 public $recontact_interval;
c3fc2621 92
e501603b
TO
93 /**
94 * Script instructions for volunteers to use for the survey.
95 *
28979d65
CW
96 * @var string|null
97 * (SQL type: text)
98 * Note that values will be retrieved from the database as a string.
e501603b
TO
99 */
100 public $instructions;
c3fc2621 101
e501603b
TO
102 /**
103 * Number of days for recurrence of release.
104 *
28979d65
CW
105 * @var int|string|null
106 * (SQL type: int unsigned)
107 * Note that values will be retrieved from the database as a string.
e501603b
TO
108 */
109 public $release_frequency;
c3fc2621 110
e501603b
TO
111 /**
112 * Maximum number of contacts to allow for survey.
113 *
28979d65
CW
114 * @var int|string|null
115 * (SQL type: int unsigned)
116 * Note that values will be retrieved from the database as a string.
e501603b
TO
117 */
118 public $max_number_of_contacts;
c3fc2621 119
e501603b
TO
120 /**
121 * Default number of contacts to allow for survey.
122 *
28979d65
CW
123 * @var int|string|null
124 * (SQL type: int unsigned)
125 * Note that values will be retrieved from the database as a string.
e501603b
TO
126 */
127 public $default_number_of_contacts;
c3fc2621 128
e501603b
TO
129 /**
130 * Is this survey enabled or disabled/cancelled?
131 *
28979d65
CW
132 * @var bool|string|null
133 * (SQL type: tinyint)
134 * Note that values will be retrieved from the database as a string.
e501603b
TO
135 */
136 public $is_active;
c3fc2621 137
e501603b
TO
138 /**
139 * Is this default survey?
140 *
28979d65
CW
141 * @var bool|string|null
142 * (SQL type: tinyint)
143 * Note that values will be retrieved from the database as a string.
e501603b
TO
144 */
145 public $is_default;
c3fc2621 146
e501603b
TO
147 /**
148 * FK to civicrm_contact, who created this Survey.
149 *
28979d65
CW
150 * @var int|string|null
151 * (SQL type: int unsigned)
152 * Note that values will be retrieved from the database as a string.
e501603b
TO
153 */
154 public $created_id;
c3fc2621 155
e501603b
TO
156 /**
157 * Date and time that Survey was created.
158 *
28979d65
CW
159 * @var string|null
160 * (SQL type: datetime)
161 * Note that values will be retrieved from the database as a string.
e501603b
TO
162 */
163 public $created_date;
c3fc2621 164
e501603b
TO
165 /**
166 * FK to civicrm_contact, who recently edited this Survey.
167 *
28979d65
CW
168 * @var int|string|null
169 * (SQL type: int unsigned)
170 * Note that values will be retrieved from the database as a string.
e501603b
TO
171 */
172 public $last_modified_id;
c3fc2621 173
e501603b
TO
174 /**
175 * Date and time that Survey was edited last time.
176 *
28979d65
CW
177 * @var string|null
178 * (SQL type: datetime)
179 * Note that values will be retrieved from the database as a string.
e501603b
TO
180 */
181 public $last_modified_date;
c3fc2621 182
e501603b
TO
183 /**
184 * Used to store option group id.
185 *
28979d65
CW
186 * @var int|string|null
187 * (SQL type: int unsigned)
188 * Note that values will be retrieved from the database as a string.
e501603b
TO
189 */
190 public $result_id;
c3fc2621 191
e501603b
TO
192 /**
193 * Bypass the email verification.
194 *
28979d65
CW
195 * @var bool|string|null
196 * (SQL type: tinyint)
197 * Note that values will be retrieved from the database as a string.
e501603b
TO
198 */
199 public $bypass_confirm;
c3fc2621 200
e501603b
TO
201 /**
202 * Title for Thank-you page (header title tag, and display at the top of the page).
203 *
28979d65
CW
204 * @var string|null
205 * (SQL type: varchar(255))
206 * Note that values will be retrieved from the database as a string.
e501603b
TO
207 */
208 public $thankyou_title;
c3fc2621 209
e501603b
TO
210 /**
211 * text and html allowed. displayed above result on success page
212 *
28979d65
CW
213 * @var string|null
214 * (SQL type: text)
215 * Note that values will be retrieved from the database as a string.
e501603b
TO
216 */
217 public $thankyou_text;
c3fc2621 218
e501603b
TO
219 /**
220 * Can people share the petition through social media?
221 *
28979d65
CW
222 * @var bool|string|null
223 * (SQL type: tinyint)
224 * Note that values will be retrieved from the database as a string.
e501603b
TO
225 */
226 public $is_share;
c3fc2621 227
e501603b 228 /**
f41f0342 229 * Class constructor.
e501603b 230 */
c3fc2621 231 public function __construct() {
e501603b
TO
232 $this->__table = 'civicrm_survey';
233 parent::__construct();
234 }
c3fc2621 235
449c4e6b
CW
236 /**
237 * Returns localized title of this entity.
7b66c3b5
AH
238 *
239 * @param bool $plural
240 * Whether to return the plural version of the title.
449c4e6b 241 */
7b66c3b5
AH
242 public static function getEntityTitle($plural = FALSE) {
243 return $plural ? ts('Surveys') : ts('Survey');
449c4e6b
CW
244 }
245
e501603b 246 /**
f41f0342 247 * Returns foreign keys and entity references.
e501603b
TO
248 *
249 * @return array
250 * [CRM_Core_Reference_Interface]
251 */
c3fc2621 252 public static function getReferenceColumns() {
346aaaba 253 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 254 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
255 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
256 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
257 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'last_modified_id', 'civicrm_contact', 'id');
346aaaba 258 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 259 }
346aaaba 260 return Civi::$statics[__CLASS__]['links'];
e501603b 261 }
c3fc2621 262
e501603b
TO
263 /**
264 * Returns all the column names of this table
265 *
266 * @return array
267 */
c3fc2621 268 public static function &fields() {
346aaaba 269 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
270 Civi::$statics[__CLASS__]['fields'] = [
271 'id' => [
e501603b
TO
272 'name' => 'id',
273 'type' => CRM_Utils_Type::T_INT,
c3fc2621 274 'title' => ts('Survey ID'),
215b423e 275 'description' => ts('Survey id.'),
c3fc2621 276 'required' => TRUE,
a36434b9 277 'where' => 'civicrm_survey.id',
522a26c9 278 'table_name' => 'civicrm_survey',
279 'entity' => 'Survey',
280 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 281 'localizable' => 0,
2cbbebe8
A
282 'html' => [
283 'type' => 'Number',
284 ],
1fe423d6 285 'readonly' => TRUE,
a9d0587b 286 'add' => '3.3',
c3fc2621
CW
287 ],
288 'title' => [
e501603b
TO
289 'name' => 'title',
290 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 291 'title' => ts('Survey Title'),
215b423e 292 'description' => ts('Title of the Survey.'),
c3fc2621 293 'required' => TRUE,
e501603b
TO
294 'maxlength' => 255,
295 'size' => CRM_Utils_Type::HUGE,
c3fc2621 296 'import' => TRUE,
e501603b 297 'where' => 'civicrm_survey.title',
c3fc2621 298 'export' => TRUE,
522a26c9 299 'table_name' => 'civicrm_survey',
300 'entity' => 'Survey',
301 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 302 'localizable' => 1,
a9d0587b 303 'add' => '3.3',
c3fc2621
CW
304 ],
305 'campaign_id' => [
e501603b
TO
306 'name' => 'campaign_id',
307 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 308 'title' => ts('Campaign ID'),
215b423e 309 'description' => ts('Foreign key to the Campaign.'),
a36434b9 310 'where' => 'civicrm_survey.campaign_id',
5fb0de1f 311 'default' => NULL,
522a26c9 312 'table_name' => 'civicrm_survey',
313 'entity' => 'Survey',
314 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 315 'localizable' => 0,
e501603b 316 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
2cbbebe8 317 'html' => [
8813f972 318 'type' => 'EntityRef',
2cbbebe8
A
319 'label' => ts("Campaign"),
320 ],
25ad69f2
CW
321 'pseudoconstant' => [
322 'table' => 'civicrm_campaign',
323 'keyColumn' => 'id',
324 'labelColumn' => 'title',
325 'prefetch' => 'FALSE',
326 ],
a9d0587b 327 'add' => '3.3',
c3fc2621
CW
328 ],
329 'activity_type_id' => [
e501603b
TO
330 'name' => 'activity_type_id',
331 'type' => CRM_Utils_Type::T_INT,
c3fc2621 332 'title' => ts('Activity Type'),
215b423e 333 'description' => ts('Implicit FK to civicrm_option_value where option_group = activity_type'),
c3fc2621 334 'import' => TRUE,
e501603b 335 'where' => 'civicrm_survey.activity_type_id',
c3fc2621 336 'export' => TRUE,
5fb0de1f 337 'default' => NULL,
522a26c9 338 'table_name' => 'civicrm_survey',
339 'entity' => 'Survey',
340 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 341 'localizable' => 0,
c3fc2621 342 'html' => [
e501603b 343 'type' => 'Select',
c3fc2621
CW
344 ],
345 'pseudoconstant' => [
e501603b
TO
346 'optionGroupName' => 'activity_type',
347 'optionEditPath' => 'civicrm/admin/options/activity_type',
e6ca0a57 348 ],
a9d0587b 349 'add' => '3.3',
c3fc2621
CW
350 ],
351 'recontact_interval' => [
e501603b
TO
352 'name' => 'recontact_interval',
353 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 354 'title' => ts('Follow up Interval'),
215b423e 355 'description' => ts('Recontact intervals for each status.'),
e501603b
TO
356 'rows' => 20,
357 'cols' => 80,
a36434b9 358 'where' => 'civicrm_survey.recontact_interval',
522a26c9 359 'table_name' => 'civicrm_survey',
360 'entity' => 'Survey',
361 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 362 'localizable' => 0,
c3fc2621 363 'html' => [
e501603b 364 'type' => 'TextArea',
c3fc2621 365 ],
a9d0587b 366 'add' => '3.3',
c3fc2621
CW
367 ],
368 'instructions' => [
e501603b
TO
369 'name' => 'instructions',
370 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 371 'title' => ts('Instructions'),
215b423e 372 'description' => ts('Script instructions for volunteers to use for the survey.'),
e501603b
TO
373 'rows' => 20,
374 'cols' => 80,
a36434b9 375 'where' => 'civicrm_survey.instructions',
522a26c9 376 'table_name' => 'civicrm_survey',
377 'entity' => 'Survey',
378 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 379 'localizable' => 1,
c3fc2621 380 'html' => [
e501603b 381 'type' => 'TextArea',
c3fc2621 382 ],
a9d0587b 383 'add' => '3.3',
c3fc2621
CW
384 ],
385 'release_frequency' => [
e501603b
TO
386 'name' => 'release_frequency',
387 'type' => CRM_Utils_Type::T_INT,
c3fc2621 388 'title' => ts('Survey Hold Duration'),
215b423e 389 'description' => ts('Number of days for recurrence of release.'),
a36434b9 390 'where' => 'civicrm_survey.release_frequency',
5fb0de1f 391 'default' => NULL,
522a26c9 392 'table_name' => 'civicrm_survey',
393 'entity' => 'Survey',
394 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 395 'localizable' => 0,
a9d0587b 396 'add' => '3.3',
c3fc2621
CW
397 ],
398 'max_number_of_contacts' => [
e501603b
TO
399 'name' => 'max_number_of_contacts',
400 'type' => CRM_Utils_Type::T_INT,
c3fc2621 401 'title' => ts('Maximum number of contacts'),
215b423e 402 'description' => ts('Maximum number of contacts to allow for survey.'),
a36434b9 403 'where' => 'civicrm_survey.max_number_of_contacts',
5fb0de1f 404 'default' => NULL,
522a26c9 405 'table_name' => 'civicrm_survey',
406 'entity' => 'Survey',
407 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 408 'localizable' => 0,
a9d0587b 409 'add' => '3.3',
c3fc2621
CW
410 ],
411 'default_number_of_contacts' => [
e501603b
TO
412 'name' => 'default_number_of_contacts',
413 'type' => CRM_Utils_Type::T_INT,
c3fc2621 414 'title' => ts('Default number of contacts'),
215b423e 415 'description' => ts('Default number of contacts to allow for survey.'),
a36434b9 416 'where' => 'civicrm_survey.default_number_of_contacts',
5fb0de1f 417 'default' => NULL,
522a26c9 418 'table_name' => 'civicrm_survey',
419 'entity' => 'Survey',
420 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 421 'localizable' => 0,
a9d0587b 422 'add' => '3.3',
c3fc2621
CW
423 ],
424 'is_active' => [
e501603b
TO
425 'name' => 'is_active',
426 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 427 'title' => ts('Survey Is Active'),
215b423e 428 'description' => ts('Is this survey enabled or disabled/cancelled?'),
a36434b9 429 'where' => 'civicrm_survey.is_active',
e501603b 430 'default' => '1',
522a26c9 431 'table_name' => 'civicrm_survey',
432 'entity' => 'Survey',
433 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 434 'localizable' => 0,
a9d0587b 435 'add' => '3.3',
c3fc2621
CW
436 ],
437 'is_default' => [
e501603b
TO
438 'name' => 'is_default',
439 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 440 'title' => ts('Is Default Survey'),
215b423e 441 'description' => ts('Is this default survey?'),
a36434b9 442 'where' => 'civicrm_survey.is_default',
45a83e42 443 'default' => '0',
522a26c9 444 'table_name' => 'civicrm_survey',
445 'entity' => 'Survey',
446 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 447 'localizable' => 0,
a9d0587b 448 'add' => '3.3',
c3fc2621
CW
449 ],
450 'created_id' => [
e501603b
TO
451 'name' => 'created_id',
452 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 453 'title' => ts('Created By Contact ID'),
215b423e 454 'description' => ts('FK to civicrm_contact, who created this Survey.'),
a36434b9 455 'where' => 'civicrm_survey.created_id',
522a26c9 456 'table_name' => 'civicrm_survey',
457 'entity' => 'Survey',
458 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 459 'localizable' => 0,
e501603b 460 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
461 'html' => [
462 'label' => ts("Created By"),
463 ],
a9d0587b 464 'add' => '3.3',
c3fc2621
CW
465 ],
466 'created_date' => [
e501603b
TO
467 'name' => 'created_date',
468 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 469 'title' => ts('Campaign Created Date'),
215b423e 470 'description' => ts('Date and time that Survey was created.'),
a36434b9 471 'where' => 'civicrm_survey.created_date',
522a26c9 472 'table_name' => 'civicrm_survey',
473 'entity' => 'Survey',
474 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 475 'localizable' => 0,
a9d0587b 476 'add' => '3.3',
c3fc2621
CW
477 ],
478 'last_modified_id' => [
e501603b
TO
479 'name' => 'last_modified_id',
480 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 481 'title' => ts('Modified By Contact ID'),
215b423e 482 'description' => ts('FK to civicrm_contact, who recently edited this Survey.'),
a36434b9 483 'where' => 'civicrm_survey.last_modified_id',
522a26c9 484 'table_name' => 'civicrm_survey',
485 'entity' => 'Survey',
486 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 487 'localizable' => 0,
e501603b 488 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
489 'html' => [
490 'label' => ts("Modified By"),
491 ],
a9d0587b 492 'add' => '3.3',
c3fc2621
CW
493 ],
494 'last_modified_date' => [
e501603b
TO
495 'name' => 'last_modified_date',
496 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 497 'title' => ts('Survey Modified On'),
215b423e 498 'description' => ts('Date and time that Survey was edited last time.'),
a36434b9 499 'where' => 'civicrm_survey.last_modified_date',
522a26c9 500 'table_name' => 'civicrm_survey',
501 'entity' => 'Survey',
502 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 503 'localizable' => 0,
a9d0587b 504 'add' => '3.3',
c3fc2621
CW
505 ],
506 'result_id' => [
e501603b
TO
507 'name' => 'result_id',
508 'type' => CRM_Utils_Type::T_INT,
c3fc2621 509 'title' => ts('Survey Result'),
215b423e 510 'description' => ts('Used to store option group id.'),
a36434b9 511 'where' => 'civicrm_survey.result_id',
5fb0de1f 512 'default' => NULL,
522a26c9 513 'table_name' => 'civicrm_survey',
514 'entity' => 'Survey',
515 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 516 'localizable' => 0,
223671d0
EM
517 'pseudoconstant' => [
518 'table' => 'civicrm_option_group',
519 'keyColumn' => 'id',
520 'labelColumn' => 'title',
521 'nameColumn' => 'name',
522 'condition' => 'name LIKE "civicrm_survey_%"',
523 ],
a9d0587b 524 'add' => '3.3',
c3fc2621
CW
525 ],
526 'bypass_confirm' => [
e501603b
TO
527 'name' => 'bypass_confirm',
528 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 529 'title' => ts('No Email Verification'),
215b423e 530 'description' => ts('Bypass the email verification.'),
a36434b9 531 'where' => 'civicrm_survey.bypass_confirm',
45a83e42 532 'default' => '0',
522a26c9 533 'table_name' => 'civicrm_survey',
534 'entity' => 'Survey',
535 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 536 'localizable' => 0,
a9d0587b 537 'add' => '4.2',
c3fc2621
CW
538 ],
539 'thankyou_title' => [
e501603b
TO
540 'name' => 'thankyou_title',
541 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 542 'title' => ts('Thank-you Title'),
215b423e 543 'description' => ts('Title for Thank-you page (header title tag, and display at the top of the page).'),
e501603b
TO
544 'maxlength' => 255,
545 'size' => CRM_Utils_Type::HUGE,
a36434b9 546 'where' => 'civicrm_survey.thankyou_title',
522a26c9 547 'table_name' => 'civicrm_survey',
548 'entity' => 'Survey',
549 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 550 'localizable' => 1,
a9d0587b 551 'add' => '4.2',
c3fc2621
CW
552 ],
553 'thankyou_text' => [
e501603b
TO
554 'name' => 'thankyou_text',
555 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 556 'title' => ts('Thank-you Text'),
215b423e 557 'description' => ts('text and html allowed. displayed above result on success page'),
e501603b
TO
558 'rows' => 8,
559 'cols' => 60,
a36434b9 560 'where' => 'civicrm_survey.thankyou_text',
522a26c9 561 'table_name' => 'civicrm_survey',
562 'entity' => 'Survey',
563 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 564 'localizable' => 1,
c3fc2621 565 'html' => [
e501603b 566 'type' => 'TextArea',
c3fc2621 567 ],
a9d0587b 568 'add' => '4.2',
c3fc2621
CW
569 ],
570 'is_share' => [
e501603b
TO
571 'name' => 'is_share',
572 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 573 'title' => ts('Is shared through social media'),
215b423e 574 'description' => ts('Can people share the petition through social media?'),
a36434b9 575 'where' => 'civicrm_survey.is_share',
e501603b 576 'default' => '1',
522a26c9 577 'table_name' => 'civicrm_survey',
578 'entity' => 'Survey',
579 'bao' => 'CRM_Campaign_BAO_Survey',
6a7e5e5d 580 'localizable' => 0,
a9d0587b 581 'add' => '4.4',
c3fc2621
CW
582 ],
583 ];
346aaaba 584 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 585 }
346aaaba 586 return Civi::$statics[__CLASS__]['fields'];
e501603b 587 }
c3fc2621 588
e501603b 589 /**
bd8e0b14 590 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
591 *
592 * @return array
bd8e0b14 593 * Array(string $name => string $uniqueName).
e501603b 594 */
c3fc2621 595 public static function &fieldKeys() {
bd8e0b14
TO
596 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
597 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 598 }
bd8e0b14 599 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 600 }
c3fc2621 601
e501603b
TO
602 /**
603 * Returns the names of this table
604 *
605 * @return string
606 */
c3fc2621 607 public static function getTableName() {
e501603b
TO
608 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
609 }
c3fc2621 610
e501603b
TO
611 /**
612 * Returns if this table needs to be logged
613 *
c3fc2621 614 * @return bool
e501603b 615 */
c3fc2621 616 public function getLog() {
e501603b
TO
617 return self::$_log;
618 }
c3fc2621 619
e501603b
TO
620 /**
621 * Returns the list of fields that can be imported
622 *
623 * @param bool $prefix
624 *
625 * @return array
626 */
c3fc2621
CW
627 public static function &import($prefix = FALSE) {
628 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'survey', $prefix, []);
60808919 629 return $r;
e501603b 630 }
c3fc2621 631
e501603b
TO
632 /**
633 * Returns the list of fields that can be exported
634 *
635 * @param bool $prefix
636 *
637 * @return array
638 */
c3fc2621
CW
639 public static function &export($prefix = FALSE) {
640 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'survey', $prefix, []);
60808919 641 return $r;
e501603b 642 }
c3fc2621 643
e7a6b91a
AS
644 /**
645 * Returns the list of indices
c3fc2621
CW
646 *
647 * @param bool $localize
648 *
649 * @return array
e7a6b91a
AS
650 */
651 public static function indices($localize = TRUE) {
c3fc2621
CW
652 $indices = [
653 'UI_activity_type_id' => [
e7a6b91a 654 'name' => 'UI_activity_type_id',
c3fc2621 655 'field' => [
e7a6b91a 656 0 => 'activity_type_id',
c3fc2621
CW
657 ],
658 'localizable' => FALSE,
e7a6b91a 659 'sig' => 'civicrm_survey::0::activity_type_id',
c3fc2621
CW
660 ],
661 ];
e7a6b91a
AS
662 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
663 }
c3fc2621 664
e501603b 665}