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