Merge pull request #10024 from rnao/fix-mem-cancel-activity
[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:857f3f19bbbb33bf039b6ea95f2097c5)
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 ) ,
221 'domain_id' => array(
222 'name' => 'domain_id',
223 'type' => CRM_Utils_Type::T_INT,
224 'title' => ts('Report Instance Domain ID') ,
225 'description' => 'Which Domain is this instance for',
226 'required' => true,
227 'table_name' => 'civicrm_report_instance',
228 'entity' => 'ReportInstance',
229 'bao' => 'CRM_Report_BAO_ReportInstance',
230 'FKClassName' => 'CRM_Core_DAO_Domain',
231 'pseudoconstant' => array(
232 'table' => 'civicrm_domain',
233 'keyColumn' => 'id',
234 'labelColumn' => 'name',
235 )
236 ) ,
237 'title' => array(
238 'name' => 'title',
239 'type' => CRM_Utils_Type::T_STRING,
240 'title' => ts('Report Instance Title') ,
241 'description' => 'Report Instance Title.',
242 'maxlength' => 255,
243 'size' => CRM_Utils_Type::HUGE,
244 'table_name' => 'civicrm_report_instance',
245 'entity' => 'ReportInstance',
246 'bao' => 'CRM_Report_BAO_ReportInstance',
247 'html' => array(
248 'type' => 'Text',
249 ) ,
250 ) ,
251 'report_id' => array(
252 'name' => 'report_id',
253 'type' => CRM_Utils_Type::T_STRING,
254 'title' => ts('Report template ID') ,
255 'description' => 'FK to civicrm_option_value for the report template',
256 'required' => true,
257 'maxlength' => 64,
258 'size' => CRM_Utils_Type::BIG,
259 'table_name' => 'civicrm_report_instance',
260 'entity' => 'ReportInstance',
261 'bao' => 'CRM_Report_BAO_ReportInstance',
262 'html' => array(
263 'type' => 'Select',
264 ) ,
265 ) ,
266 'name' => array(
267 'name' => 'name',
268 'type' => CRM_Utils_Type::T_STRING,
269 'title' => ts('Report instance Name') ,
270 'description' => 'when combined with report_id/template uniquely identifies the instance',
271 'maxlength' => 255,
272 'size' => CRM_Utils_Type::HUGE,
273 'table_name' => 'civicrm_report_instance',
274 'entity' => 'ReportInstance',
275 'bao' => 'CRM_Report_BAO_ReportInstance',
276 'html' => array(
277 'type' => 'Text',
278 ) ,
279 ) ,
280 'args' => array(
281 'name' => 'args',
282 'type' => CRM_Utils_Type::T_STRING,
283 'title' => ts('Report Instance Arguments') ,
284 'description' => 'arguments that are passed in the url when invoking the instance',
285 'maxlength' => 255,
286 'size' => CRM_Utils_Type::HUGE,
287 'table_name' => 'civicrm_report_instance',
288 'entity' => 'ReportInstance',
289 'bao' => 'CRM_Report_BAO_ReportInstance',
290 'html' => array(
291 'type' => 'Text',
292 ) ,
293 ) ,
294 'description' => array(
295 'name' => 'description',
296 'type' => CRM_Utils_Type::T_STRING,
297 'title' => ts('Report Instance description') ,
298 'description' => 'Report Instance description.',
299 'maxlength' => 255,
300 'size' => CRM_Utils_Type::HUGE,
301 'table_name' => 'civicrm_report_instance',
302 'entity' => 'ReportInstance',
303 'bao' => 'CRM_Report_BAO_ReportInstance',
304 'html' => array(
305 'type' => 'Text',
306 ) ,
307 ) ,
308 'permission' => array(
309 'name' => 'permission',
310 'type' => CRM_Utils_Type::T_STRING,
311 'title' => ts('Report Instance Permissions') ,
312 'description' => 'permission required to be able to run this instance',
313 'maxlength' => 255,
314 'size' => CRM_Utils_Type::HUGE,
315 'table_name' => 'civicrm_report_instance',
316 'entity' => 'ReportInstance',
317 'bao' => 'CRM_Report_BAO_ReportInstance',
318 'html' => array(
319 'type' => 'Text',
320 ) ,
321 ) ,
322 'grouprole' => array(
323 'name' => 'grouprole',
324 'type' => CRM_Utils_Type::T_STRING,
325 'title' => ts('Report Instance Assigned to Roles') ,
326 'description' => 'role required to be able to run this instance',
327 'maxlength' => 1024,
328 'size' => CRM_Utils_Type::HUGE,
329 'table_name' => 'civicrm_report_instance',
330 'entity' => 'ReportInstance',
331 'bao' => 'CRM_Report_BAO_ReportInstance',
332 'html' => array(
333 'type' => 'Text',
334 ) ,
335 ) ,
336 'form_values' => array(
337 'name' => 'form_values',
338 'type' => CRM_Utils_Type::T_TEXT,
339 'title' => ts('Submitted Form Values') ,
340 'description' => 'Submitted form values for this report',
341 'import' => true,
342 'where' => 'civicrm_report_instance.form_values',
343 'headerPattern' => '',
344 'dataPattern' => '',
345 'export' => true,
346 'table_name' => 'civicrm_report_instance',
347 'entity' => 'ReportInstance',
348 'bao' => 'CRM_Report_BAO_ReportInstance',
349 ) ,
350 'is_active' => array(
351 'name' => 'is_active',
352 'type' => CRM_Utils_Type::T_BOOLEAN,
353 'title' => ts('Report Instance is Active') ,
354 'description' => 'Is this entry active?',
355 'table_name' => 'civicrm_report_instance',
356 'entity' => 'ReportInstance',
357 'bao' => 'CRM_Report_BAO_ReportInstance',
358 'html' => array(
359 'type' => 'CheckBox',
360 ) ,
361 ) ,
362 'created_id' => array(
363 'name' => 'created_id',
364 'type' => CRM_Utils_Type::T_INT,
365 'title' => ts('Report Instance Created By') ,
366 'description' => 'FK to contact table.',
367 'table_name' => 'civicrm_report_instance',
368 'entity' => 'ReportInstance',
369 'bao' => 'CRM_Report_BAO_ReportInstance',
370 'FKClassName' => 'CRM_Contact_DAO_Contact',
371 ) ,
372 'owner_id' => array(
373 'name' => 'owner_id',
374 'type' => CRM_Utils_Type::T_INT,
375 'title' => ts('Report Instance Owned By') ,
376 'description' => 'FK to contact table.',
377 'table_name' => 'civicrm_report_instance',
378 'entity' => 'ReportInstance',
379 'bao' => 'CRM_Report_BAO_ReportInstance',
380 'FKClassName' => 'CRM_Contact_DAO_Contact',
381 ) ,
382 'email_subject' => array(
383 'name' => 'email_subject',
384 'type' => CRM_Utils_Type::T_STRING,
385 'title' => ts('Report Instance email Subject') ,
386 'description' => 'Subject of email',
387 'maxlength' => 255,
388 'size' => CRM_Utils_Type::HUGE,
389 'table_name' => 'civicrm_report_instance',
390 'entity' => 'ReportInstance',
391 'bao' => 'CRM_Report_BAO_ReportInstance',
392 'html' => array(
393 'type' => 'Text',
394 ) ,
395 ) ,
396 'email_to' => array(
397 'name' => 'email_to',
398 'type' => CRM_Utils_Type::T_TEXT,
399 'title' => ts('Email Report Instance To') ,
400 'description' => 'comma-separated list of email addresses to send the report to',
401 'table_name' => 'civicrm_report_instance',
402 'entity' => 'ReportInstance',
403 'bao' => 'CRM_Report_BAO_ReportInstance',
404 'html' => array(
405 'type' => 'Text',
406 ) ,
407 ) ,
408 'email_cc' => array(
409 'name' => 'email_cc',
410 'type' => CRM_Utils_Type::T_TEXT,
411 'title' => ts('cc Email Report Instance To') ,
412 'description' => 'comma-separated list of email addresses to send the report to',
413 'table_name' => 'civicrm_report_instance',
414 'entity' => 'ReportInstance',
415 'bao' => 'CRM_Report_BAO_ReportInstance',
416 'html' => array(
417 'type' => 'Text',
418 ) ,
419 ) ,
420 'header' => array(
421 'name' => 'header',
422 'type' => CRM_Utils_Type::T_TEXT,
423 'title' => ts('Report Instance Header') ,
424 'description' => 'comma-separated list of email addresses to send the report to',
425 'rows' => 4,
426 'cols' => 60,
427 'table_name' => 'civicrm_report_instance',
428 'entity' => 'ReportInstance',
429 'bao' => 'CRM_Report_BAO_ReportInstance',
430 'html' => array(
431 'type' => 'TextArea',
432 ) ,
433 ) ,
434 'footer' => array(
435 'name' => 'footer',
436 'type' => CRM_Utils_Type::T_TEXT,
437 'title' => ts('Report Instance Footer') ,
438 'description' => 'comma-separated list of email addresses to send the report to',
439 'rows' => 4,
440 'cols' => 60,
441 'table_name' => 'civicrm_report_instance',
442 'entity' => 'ReportInstance',
443 'bao' => 'CRM_Report_BAO_ReportInstance',
444 'html' => array(
445 'type' => 'TextArea',
446 ) ,
447 ) ,
448 'navigation_id' => array(
449 'name' => 'navigation_id',
450 'type' => CRM_Utils_Type::T_INT,
451 'title' => ts('Navigation ID') ,
452 'description' => 'FK to navigation ID',
453 'import' => true,
454 'where' => 'civicrm_report_instance.navigation_id',
455 'headerPattern' => '',
456 'dataPattern' => '',
457 'export' => true,
458 'table_name' => 'civicrm_report_instance',
459 'entity' => 'ReportInstance',
460 'bao' => 'CRM_Report_BAO_ReportInstance',
461 'FKClassName' => 'CRM_Core_DAO_Navigation',
462 ) ,
463 'drilldown_id' => array(
464 'name' => 'drilldown_id',
465 'type' => CRM_Utils_Type::T_INT,
466 'title' => ts('Drilldown Report ID') ,
467 'description' => 'FK to instance ID drilldown to',
468 'import' => true,
469 'where' => 'civicrm_report_instance.drilldown_id',
470 'headerPattern' => '',
471 'dataPattern' => '',
472 'export' => true,
473 'table_name' => 'civicrm_report_instance',
474 'entity' => 'ReportInstance',
475 'bao' => 'CRM_Report_BAO_ReportInstance',
476 'FKClassName' => 'CRM_Report_DAO_ReportInstance',
477 ) ,
478 'is_reserved' => array(
479 'name' => 'is_reserved',
480 'type' => CRM_Utils_Type::T_BOOLEAN,
481 'title' => ts('Instance is Reserved') ,
482 'table_name' => 'civicrm_report_instance',
483 'entity' => 'ReportInstance',
484 'bao' => 'CRM_Report_BAO_ReportInstance',
485 'html' => array(
486 'type' => 'CheckBox',
487 ) ,
488 ) ,
489 );
490 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
491 }
492 return Civi::$statics[__CLASS__]['fields'];
493 }
494 /**
495 * Return a mapping from field-name to the corresponding key (as used in fields()).
496 *
497 * @return array
498 * Array(string $name => string $uniqueName).
499 */
500 static function &fieldKeys() {
501 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
502 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
503 }
504 return Civi::$statics[__CLASS__]['fieldKeys'];
505 }
506 /**
507 * Returns the names of this table
508 *
509 * @return string
510 */
511 static function getTableName() {
512 return self::$_tableName;
513 }
514 /**
515 * Returns if this table needs to be logged
516 *
517 * @return boolean
518 */
519 function getLog() {
520 return self::$_log;
521 }
522 /**
523 * Returns the list of fields that can be imported
524 *
525 * @param bool $prefix
526 *
527 * @return array
528 */
529 static function &import($prefix = false) {
530 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'report_instance', $prefix, array());
531 return $r;
532 }
533 /**
534 * Returns the list of fields that can be exported
535 *
536 * @param bool $prefix
537 *
538 * @return array
539 */
540 static function &export($prefix = false) {
541 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'report_instance', $prefix, array());
542 return $r;
543 }
544 }