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:f70f5daefce7003cb9325af0740c447d)
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;
49 * Which Domain is this instance for
56 * Report Instance Title.
63 * FK to civicrm_option_value for the report template
70 * when combined with report_id/template uniquely identifies the instance
77 * arguments that are passed in the url when invoking the instance
84 * Report Instance description.
91 * permission required to be able to run this instance
98 * role required to be able to run this instance
105 * Submitted form values for this report
112 * Is this entry active?
119 * FK to contact table.
126 * FK to contact table.
137 public $email_subject;
140 * comma-separated list of email addresses to send the report to
147 * comma-separated list of email addresses to send the report to
154 * comma-separated list of email addresses to send the report to
161 * comma-separated list of email addresses to send the report to
168 * FK to navigation ID
172 public $navigation_id;
175 * FK to instance ID drilldown to
179 public $drilldown_id;
189 public function __construct() {
190 $this->__table
= 'civicrm_report_instance';
191 parent
::__construct();
195 * Returns localized title of this entity.
197 * @param bool $plural
198 * Whether to return the plural version of the title.
200 public static function getEntityTitle($plural = FALSE) {
201 return $plural ?
ts('Reports') : ts('Report');
205 * Returns foreign keys and entity references.
208 * [CRM_Core_Reference_Interface]
210 public static function getReferenceColumns() {
211 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
212 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
213 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
214 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
215 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'owner_id', 'civicrm_contact', 'id');
216 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'navigation_id', 'civicrm_navigation', 'id');
217 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'drilldown_id', 'civicrm_report_instance', 'id');
218 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
220 return Civi
::$statics[__CLASS__
]['links'];
224 * Returns all the column names of this table
228 public static function &fields() {
229 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
230 Civi
::$statics[__CLASS__
]['fields'] = [
233 'type' => CRM_Utils_Type
::T_INT
,
234 'title' => ts('Report Instance ID'),
235 'description' => ts('Report Instance ID'),
237 'where' => 'civicrm_report_instance.id',
238 'table_name' => 'civicrm_report_instance',
239 'entity' => 'ReportInstance',
240 'bao' => 'CRM_Report_BAO_ReportInstance',
249 'name' => 'domain_id',
250 'type' => CRM_Utils_Type
::T_INT
,
251 'title' => ts('Domain ID'),
252 'description' => ts('Which Domain is this instance for'),
254 'where' => 'civicrm_report_instance.domain_id',
255 'table_name' => 'civicrm_report_instance',
256 'entity' => 'ReportInstance',
257 'bao' => 'CRM_Report_BAO_ReportInstance',
259 'FKClassName' => 'CRM_Core_DAO_Domain',
261 'label' => ts("Domain"),
263 'pseudoconstant' => [
264 'table' => 'civicrm_domain',
266 'labelColumn' => 'name',
272 'type' => CRM_Utils_Type
::T_STRING
,
273 'title' => ts('Report Instance Title'),
274 'description' => ts('Report Instance Title.'),
276 'size' => CRM_Utils_Type
::HUGE
,
277 'where' => 'civicrm_report_instance.title',
278 'table_name' => 'civicrm_report_instance',
279 'entity' => 'ReportInstance',
280 'bao' => 'CRM_Report_BAO_ReportInstance',
288 'name' => 'report_id',
289 'type' => CRM_Utils_Type
::T_STRING
,
290 'title' => ts('Report template ID'),
291 'description' => ts('FK to civicrm_option_value for the report template'),
294 'size' => CRM_Utils_Type
::HUGE
,
295 'where' => 'civicrm_report_instance.report_id',
296 'table_name' => 'civicrm_report_instance',
297 'entity' => 'ReportInstance',
298 'bao' => 'CRM_Report_BAO_ReportInstance',
307 'type' => CRM_Utils_Type
::T_STRING
,
308 'title' => ts('Report instance Name'),
309 'description' => ts('when combined with report_id/template uniquely identifies the instance'),
311 'size' => CRM_Utils_Type
::HUGE
,
312 'where' => 'civicrm_report_instance.name',
313 'table_name' => 'civicrm_report_instance',
314 'entity' => 'ReportInstance',
315 'bao' => 'CRM_Report_BAO_ReportInstance',
324 'type' => CRM_Utils_Type
::T_STRING
,
325 'title' => ts('Report Instance Arguments'),
326 'description' => ts('arguments that are passed in the url when invoking the instance'),
328 'size' => CRM_Utils_Type
::HUGE
,
329 'where' => 'civicrm_report_instance.args',
330 'table_name' => 'civicrm_report_instance',
331 'entity' => 'ReportInstance',
332 'bao' => 'CRM_Report_BAO_ReportInstance',
340 'name' => 'description',
341 'type' => CRM_Utils_Type
::T_STRING
,
342 'title' => ts('Report Instance description'),
343 'description' => ts('Report Instance description.'),
345 'size' => CRM_Utils_Type
::HUGE
,
346 'where' => 'civicrm_report_instance.description',
347 'table_name' => 'civicrm_report_instance',
348 'entity' => 'ReportInstance',
349 'bao' => 'CRM_Report_BAO_ReportInstance',
357 'name' => 'permission',
358 'type' => CRM_Utils_Type
::T_STRING
,
359 'title' => ts('Report Instance Permissions'),
360 'description' => ts('permission required to be able to run this instance'),
362 'size' => CRM_Utils_Type
::HUGE
,
363 'where' => 'civicrm_report_instance.permission',
364 'table_name' => 'civicrm_report_instance',
365 'entity' => 'ReportInstance',
366 'bao' => 'CRM_Report_BAO_ReportInstance',
374 'name' => 'grouprole',
375 'type' => CRM_Utils_Type
::T_STRING
,
376 'title' => ts('Report Instance Assigned to Roles'),
377 'description' => ts('role required to be able to run this instance'),
379 'size' => CRM_Utils_Type
::HUGE
,
380 'where' => 'civicrm_report_instance.grouprole',
381 'table_name' => 'civicrm_report_instance',
382 'entity' => 'ReportInstance',
383 'bao' => 'CRM_Report_BAO_ReportInstance',
391 'name' => 'form_values',
392 'type' => CRM_Utils_Type
::T_LONGTEXT
,
393 'title' => ts('Submitted Form Values'),
394 'description' => ts('Submitted form values for this report'),
396 'where' => 'civicrm_report_instance.form_values',
398 'table_name' => 'civicrm_report_instance',
399 'entity' => 'ReportInstance',
400 'bao' => 'CRM_Report_BAO_ReportInstance',
402 'serialize' => self
::SERIALIZE_PHP
,
406 'name' => 'is_active',
407 'type' => CRM_Utils_Type
::T_BOOLEAN
,
408 'title' => ts('Report Instance is Active'),
409 'description' => ts('Is this entry active?'),
410 'where' => 'civicrm_report_instance.is_active',
411 'table_name' => 'civicrm_report_instance',
412 'entity' => 'ReportInstance',
413 'bao' => 'CRM_Report_BAO_ReportInstance',
416 'type' => 'CheckBox',
421 'name' => 'created_id',
422 'type' => CRM_Utils_Type
::T_INT
,
423 'title' => ts('Created By Contact ID'),
424 'description' => ts('FK to contact table.'),
425 'where' => 'civicrm_report_instance.created_id',
426 'table_name' => 'civicrm_report_instance',
427 'entity' => 'ReportInstance',
428 'bao' => 'CRM_Report_BAO_ReportInstance',
430 'FKClassName' => 'CRM_Contact_DAO_Contact',
432 'label' => ts("Created By"),
437 'name' => 'owner_id',
438 'type' => CRM_Utils_Type
::T_INT
,
439 'title' => ts('Owned By Contact ID'),
440 'description' => ts('FK to contact table.'),
441 'where' => 'civicrm_report_instance.owner_id',
442 'table_name' => 'civicrm_report_instance',
443 'entity' => 'ReportInstance',
444 'bao' => 'CRM_Report_BAO_ReportInstance',
446 'FKClassName' => 'CRM_Contact_DAO_Contact',
448 'label' => ts("Owned By"),
453 'name' => 'email_subject',
454 'type' => CRM_Utils_Type
::T_STRING
,
455 'title' => ts('Report Instance email Subject'),
456 'description' => ts('Subject of email'),
458 'size' => CRM_Utils_Type
::HUGE
,
459 'where' => 'civicrm_report_instance.email_subject',
460 'table_name' => 'civicrm_report_instance',
461 'entity' => 'ReportInstance',
462 'bao' => 'CRM_Report_BAO_ReportInstance',
470 'name' => 'email_to',
471 'type' => CRM_Utils_Type
::T_TEXT
,
472 'title' => ts('Email Report Instance To'),
473 'description' => ts('comma-separated list of email addresses to send the report to'),
474 'where' => 'civicrm_report_instance.email_to',
475 'table_name' => 'civicrm_report_instance',
476 'entity' => 'ReportInstance',
477 'bao' => 'CRM_Report_BAO_ReportInstance',
485 'name' => 'email_cc',
486 'type' => CRM_Utils_Type
::T_TEXT
,
487 'title' => ts('cc Email Report Instance To'),
488 'description' => ts('comma-separated list of email addresses to send the report to'),
489 'where' => 'civicrm_report_instance.email_cc',
490 'table_name' => 'civicrm_report_instance',
491 'entity' => 'ReportInstance',
492 'bao' => 'CRM_Report_BAO_ReportInstance',
501 'type' => CRM_Utils_Type
::T_TEXT
,
502 'title' => ts('Report Instance Header'),
503 'description' => ts('comma-separated list of email addresses to send the report to'),
506 'where' => 'civicrm_report_instance.header',
507 'table_name' => 'civicrm_report_instance',
508 'entity' => 'ReportInstance',
509 'bao' => 'CRM_Report_BAO_ReportInstance',
512 'type' => 'TextArea',
518 'type' => CRM_Utils_Type
::T_TEXT
,
519 'title' => ts('Report Instance Footer'),
520 'description' => ts('comma-separated list of email addresses to send the report to'),
523 'where' => 'civicrm_report_instance.footer',
524 'table_name' => 'civicrm_report_instance',
525 'entity' => 'ReportInstance',
526 'bao' => 'CRM_Report_BAO_ReportInstance',
529 'type' => 'TextArea',
534 'name' => 'navigation_id',
535 'type' => CRM_Utils_Type
::T_INT
,
536 'title' => ts('Navigation ID'),
537 'description' => ts('FK to navigation ID'),
539 'where' => 'civicrm_report_instance.navigation_id',
541 'table_name' => 'civicrm_report_instance',
542 'entity' => 'ReportInstance',
543 'bao' => 'CRM_Report_BAO_ReportInstance',
545 'FKClassName' => 'CRM_Core_DAO_Navigation',
547 'label' => ts("Navigation"),
552 'name' => 'drilldown_id',
553 'type' => CRM_Utils_Type
::T_INT
,
554 'title' => ts('Drilldown Report ID'),
555 'description' => ts('FK to instance ID drilldown to'),
557 'where' => 'civicrm_report_instance.drilldown_id',
559 'table_name' => 'civicrm_report_instance',
560 'entity' => 'ReportInstance',
561 'bao' => 'CRM_Report_BAO_ReportInstance',
563 'FKClassName' => 'CRM_Report_DAO_ReportInstance',
565 'label' => ts("Drilldown Report"),
570 'name' => 'is_reserved',
571 'type' => CRM_Utils_Type
::T_BOOLEAN
,
572 'title' => ts('Instance is Reserved'),
573 'where' => 'civicrm_report_instance.is_reserved',
575 'table_name' => 'civicrm_report_instance',
576 'entity' => 'ReportInstance',
577 'bao' => 'CRM_Report_BAO_ReportInstance',
580 'type' => 'CheckBox',
585 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
587 return Civi
::$statics[__CLASS__
]['fields'];
591 * Return a mapping from field-name to the corresponding key (as used in fields()).
594 * Array(string $name => string $uniqueName).
596 public static function &fieldKeys() {
597 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
598 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
600 return Civi
::$statics[__CLASS__
]['fieldKeys'];
604 * Returns the names of this table
608 public static function getTableName() {
609 return self
::$_tableName;
613 * Returns if this table needs to be logged
617 public function getLog() {
622 * Returns the list of fields that can be imported
624 * @param bool $prefix
628 public static function &import($prefix = FALSE) {
629 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'report_instance', $prefix, []);
634 * Returns the list of fields that can be exported
636 * @param bool $prefix
640 public static function &export($prefix = FALSE) {
641 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'report_instance', $prefix, []);
646 * Returns the list of indices
648 * @param bool $localize
652 public static function indices($localize = TRUE) {
654 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;