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