Merge pull request #19496 from colemanw/afformBugFixes
[civicrm-core.git] / CRM / Report / DAO / ReportInstance.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/Report/ReportInstance.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
8ab43c93 9 * (GenCodeChecksum:e60478dd772b18e57443ff1cd0d1c72e)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the ReportInstance entity.
f41f0342 14 */
e501603b 15class CRM_Report_DAO_ReportInstance extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '2.2';
d31fb4e3 18 const COMPONENT = 'CiviReport';
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_report_instance';
c3fc2621 26
449c4e6b
CW
27 /**
28 * Icon associated with this entity.
29 *
30 * @var string
31 */
32 public static $_icon = 'fa-bar-chart';
33
e501603b 34 /**
f41f0342 35 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 36 *
c3fc2621 37 * @var bool
e501603b 38 */
fa45b5b9 39 public static $_log = FALSE;
c3fc2621 40
e501603b
TO
41 /**
42 * Report Instance ID
43 *
e6ca0a57 44 * @var int
e501603b
TO
45 */
46 public $id;
c3fc2621 47
e501603b
TO
48 /**
49 * Which Domain is this instance for
50 *
e6ca0a57 51 * @var int
e501603b
TO
52 */
53 public $domain_id;
c3fc2621 54
e501603b
TO
55 /**
56 * Report Instance Title.
57 *
58 * @var string
59 */
60 public $title;
c3fc2621 61
e501603b
TO
62 /**
63 * FK to civicrm_option_value for the report template
64 *
65 * @var string
66 */
67 public $report_id;
c3fc2621 68
e501603b
TO
69 /**
70 * when combined with report_id/template uniquely identifies the instance
71 *
72 * @var string
73 */
74 public $name;
c3fc2621 75
e501603b
TO
76 /**
77 * arguments that are passed in the url when invoking the instance
78 *
79 * @var string
80 */
81 public $args;
c3fc2621 82
e501603b
TO
83 /**
84 * Report Instance description.
85 *
86 * @var string
87 */
88 public $description;
c3fc2621 89
e501603b
TO
90 /**
91 * permission required to be able to run this instance
92 *
93 * @var string
94 */
95 public $permission;
c3fc2621 96
e501603b
TO
97 /**
98 * role required to be able to run this instance
99 *
100 * @var string
101 */
102 public $grouprole;
c3fc2621 103
e501603b
TO
104 /**
105 * Submitted form values for this report
106 *
b31aa78e 107 * @var longtext
e501603b
TO
108 */
109 public $form_values;
c3fc2621 110
e501603b
TO
111 /**
112 * Is this entry active?
113 *
e6ca0a57 114 * @var bool
e501603b
TO
115 */
116 public $is_active;
c3fc2621 117
e501603b
TO
118 /**
119 * FK to contact table.
120 *
e6ca0a57 121 * @var int
e501603b
TO
122 */
123 public $created_id;
c3fc2621 124
e501603b
TO
125 /**
126 * FK to contact table.
127 *
e6ca0a57 128 * @var int
e501603b
TO
129 */
130 public $owner_id;
c3fc2621 131
e501603b
TO
132 /**
133 * Subject of email
134 *
135 * @var string
136 */
137 public $email_subject;
c3fc2621 138
e501603b
TO
139 /**
140 * comma-separated list of email addresses to send the report to
141 *
142 * @var text
143 */
144 public $email_to;
c3fc2621 145
e501603b
TO
146 /**
147 * comma-separated list of email addresses to send the report to
148 *
149 * @var text
150 */
151 public $email_cc;
c3fc2621 152
e501603b
TO
153 /**
154 * comma-separated list of email addresses to send the report to
155 *
156 * @var text
157 */
158 public $header;
c3fc2621 159
e501603b
TO
160 /**
161 * comma-separated list of email addresses to send the report to
162 *
163 * @var text
164 */
165 public $footer;
c3fc2621 166
e501603b
TO
167 /**
168 * FK to navigation ID
169 *
e6ca0a57 170 * @var int
e501603b
TO
171 */
172 public $navigation_id;
c3fc2621 173
e501603b
TO
174 /**
175 * FK to instance ID drilldown to
176 *
e6ca0a57 177 * @var int
e501603b
TO
178 */
179 public $drilldown_id;
c3fc2621 180
e501603b 181 /**
e6ca0a57 182 * @var bool
e501603b
TO
183 */
184 public $is_reserved;
c3fc2621 185
e501603b 186 /**
f41f0342 187 * Class constructor.
e501603b 188 */
c3fc2621 189 public function __construct() {
e501603b
TO
190 $this->__table = 'civicrm_report_instance';
191 parent::__construct();
192 }
c3fc2621 193
e501603b 194 /**
449c4e6b 195 * Returns localized title of this entity.
7b66c3b5
AH
196 *
197 * @param bool $plural
198 * Whether to return the plural version of the title.
449c4e6b 199 */
7b66c3b5
AH
200 public static function getEntityTitle($plural = FALSE) {
201 return $plural ? ts('Reports') : ts('Report');
449c4e6b
CW
202 }
203
204 /**
f41f0342 205 * Returns foreign keys and entity references.
e501603b
TO
206 *
207 * @return array
208 * [CRM_Core_Reference_Interface]
209 */
c3fc2621 210 public static function getReferenceColumns() {
346aaaba 211 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 212 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
213 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
214 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
215 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'owner_id', 'civicrm_contact', 'id');
216 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'navigation_id', 'civicrm_navigation', 'id');
217 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'drilldown_id', 'civicrm_report_instance', 'id');
346aaaba 218 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 219 }
346aaaba 220 return Civi::$statics[__CLASS__]['links'];
e501603b 221 }
c3fc2621 222
e501603b
TO
223 /**
224 * Returns all the column names of this table
225 *
226 * @return array
227 */
c3fc2621 228 public static function &fields() {
346aaaba 229 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
230 Civi::$statics[__CLASS__]['fields'] = [
231 'id' => [
e501603b
TO
232 'name' => 'id',
233 'type' => CRM_Utils_Type::T_INT,
c3fc2621 234 'title' => ts('Report Instance ID'),
215b423e 235 'description' => ts('Report Instance ID'),
c3fc2621 236 'required' => TRUE,
a36434b9 237 'where' => 'civicrm_report_instance.id',
522a26c9 238 'table_name' => 'civicrm_report_instance',
239 'entity' => 'ReportInstance',
240 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 241 'localizable' => 0,
a9d0587b 242 'add' => '2.2',
c3fc2621
CW
243 ],
244 'domain_id' => [
e501603b
TO
245 'name' => 'domain_id',
246 'type' => CRM_Utils_Type::T_INT,
c3fc2621 247 'title' => ts('Report Instance Domain ID'),
215b423e 248 'description' => ts('Which Domain is this instance for'),
c3fc2621 249 'required' => TRUE,
a36434b9 250 'where' => 'civicrm_report_instance.domain_id',
522a26c9 251 'table_name' => 'civicrm_report_instance',
252 'entity' => 'ReportInstance',
253 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 254 'localizable' => 0,
e501603b 255 'FKClassName' => 'CRM_Core_DAO_Domain',
c3fc2621 256 'pseudoconstant' => [
e501603b
TO
257 'table' => 'civicrm_domain',
258 'keyColumn' => 'id',
259 'labelColumn' => 'name',
e6ca0a57 260 ],
a9d0587b 261 'add' => '3.1',
c3fc2621
CW
262 ],
263 'title' => [
e501603b
TO
264 'name' => 'title',
265 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 266 'title' => ts('Report Instance Title'),
215b423e 267 'description' => ts('Report Instance Title.'),
e501603b
TO
268 'maxlength' => 255,
269 'size' => CRM_Utils_Type::HUGE,
a36434b9 270 'where' => 'civicrm_report_instance.title',
522a26c9 271 'table_name' => 'civicrm_report_instance',
272 'entity' => 'ReportInstance',
273 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 274 'localizable' => 0,
c3fc2621 275 'html' => [
e501603b 276 'type' => 'Text',
c3fc2621 277 ],
a9d0587b 278 'add' => '2.2',
c3fc2621
CW
279 ],
280 'report_id' => [
e501603b
TO
281 'name' => 'report_id',
282 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 283 'title' => ts('Report template ID'),
215b423e 284 'description' => ts('FK to civicrm_option_value for the report template'),
c3fc2621 285 'required' => TRUE,
1435405e
SL
286 'maxlength' => 512,
287 'size' => CRM_Utils_Type::HUGE,
a36434b9 288 'where' => 'civicrm_report_instance.report_id',
522a26c9 289 'table_name' => 'civicrm_report_instance',
290 'entity' => 'ReportInstance',
291 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 292 'localizable' => 0,
c3fc2621 293 'html' => [
e501603b 294 'type' => 'Select',
c3fc2621 295 ],
a9d0587b 296 'add' => '2.2',
c3fc2621
CW
297 ],
298 'name' => [
e501603b
TO
299 'name' => 'name',
300 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 301 'title' => ts('Report instance Name'),
215b423e 302 'description' => ts('when combined with report_id/template uniquely identifies the instance'),
e501603b
TO
303 'maxlength' => 255,
304 'size' => CRM_Utils_Type::HUGE,
a36434b9 305 'where' => 'civicrm_report_instance.name',
522a26c9 306 'table_name' => 'civicrm_report_instance',
307 'entity' => 'ReportInstance',
308 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 309 'localizable' => 0,
c3fc2621 310 'html' => [
e501603b 311 'type' => 'Text',
c3fc2621 312 ],
a9d0587b 313 'add' => '3.2',
c3fc2621
CW
314 ],
315 'args' => [
e501603b
TO
316 'name' => 'args',
317 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 318 'title' => ts('Report Instance Arguments'),
215b423e 319 'description' => ts('arguments that are passed in the url when invoking the instance'),
e501603b
TO
320 'maxlength' => 255,
321 'size' => CRM_Utils_Type::HUGE,
a36434b9 322 'where' => 'civicrm_report_instance.args',
522a26c9 323 'table_name' => 'civicrm_report_instance',
324 'entity' => 'ReportInstance',
325 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 326 'localizable' => 0,
c3fc2621 327 'html' => [
e501603b 328 'type' => 'Text',
c3fc2621 329 ],
a9d0587b 330 'add' => '3.2',
c3fc2621
CW
331 ],
332 'description' => [
e501603b
TO
333 'name' => 'description',
334 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 335 'title' => ts('Report Instance description'),
215b423e 336 'description' => ts('Report Instance description.'),
e501603b
TO
337 'maxlength' => 255,
338 'size' => CRM_Utils_Type::HUGE,
a36434b9 339 'where' => 'civicrm_report_instance.description',
522a26c9 340 'table_name' => 'civicrm_report_instance',
341 'entity' => 'ReportInstance',
342 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 343 'localizable' => 0,
c3fc2621 344 'html' => [
e501603b 345 'type' => 'Text',
c3fc2621 346 ],
a9d0587b 347 'add' => '2.2',
c3fc2621
CW
348 ],
349 'permission' => [
e501603b
TO
350 'name' => 'permission',
351 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 352 'title' => ts('Report Instance Permissions'),
215b423e 353 'description' => ts('permission required to be able to run this instance'),
e501603b
TO
354 'maxlength' => 255,
355 'size' => CRM_Utils_Type::HUGE,
a36434b9 356 'where' => 'civicrm_report_instance.permission',
522a26c9 357 'table_name' => 'civicrm_report_instance',
358 'entity' => 'ReportInstance',
359 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 360 'localizable' => 0,
c3fc2621 361 'html' => [
e501603b 362 'type' => 'Text',
c3fc2621 363 ],
a9d0587b 364 'add' => '2.2',
c3fc2621
CW
365 ],
366 'grouprole' => [
e501603b
TO
367 'name' => 'grouprole',
368 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 369 'title' => ts('Report Instance Assigned to Roles'),
215b423e 370 'description' => ts('role required to be able to run this instance'),
e501603b
TO
371 'maxlength' => 1024,
372 'size' => CRM_Utils_Type::HUGE,
a36434b9 373 'where' => 'civicrm_report_instance.grouprole',
522a26c9 374 'table_name' => 'civicrm_report_instance',
375 'entity' => 'ReportInstance',
376 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 377 'localizable' => 0,
c3fc2621 378 'html' => [
e501603b 379 'type' => 'Text',
c3fc2621 380 ],
a9d0587b 381 'add' => '4.1',
c3fc2621
CW
382 ],
383 'form_values' => [
e501603b 384 'name' => 'form_values',
b31aa78e 385 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 386 'title' => ts('Submitted Form Values'),
215b423e 387 'description' => ts('Submitted form values for this report'),
c3fc2621 388 'import' => TRUE,
e501603b 389 'where' => 'civicrm_report_instance.form_values',
c3fc2621 390 'export' => TRUE,
522a26c9 391 'table_name' => 'civicrm_report_instance',
392 'entity' => 'ReportInstance',
393 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 394 'localizable' => 0,
2a5c9b4d 395 'serialize' => self::SERIALIZE_PHP,
a9d0587b 396 'add' => '2.2',
c3fc2621
CW
397 ],
398 'is_active' => [
e501603b
TO
399 'name' => 'is_active',
400 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 401 'title' => ts('Report Instance is Active'),
215b423e 402 'description' => ts('Is this entry active?'),
a36434b9 403 'where' => 'civicrm_report_instance.is_active',
522a26c9 404 'table_name' => 'civicrm_report_instance',
405 'entity' => 'ReportInstance',
406 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 407 'localizable' => 0,
c3fc2621 408 'html' => [
e501603b 409 'type' => 'CheckBox',
c3fc2621 410 ],
a9d0587b 411 'add' => '2.2',
c3fc2621
CW
412 ],
413 'created_id' => [
e501603b
TO
414 'name' => 'created_id',
415 'type' => CRM_Utils_Type::T_INT,
c3fc2621 416 'title' => ts('Report Instance Created By'),
215b423e 417 'description' => ts('FK to contact table.'),
a36434b9 418 'where' => 'civicrm_report_instance.created_id',
522a26c9 419 'table_name' => 'civicrm_report_instance',
420 'entity' => 'ReportInstance',
421 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 422 'localizable' => 0,
e501603b 423 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 424 'add' => '4.6',
c3fc2621
CW
425 ],
426 'owner_id' => [
e501603b
TO
427 'name' => 'owner_id',
428 'type' => CRM_Utils_Type::T_INT,
c3fc2621 429 'title' => ts('Report Instance Owned By'),
215b423e 430 'description' => ts('FK to contact table.'),
a36434b9 431 'where' => 'civicrm_report_instance.owner_id',
522a26c9 432 'table_name' => 'civicrm_report_instance',
433 'entity' => 'ReportInstance',
434 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 435 'localizable' => 0,
e501603b 436 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 437 'add' => '4.6',
c3fc2621
CW
438 ],
439 'email_subject' => [
e501603b
TO
440 'name' => 'email_subject',
441 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 442 'title' => ts('Report Instance email Subject'),
215b423e 443 'description' => ts('Subject of email'),
e501603b
TO
444 'maxlength' => 255,
445 'size' => CRM_Utils_Type::HUGE,
a36434b9 446 'where' => 'civicrm_report_instance.email_subject',
522a26c9 447 'table_name' => 'civicrm_report_instance',
448 'entity' => 'ReportInstance',
449 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 450 'localizable' => 0,
c3fc2621 451 'html' => [
e501603b 452 'type' => 'Text',
c3fc2621 453 ],
a9d0587b 454 'add' => NULL,
c3fc2621
CW
455 ],
456 'email_to' => [
e501603b
TO
457 'name' => 'email_to',
458 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 459 'title' => ts('Email Report Instance To'),
215b423e 460 'description' => ts('comma-separated list of email addresses to send the report to'),
a36434b9 461 'where' => 'civicrm_report_instance.email_to',
522a26c9 462 'table_name' => 'civicrm_report_instance',
463 'entity' => 'ReportInstance',
464 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 465 'localizable' => 0,
c3fc2621 466 'html' => [
e501603b 467 'type' => 'Text',
c3fc2621 468 ],
a9d0587b 469 'add' => '2.2',
c3fc2621
CW
470 ],
471 'email_cc' => [
e501603b
TO
472 'name' => 'email_cc',
473 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 474 'title' => ts('cc Email Report Instance To'),
215b423e 475 'description' => ts('comma-separated list of email addresses to send the report to'),
a36434b9 476 'where' => 'civicrm_report_instance.email_cc',
522a26c9 477 'table_name' => 'civicrm_report_instance',
478 'entity' => 'ReportInstance',
479 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 480 'localizable' => 0,
c3fc2621 481 'html' => [
e501603b 482 'type' => 'Text',
c3fc2621 483 ],
a9d0587b 484 'add' => '2.2',
c3fc2621
CW
485 ],
486 'header' => [
e501603b
TO
487 'name' => 'header',
488 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 489 'title' => ts('Report Instance Header'),
215b423e 490 'description' => ts('comma-separated list of email addresses to send the report to'),
e501603b
TO
491 'rows' => 4,
492 'cols' => 60,
a36434b9 493 'where' => 'civicrm_report_instance.header',
522a26c9 494 'table_name' => 'civicrm_report_instance',
495 'entity' => 'ReportInstance',
496 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 497 'localizable' => 0,
c3fc2621 498 'html' => [
e501603b 499 'type' => 'TextArea',
c3fc2621 500 ],
a9d0587b 501 'add' => '2.2',
c3fc2621
CW
502 ],
503 'footer' => [
e501603b
TO
504 'name' => 'footer',
505 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 506 'title' => ts('Report Instance Footer'),
215b423e 507 'description' => ts('comma-separated list of email addresses to send the report to'),
e501603b
TO
508 'rows' => 4,
509 'cols' => 60,
a36434b9 510 'where' => 'civicrm_report_instance.footer',
522a26c9 511 'table_name' => 'civicrm_report_instance',
512 'entity' => 'ReportInstance',
513 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 514 'localizable' => 0,
c3fc2621 515 'html' => [
e501603b 516 'type' => 'TextArea',
c3fc2621 517 ],
a9d0587b 518 'add' => '2.2',
c3fc2621
CW
519 ],
520 'navigation_id' => [
e501603b
TO
521 'name' => 'navigation_id',
522 'type' => CRM_Utils_Type::T_INT,
c3fc2621 523 'title' => ts('Navigation ID'),
215b423e 524 'description' => ts('FK to navigation ID'),
c3fc2621 525 'import' => TRUE,
e501603b 526 'where' => 'civicrm_report_instance.navigation_id',
c3fc2621 527 'export' => TRUE,
522a26c9 528 'table_name' => 'civicrm_report_instance',
529 'entity' => 'ReportInstance',
530 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 531 'localizable' => 0,
e501603b 532 'FKClassName' => 'CRM_Core_DAO_Navigation',
a9d0587b 533 'add' => '3.0',
c3fc2621
CW
534 ],
535 'drilldown_id' => [
e501603b
TO
536 'name' => 'drilldown_id',
537 'type' => CRM_Utils_Type::T_INT,
c3fc2621 538 'title' => ts('Drilldown Report ID'),
215b423e 539 'description' => ts('FK to instance ID drilldown to'),
c3fc2621 540 'import' => TRUE,
e501603b 541 'where' => 'civicrm_report_instance.drilldown_id',
c3fc2621 542 'export' => TRUE,
522a26c9 543 'table_name' => 'civicrm_report_instance',
544 'entity' => 'ReportInstance',
545 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 546 'localizable' => 0,
e501603b 547 'FKClassName' => 'CRM_Report_DAO_ReportInstance',
a9d0587b 548 'add' => '4.3',
c3fc2621
CW
549 ],
550 'is_reserved' => [
e501603b
TO
551 'name' => 'is_reserved',
552 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 553 'title' => ts('Instance is Reserved'),
a36434b9 554 'where' => 'civicrm_report_instance.is_reserved',
45a83e42 555 'default' => '0',
522a26c9 556 'table_name' => 'civicrm_report_instance',
557 'entity' => 'ReportInstance',
558 'bao' => 'CRM_Report_BAO_ReportInstance',
6a7e5e5d 559 'localizable' => 0,
c3fc2621 560 'html' => [
e501603b 561 'type' => 'CheckBox',
c3fc2621 562 ],
a9d0587b 563 'add' => '4.2',
c3fc2621
CW
564 ],
565 ];
346aaaba 566 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 567 }
346aaaba 568 return Civi::$statics[__CLASS__]['fields'];
e501603b 569 }
c3fc2621 570
e501603b 571 /**
bd8e0b14 572 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
573 *
574 * @return array
bd8e0b14 575 * Array(string $name => string $uniqueName).
e501603b 576 */
c3fc2621 577 public static function &fieldKeys() {
bd8e0b14
TO
578 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
579 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 580 }
bd8e0b14 581 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 582 }
c3fc2621 583
e501603b
TO
584 /**
585 * Returns the names of this table
586 *
587 * @return string
588 */
c3fc2621 589 public static function getTableName() {
e501603b
TO
590 return self::$_tableName;
591 }
c3fc2621 592
e501603b
TO
593 /**
594 * Returns if this table needs to be logged
595 *
c3fc2621 596 * @return bool
e501603b 597 */
c3fc2621 598 public function getLog() {
e501603b
TO
599 return self::$_log;
600 }
c3fc2621 601
e501603b
TO
602 /**
603 * Returns the list of fields that can be imported
604 *
605 * @param bool $prefix
606 *
607 * @return array
608 */
c3fc2621
CW
609 public static function &import($prefix = FALSE) {
610 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'report_instance', $prefix, []);
60808919 611 return $r;
e501603b 612 }
c3fc2621 613
e501603b
TO
614 /**
615 * Returns the list of fields that can be exported
616 *
617 * @param bool $prefix
618 *
619 * @return array
620 */
c3fc2621
CW
621 public static function &export($prefix = FALSE) {
622 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'report_instance', $prefix, []);
60808919 623 return $r;
e501603b 624 }
c3fc2621 625
e7a6b91a
AS
626 /**
627 * Returns the list of indices
c3fc2621
CW
628 *
629 * @param bool $localize
630 *
631 * @return array
e7a6b91a
AS
632 */
633 public static function indices($localize = TRUE) {
c3fc2621 634 $indices = [];
e7a6b91a
AS
635 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
636 }
c3fc2621 637
e501603b 638}