Merge branch 'CRM-20460' into CRM-20460-4.7
[civicrm-core.git] / CRM / Report / DAO / ReportInstance.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27 /**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Report/ReportInstance.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:e28abdd2a3696c4a6072dfbfd4f54d68)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Report_DAO_ReportInstance constructor.
39 */
40 class CRM_Report_DAO_ReportInstance extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_report_instance';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 * Report Instance ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Which Domain is this instance for
61 *
62 * @var int unsigned
63 */
64 public $domain_id;
65 /**
66 * Report Instance Title.
67 *
68 * @var string
69 */
70 public $title;
71 /**
72 * FK to civicrm_option_value for the report template
73 *
74 * @var string
75 */
76 public $report_id;
77 /**
78 * when combined with report_id/template uniquely identifies the instance
79 *
80 * @var string
81 */
82 public $name;
83 /**
84 * arguments that are passed in the url when invoking the instance
85 *
86 * @var string
87 */
88 public $args;
89 /**
90 * Report Instance description.
91 *
92 * @var string
93 */
94 public $description;
95 /**
96 * permission required to be able to run this instance
97 *
98 * @var string
99 */
100 public $permission;
101 /**
102 * role required to be able to run this instance
103 *
104 * @var string
105 */
106 public $grouprole;
107 /**
108 * Submitted form values for this report
109 *
110 * @var text
111 */
112 public $form_values;
113 /**
114 * Is this entry active?
115 *
116 * @var boolean
117 */
118 public $is_active;
119 /**
120 * FK to contact table.
121 *
122 * @var int unsigned
123 */
124 public $created_id;
125 /**
126 * FK to contact table.
127 *
128 * @var int unsigned
129 */
130 public $owner_id;
131 /**
132 * Subject of email
133 *
134 * @var string
135 */
136 public $email_subject;
137 /**
138 * comma-separated list of email addresses to send the report to
139 *
140 * @var text
141 */
142 public $email_to;
143 /**
144 * comma-separated list of email addresses to send the report to
145 *
146 * @var text
147 */
148 public $email_cc;
149 /**
150 * comma-separated list of email addresses to send the report to
151 *
152 * @var text
153 */
154 public $header;
155 /**
156 * comma-separated list of email addresses to send the report to
157 *
158 * @var text
159 */
160 public $footer;
161 /**
162 * FK to navigation ID
163 *
164 * @var int unsigned
165 */
166 public $navigation_id;
167 /**
168 * FK to instance ID drilldown to
169 *
170 * @var int unsigned
171 */
172 public $drilldown_id;
173 /**
174 *
175 * @var boolean
176 */
177 public $is_reserved;
178 /**
179 * Class constructor.
180 */
181 function __construct() {
182 $this->__table = 'civicrm_report_instance';
183 parent::__construct();
184 }
185 /**
186 * Returns foreign keys and entity references.
187 *
188 * @return array
189 * [CRM_Core_Reference_Interface]
190 */
191 static function getReferenceColumns() {
192 if (!isset(Civi::$statics[__CLASS__]['links'])) {
193 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
194 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
195 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id');
196 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'owner_id', 'civicrm_contact', 'id');
197 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'navigation_id', 'civicrm_navigation', 'id');
198 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'drilldown_id', 'civicrm_report_instance', 'id');
199 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
200 }
201 return Civi::$statics[__CLASS__]['links'];
202 }
203 /**
204 * Returns all the column names of this table
205 *
206 * @return array
207 */
208 static function &fields() {
209 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
210 Civi::$statics[__CLASS__]['fields'] = array(
211 'id' => array(
212 'name' => 'id',
213 'type' => CRM_Utils_Type::T_INT,
214 'title' => ts('Report Instance ID') ,
215 'description' => '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' => array(
223 'name' => 'domain_id',
224 'type' => CRM_Utils_Type::T_INT,
225 'title' => ts('Report Instance Domain ID') ,
226 'description' => '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' => array(
234 'table' => 'civicrm_domain',
235 'keyColumn' => 'id',
236 'labelColumn' => 'name',
237 )
238 ) ,
239 'title' => array(
240 'name' => 'title',
241 'type' => CRM_Utils_Type::T_STRING,
242 'title' => ts('Report Instance Title') ,
243 'description' => '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' => array(
251 'type' => 'Text',
252 ) ,
253 ) ,
254 'report_id' => array(
255 'name' => 'report_id',
256 'type' => CRM_Utils_Type::T_STRING,
257 'title' => ts('Report template ID') ,
258 'description' => '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' => array(
267 'type' => 'Select',
268 ) ,
269 ) ,
270 'name' => array(
271 'name' => 'name',
272 'type' => CRM_Utils_Type::T_STRING,
273 'title' => ts('Report instance Name') ,
274 'description' => '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' => array(
282 'type' => 'Text',
283 ) ,
284 ) ,
285 'args' => array(
286 'name' => 'args',
287 'type' => CRM_Utils_Type::T_STRING,
288 'title' => ts('Report Instance Arguments') ,
289 'description' => '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' => array(
297 'type' => 'Text',
298 ) ,
299 ) ,
300 'description' => array(
301 'name' => 'description',
302 'type' => CRM_Utils_Type::T_STRING,
303 'title' => ts('Report Instance description') ,
304 'description' => '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' => array(
312 'type' => 'Text',
313 ) ,
314 ) ,
315 'permission' => array(
316 'name' => 'permission',
317 'type' => CRM_Utils_Type::T_STRING,
318 'title' => ts('Report Instance Permissions') ,
319 'description' => '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' => array(
327 'type' => 'Text',
328 ) ,
329 ) ,
330 'grouprole' => array(
331 'name' => 'grouprole',
332 'type' => CRM_Utils_Type::T_STRING,
333 'title' => ts('Report Instance Assigned to Roles') ,
334 'description' => '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' => array(
342 'type' => 'Text',
343 ) ,
344 ) ,
345 'form_values' => array(
346 'name' => 'form_values',
347 'type' => CRM_Utils_Type::T_TEXT,
348 'title' => ts('Submitted Form Values') ,
349 'description' => '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 ) ,
360 'is_active' => array(
361 'name' => 'is_active',
362 'type' => CRM_Utils_Type::T_BOOLEAN,
363 'title' => ts('Report Instance is Active') ,
364 'description' => 'Is this entry active?',
365 'table_name' => 'civicrm_report_instance',
366 'entity' => 'ReportInstance',
367 'bao' => 'CRM_Report_BAO_ReportInstance',
368 'localizable' => 0,
369 'html' => array(
370 'type' => 'CheckBox',
371 ) ,
372 ) ,
373 'created_id' => array(
374 'name' => 'created_id',
375 'type' => CRM_Utils_Type::T_INT,
376 'title' => ts('Report Instance Created By') ,
377 'description' => 'FK to contact table.',
378 'table_name' => 'civicrm_report_instance',
379 'entity' => 'ReportInstance',
380 'bao' => 'CRM_Report_BAO_ReportInstance',
381 'localizable' => 0,
382 'FKClassName' => 'CRM_Contact_DAO_Contact',
383 ) ,
384 'owner_id' => array(
385 'name' => 'owner_id',
386 'type' => CRM_Utils_Type::T_INT,
387 'title' => ts('Report Instance Owned By') ,
388 'description' => 'FK to contact table.',
389 'table_name' => 'civicrm_report_instance',
390 'entity' => 'ReportInstance',
391 'bao' => 'CRM_Report_BAO_ReportInstance',
392 'localizable' => 0,
393 'FKClassName' => 'CRM_Contact_DAO_Contact',
394 ) ,
395 'email_subject' => array(
396 'name' => 'email_subject',
397 'type' => CRM_Utils_Type::T_STRING,
398 'title' => ts('Report Instance email Subject') ,
399 'description' => 'Subject of email',
400 'maxlength' => 255,
401 'size' => CRM_Utils_Type::HUGE,
402 'table_name' => 'civicrm_report_instance',
403 'entity' => 'ReportInstance',
404 'bao' => 'CRM_Report_BAO_ReportInstance',
405 'localizable' => 0,
406 'html' => array(
407 'type' => 'Text',
408 ) ,
409 ) ,
410 'email_to' => array(
411 'name' => 'email_to',
412 'type' => CRM_Utils_Type::T_TEXT,
413 'title' => ts('Email Report Instance To') ,
414 'description' => 'comma-separated list of email addresses to send the report to',
415 'table_name' => 'civicrm_report_instance',
416 'entity' => 'ReportInstance',
417 'bao' => 'CRM_Report_BAO_ReportInstance',
418 'localizable' => 0,
419 'html' => array(
420 'type' => 'Text',
421 ) ,
422 ) ,
423 'email_cc' => array(
424 'name' => 'email_cc',
425 'type' => CRM_Utils_Type::T_TEXT,
426 'title' => ts('cc Email Report Instance To') ,
427 'description' => 'comma-separated list of email addresses to send the report to',
428 'table_name' => 'civicrm_report_instance',
429 'entity' => 'ReportInstance',
430 'bao' => 'CRM_Report_BAO_ReportInstance',
431 'localizable' => 0,
432 'html' => array(
433 'type' => 'Text',
434 ) ,
435 ) ,
436 'header' => array(
437 'name' => 'header',
438 'type' => CRM_Utils_Type::T_TEXT,
439 'title' => ts('Report Instance Header') ,
440 'description' => 'comma-separated list of email addresses to send the report to',
441 'rows' => 4,
442 'cols' => 60,
443 'table_name' => 'civicrm_report_instance',
444 'entity' => 'ReportInstance',
445 'bao' => 'CRM_Report_BAO_ReportInstance',
446 'localizable' => 0,
447 'html' => array(
448 'type' => 'TextArea',
449 ) ,
450 ) ,
451 'footer' => array(
452 'name' => 'footer',
453 'type' => CRM_Utils_Type::T_TEXT,
454 'title' => ts('Report Instance Footer') ,
455 'description' => 'comma-separated list of email addresses to send the report to',
456 'rows' => 4,
457 'cols' => 60,
458 'table_name' => 'civicrm_report_instance',
459 'entity' => 'ReportInstance',
460 'bao' => 'CRM_Report_BAO_ReportInstance',
461 'localizable' => 0,
462 'html' => array(
463 'type' => 'TextArea',
464 ) ,
465 ) ,
466 'navigation_id' => array(
467 'name' => 'navigation_id',
468 'type' => CRM_Utils_Type::T_INT,
469 'title' => ts('Navigation ID') ,
470 'description' => 'FK to navigation ID',
471 'import' => true,
472 'where' => 'civicrm_report_instance.navigation_id',
473 'headerPattern' => '',
474 'dataPattern' => '',
475 'export' => true,
476 'table_name' => 'civicrm_report_instance',
477 'entity' => 'ReportInstance',
478 'bao' => 'CRM_Report_BAO_ReportInstance',
479 'localizable' => 0,
480 'FKClassName' => 'CRM_Core_DAO_Navigation',
481 ) ,
482 'drilldown_id' => array(
483 'name' => 'drilldown_id',
484 'type' => CRM_Utils_Type::T_INT,
485 'title' => ts('Drilldown Report ID') ,
486 'description' => 'FK to instance ID drilldown to',
487 'import' => true,
488 'where' => 'civicrm_report_instance.drilldown_id',
489 'headerPattern' => '',
490 'dataPattern' => '',
491 'export' => true,
492 'table_name' => 'civicrm_report_instance',
493 'entity' => 'ReportInstance',
494 'bao' => 'CRM_Report_BAO_ReportInstance',
495 'localizable' => 0,
496 'FKClassName' => 'CRM_Report_DAO_ReportInstance',
497 ) ,
498 'is_reserved' => array(
499 'name' => 'is_reserved',
500 'type' => CRM_Utils_Type::T_BOOLEAN,
501 'title' => ts('Instance is Reserved') ,
502 'table_name' => 'civicrm_report_instance',
503 'entity' => 'ReportInstance',
504 'bao' => 'CRM_Report_BAO_ReportInstance',
505 'localizable' => 0,
506 'html' => array(
507 'type' => 'CheckBox',
508 ) ,
509 ) ,
510 );
511 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
512 }
513 return Civi::$statics[__CLASS__]['fields'];
514 }
515 /**
516 * Return a mapping from field-name to the corresponding key (as used in fields()).
517 *
518 * @return array
519 * Array(string $name => string $uniqueName).
520 */
521 static function &fieldKeys() {
522 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
523 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
524 }
525 return Civi::$statics[__CLASS__]['fieldKeys'];
526 }
527 /**
528 * Returns the names of this table
529 *
530 * @return string
531 */
532 static function getTableName() {
533 return self::$_tableName;
534 }
535 /**
536 * Returns if this table needs to be logged
537 *
538 * @return boolean
539 */
540 function getLog() {
541 return self::$_log;
542 }
543 /**
544 * Returns the list of fields that can be imported
545 *
546 * @param bool $prefix
547 *
548 * @return array
549 */
550 static function &import($prefix = false) {
551 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'report_instance', $prefix, array());
552 return $r;
553 }
554 /**
555 * Returns the list of fields that can be exported
556 *
557 * @param bool $prefix
558 *
559 * @return array
560 */
561 static function &export($prefix = false) {
562 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'report_instance', $prefix, array());
563 return $r;
564 }
565 /**
566 * Returns the list of indices
567 */
568 public static function indices($localize = TRUE) {
569 $indices = array();
570 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
571 }
572 }