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