Merge pull request #23981 from eileenmcnaughton/act_seq
[civicrm-core.git] / Civi / Report / OutputHandlerInterface.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11 namespace Civi\Report;
12
13 /**
14 * @package Civi\Report
15 */
16 interface OutputHandlerInterface {
17
18 /**
19 * Getter for $form.
20 *
21 * It's suggested to extend \Civi\Report\OutputHandlerBase and then this will
22 * be handled for you.
23 *
24 * @return \CRM_Report_Form
25 */
26 public function getForm():\CRM_Report_Form;
27
28 /**
29 * Setter for $form.
30 *
31 * It's suggested to extend \Civi\Report\OutputHandlerBase and then this will
32 * be handled for you.
33 *
34 * @param \CRM_Report_Form $form
35 */
36 public function setForm(\CRM_Report_Form $form);
37
38 /**
39 * Are we a suitable output handler based on the given form?
40 *
41 * The class member $form isn't set yet at this point since we don't
42 * even know if we're in play yet, so the form is a parameter.
43 *
44 * @param \CRM_Report_Form $form
45 *
46 * @return bool
47 */
48 public function isOutputHandlerFor(\CRM_Report_Form $form):bool;
49
50 /**
51 * Return the download filename. This should be the "clean" name, not
52 * a munged temporary filename.
53 *
54 * @return string
55 */
56 public function getFileName():string;
57
58 /**
59 * Return the html body of the email.
60 *
61 * @return string
62 */
63 public function getMailBody():string;
64
65 /**
66 * Return the report contents as a string.
67 *
68 * @return string
69 */
70 public function getOutputString():string;
71
72 /**
73 * Set headers as appropriate and send the output to the browser.
74 */
75 public function download();
76
77 /**
78 * Mime type of the attachment.
79 *
80 * @return string
81 */
82 public function getMimeType():string;
83
84 /**
85 * Charset of the attachment.
86 *
87 * The default of '' means charset is not specified in the mimepart,
88 * which is normal for binary attachments, but for text attachments you
89 * should specify something like 'utf-8'.
90 *
91 * @return string
92 */
93 public function getCharset():string;
94
95 /**
96 * Hide/show various elements in the output, but generally for a handler
97 * this is always set to TRUE.
98 *
99 * @return bool
100 */
101 public function isPrintOnly():bool;
102
103 /**
104 * Use a pager, but for a handler this would be FALSE since paging
105 * is a UI element.
106 *
107 * @return bool
108 */
109 public function isAddPaging():bool;
110
111 /**
112 * Create absolute urls for links. Generally for a handler
113 * this is always set to TRUE, but for example for 'print' it's displayed
114 * on the site so it can be relative.
115 * @todo Couldn't it just always be absolute?
116 *
117 * @return bool
118 */
119 public function isAbsoluteUrl():bool;
120
121 }