5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Report/ReportInstance.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:588c8712caae98e6765ac8ed21c9e6b2)
13 * Database access object for the ReportInstance entity.
15 class CRM_Report_DAO_ReportInstance
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '2.2';
18 const COMPONENT
= 'CiviReport';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_report_instance';
28 * Icon associated with this entity.
32 public static $_icon = 'fa-bar-chart';
35 * Should CiviCRM log any modifications to this table in the civicrm_log table.
39 public static $_log = FALSE;
44 * @var int|string|null
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
51 * Which Domain is this instance for
54 * (SQL type: int unsigned)
55 * Note that values will be retrieved from the database as a string.
60 * Report Instance Title.
63 * (SQL type: varchar(255))
64 * Note that values will be retrieved from the database as a string.
69 * FK to civicrm_option_value for the report template
72 * (SQL type: varchar(512))
73 * Note that values will be retrieved from the database as a string.
78 * when combined with report_id/template uniquely identifies the instance
81 * (SQL type: varchar(255))
82 * Note that values will be retrieved from the database as a string.
87 * arguments that are passed in the url when invoking the instance
90 * (SQL type: varchar(255))
91 * Note that values will be retrieved from the database as a string.
96 * Report Instance description.
99 * (SQL type: varchar(255))
100 * Note that values will be retrieved from the database as a string.
105 * permission required to be able to run this instance
108 * (SQL type: varchar(255))
109 * Note that values will be retrieved from the database as a string.
114 * role required to be able to run this instance
117 * (SQL type: varchar(1024))
118 * Note that values will be retrieved from the database as a string.
123 * Submitted form values for this report
126 * (SQL type: longtext)
127 * Note that values will be retrieved from the database as a string.
132 * Is this entry active?
135 * (SQL type: tinyint)
136 * Note that values will be retrieved from the database as a string.
141 * FK to contact table.
143 * @var int|string|null
144 * (SQL type: int unsigned)
145 * Note that values will be retrieved from the database as a string.
150 * FK to contact table.
152 * @var int|string|null
153 * (SQL type: int unsigned)
154 * Note that values will be retrieved from the database as a string.
162 * (SQL type: varchar(255))
163 * Note that values will be retrieved from the database as a string.
165 public $email_subject;
168 * comma-separated list of email addresses to send the report to
172 * Note that values will be retrieved from the database as a string.
177 * comma-separated list of email addresses to send the report to
181 * Note that values will be retrieved from the database as a string.
186 * comma-separated list of email addresses to send the report to
190 * Note that values will be retrieved from the database as a string.
195 * comma-separated list of email addresses to send the report to
199 * Note that values will be retrieved from the database as a string.
204 * FK to navigation ID
206 * @var int|string|null
207 * (SQL type: int unsigned)
208 * Note that values will be retrieved from the database as a string.
210 public $navigation_id;
213 * FK to instance ID drilldown to
215 * @var int|string|null
216 * (SQL type: int unsigned)
217 * Note that values will be retrieved from the database as a string.
219 public $drilldown_id;
223 * (SQL type: tinyint)
224 * Note that values will be retrieved from the database as a string.
231 public function __construct() {
232 $this->__table
= 'civicrm_report_instance';
233 parent
::__construct();
237 * Returns localized title of this entity.
239 * @param bool $plural
240 * Whether to return the plural version of the title.
242 public static function getEntityTitle($plural = FALSE) {
243 return $plural ?
ts('Reports') : ts('Report');
247 * Returns foreign keys and entity references.
250 * [CRM_Core_Reference_Interface]
252 public static function getReferenceColumns() {
253 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
254 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
255 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
256 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
257 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'owner_id', 'civicrm_contact', 'id');
258 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'navigation_id', 'civicrm_navigation', 'id');
259 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'drilldown_id', 'civicrm_report_instance', 'id');
260 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
262 return Civi
::$statics[__CLASS__
]['links'];
266 * Returns all the column names of this table
270 public static function &fields() {
271 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
272 Civi
::$statics[__CLASS__
]['fields'] = [
275 'type' => CRM_Utils_Type
::T_INT
,
276 'title' => ts('Report Instance ID'),
277 'description' => ts('Report Instance ID'),
279 'where' => 'civicrm_report_instance.id',
280 'table_name' => 'civicrm_report_instance',
281 'entity' => 'ReportInstance',
282 'bao' => 'CRM_Report_BAO_ReportInstance',
291 'name' => 'domain_id',
292 'type' => CRM_Utils_Type
::T_INT
,
293 'title' => ts('Domain ID'),
294 'description' => ts('Which Domain is this instance for'),
296 'where' => 'civicrm_report_instance.domain_id',
297 'table_name' => 'civicrm_report_instance',
298 'entity' => 'ReportInstance',
299 'bao' => 'CRM_Report_BAO_ReportInstance',
301 'FKClassName' => 'CRM_Core_DAO_Domain',
303 'label' => ts("Domain"),
305 'pseudoconstant' => [
306 'table' => 'civicrm_domain',
308 'labelColumn' => 'name',
314 'type' => CRM_Utils_Type
::T_STRING
,
315 'title' => ts('Report Instance Title'),
316 'description' => ts('Report Instance Title.'),
318 'size' => CRM_Utils_Type
::HUGE
,
319 'where' => 'civicrm_report_instance.title',
320 'table_name' => 'civicrm_report_instance',
321 'entity' => 'ReportInstance',
322 'bao' => 'CRM_Report_BAO_ReportInstance',
330 'name' => 'report_id',
331 'type' => CRM_Utils_Type
::T_STRING
,
332 'title' => ts('Report template ID'),
333 'description' => ts('FK to civicrm_option_value for the report template'),
336 'size' => CRM_Utils_Type
::HUGE
,
337 'where' => 'civicrm_report_instance.report_id',
338 'table_name' => 'civicrm_report_instance',
339 'entity' => 'ReportInstance',
340 'bao' => 'CRM_Report_BAO_ReportInstance',
349 'type' => CRM_Utils_Type
::T_STRING
,
350 'title' => ts('Report instance Name'),
351 'description' => ts('when combined with report_id/template uniquely identifies the instance'),
353 'size' => CRM_Utils_Type
::HUGE
,
354 'where' => 'civicrm_report_instance.name',
355 'table_name' => 'civicrm_report_instance',
356 'entity' => 'ReportInstance',
357 'bao' => 'CRM_Report_BAO_ReportInstance',
366 'type' => CRM_Utils_Type
::T_STRING
,
367 'title' => ts('Report Instance Arguments'),
368 'description' => ts('arguments that are passed in the url when invoking the instance'),
370 'size' => CRM_Utils_Type
::HUGE
,
371 'where' => 'civicrm_report_instance.args',
372 'table_name' => 'civicrm_report_instance',
373 'entity' => 'ReportInstance',
374 'bao' => 'CRM_Report_BAO_ReportInstance',
382 'name' => 'description',
383 'type' => CRM_Utils_Type
::T_STRING
,
384 'title' => ts('Report Instance description'),
385 'description' => ts('Report Instance description.'),
387 'size' => CRM_Utils_Type
::HUGE
,
388 'where' => 'civicrm_report_instance.description',
389 'table_name' => 'civicrm_report_instance',
390 'entity' => 'ReportInstance',
391 'bao' => 'CRM_Report_BAO_ReportInstance',
399 'name' => 'permission',
400 'type' => CRM_Utils_Type
::T_STRING
,
401 'title' => ts('Report Instance Permissions'),
402 'description' => ts('permission required to be able to run this instance'),
404 'size' => CRM_Utils_Type
::HUGE
,
405 'where' => 'civicrm_report_instance.permission',
406 'table_name' => 'civicrm_report_instance',
407 'entity' => 'ReportInstance',
408 'bao' => 'CRM_Report_BAO_ReportInstance',
416 'name' => 'grouprole',
417 'type' => CRM_Utils_Type
::T_STRING
,
418 'title' => ts('Report Instance Assigned to Roles'),
419 'description' => ts('role required to be able to run this instance'),
421 'size' => CRM_Utils_Type
::HUGE
,
422 'where' => 'civicrm_report_instance.grouprole',
423 'table_name' => 'civicrm_report_instance',
424 'entity' => 'ReportInstance',
425 'bao' => 'CRM_Report_BAO_ReportInstance',
433 'name' => 'form_values',
434 'type' => CRM_Utils_Type
::T_LONGTEXT
,
435 'title' => ts('Submitted Form Values'),
436 'description' => ts('Submitted form values for this report'),
438 'where' => 'civicrm_report_instance.form_values',
440 'table_name' => 'civicrm_report_instance',
441 'entity' => 'ReportInstance',
442 'bao' => 'CRM_Report_BAO_ReportInstance',
444 'serialize' => self
::SERIALIZE_PHP
,
448 'name' => 'is_active',
449 'type' => CRM_Utils_Type
::T_BOOLEAN
,
450 'title' => ts('Report Instance is Active'),
451 'description' => ts('Is this entry active?'),
453 'where' => 'civicrm_report_instance.is_active',
455 'table_name' => 'civicrm_report_instance',
456 'entity' => 'ReportInstance',
457 'bao' => 'CRM_Report_BAO_ReportInstance',
460 'type' => 'CheckBox',
465 'name' => 'created_id',
466 'type' => CRM_Utils_Type
::T_INT
,
467 'title' => ts('Created By Contact ID'),
468 'description' => ts('FK to contact table.'),
469 'where' => 'civicrm_report_instance.created_id',
470 'table_name' => 'civicrm_report_instance',
471 'entity' => 'ReportInstance',
472 'bao' => 'CRM_Report_BAO_ReportInstance',
474 'FKClassName' => 'CRM_Contact_DAO_Contact',
476 'label' => ts("Created By"),
481 'name' => 'owner_id',
482 'type' => CRM_Utils_Type
::T_INT
,
483 'title' => ts('Owned By Contact ID'),
484 'description' => ts('FK to contact table.'),
485 'where' => 'civicrm_report_instance.owner_id',
486 'table_name' => 'civicrm_report_instance',
487 'entity' => 'ReportInstance',
488 'bao' => 'CRM_Report_BAO_ReportInstance',
490 'FKClassName' => 'CRM_Contact_DAO_Contact',
492 'label' => ts("Owned By"),
497 'name' => 'email_subject',
498 'type' => CRM_Utils_Type
::T_STRING
,
499 'title' => ts('Report Instance email Subject'),
500 'description' => ts('Subject of email'),
502 'size' => CRM_Utils_Type
::HUGE
,
503 'where' => 'civicrm_report_instance.email_subject',
504 'table_name' => 'civicrm_report_instance',
505 'entity' => 'ReportInstance',
506 'bao' => 'CRM_Report_BAO_ReportInstance',
514 'name' => 'email_to',
515 'type' => CRM_Utils_Type
::T_TEXT
,
516 'title' => ts('Email Report Instance To'),
517 'description' => ts('comma-separated list of email addresses to send the report to'),
518 'where' => 'civicrm_report_instance.email_to',
519 'table_name' => 'civicrm_report_instance',
520 'entity' => 'ReportInstance',
521 'bao' => 'CRM_Report_BAO_ReportInstance',
529 'name' => 'email_cc',
530 'type' => CRM_Utils_Type
::T_TEXT
,
531 'title' => ts('cc Email Report Instance To'),
532 'description' => ts('comma-separated list of email addresses to send the report to'),
533 'where' => 'civicrm_report_instance.email_cc',
534 'table_name' => 'civicrm_report_instance',
535 'entity' => 'ReportInstance',
536 'bao' => 'CRM_Report_BAO_ReportInstance',
545 'type' => CRM_Utils_Type
::T_TEXT
,
546 'title' => ts('Report Instance Header'),
547 'description' => ts('comma-separated list of email addresses to send the report to'),
550 'where' => 'civicrm_report_instance.header',
551 'table_name' => 'civicrm_report_instance',
552 'entity' => 'ReportInstance',
553 'bao' => 'CRM_Report_BAO_ReportInstance',
556 'type' => 'TextArea',
562 'type' => CRM_Utils_Type
::T_TEXT
,
563 'title' => ts('Report Instance Footer'),
564 'description' => ts('comma-separated list of email addresses to send the report to'),
567 'where' => 'civicrm_report_instance.footer',
568 'table_name' => 'civicrm_report_instance',
569 'entity' => 'ReportInstance',
570 'bao' => 'CRM_Report_BAO_ReportInstance',
573 'type' => 'TextArea',
578 'name' => 'navigation_id',
579 'type' => CRM_Utils_Type
::T_INT
,
580 'title' => ts('Navigation ID'),
581 'description' => ts('FK to navigation ID'),
583 'where' => 'civicrm_report_instance.navigation_id',
585 'table_name' => 'civicrm_report_instance',
586 'entity' => 'ReportInstance',
587 'bao' => 'CRM_Report_BAO_ReportInstance',
589 'FKClassName' => 'CRM_Core_DAO_Navigation',
591 'label' => ts("Navigation"),
596 'name' => 'drilldown_id',
597 'type' => CRM_Utils_Type
::T_INT
,
598 'title' => ts('Drilldown Report ID'),
599 'description' => ts('FK to instance ID drilldown to'),
601 'where' => 'civicrm_report_instance.drilldown_id',
603 'table_name' => 'civicrm_report_instance',
604 'entity' => 'ReportInstance',
605 'bao' => 'CRM_Report_BAO_ReportInstance',
607 'FKClassName' => 'CRM_Report_DAO_ReportInstance',
609 'label' => ts("Drilldown Report"),
614 'name' => 'is_reserved',
615 'type' => CRM_Utils_Type
::T_BOOLEAN
,
616 'title' => ts('Instance is Reserved'),
618 'where' => 'civicrm_report_instance.is_reserved',
620 'table_name' => 'civicrm_report_instance',
621 'entity' => 'ReportInstance',
622 'bao' => 'CRM_Report_BAO_ReportInstance',
625 'type' => 'CheckBox',
630 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
632 return Civi
::$statics[__CLASS__
]['fields'];
636 * Return a mapping from field-name to the corresponding key (as used in fields()).
639 * Array(string $name => string $uniqueName).
641 public static function &fieldKeys() {
642 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
643 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
645 return Civi
::$statics[__CLASS__
]['fieldKeys'];
649 * Returns the names of this table
653 public static function getTableName() {
654 return self
::$_tableName;
658 * Returns if this table needs to be logged
662 public function getLog() {
667 * Returns the list of fields that can be imported
669 * @param bool $prefix
673 public static function &import($prefix = FALSE) {
674 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'report_instance', $prefix, []);
679 * Returns the list of fields that can be exported
681 * @param bool $prefix
685 public static function &export($prefix = FALSE) {
686 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'report_instance', $prefix, []);
691 * Returns the list of indices
693 * @param bool $localize
697 public static function indices($localize = TRUE) {
699 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;