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