Added new interfaces Handleable/-DataSet and ProtocolHandler (no content yet).
[core.git] / inc / classes / interfaces / template / class_CompileableTemplate.php
1 <?php
2 /**
3  * An interface for template engines
4  *
5  * @author              Roland Haeder <webmaster@shipsimu.org>
6  * @version             0.0.0
7  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
8  * @license             GNU GPL 3.0 or any newer version
9  * @link                http://www.shipsimu.org
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23  */
24 interface CompileableTemplate extends FrameworkInterface {
25         /**
26          * Assign variables for templates
27          *
28          * @param       $variableName   The "variable" we want to assign
29          * @param       $value                  The value we want to store in the variable
30          * @return      void
31          */
32         function assignVariable ($variableName, $value);
33
34         /**
35          * Load a specified web template into the engine
36          *
37          * @param       $template       The web template we shall load which is located in
38          *                                              "html" by default
39          * @return      void
40          */
41         function loadWebTemplate ($template);
42
43         /**
44          * Load a specified code template into the engine for later compilation
45          * with other code/web/email templates.
46          *
47          * @param       $template       The code template we shall load which is
48          *                                              located in "html" by default
49          * @return      void
50          */
51         function loadCodeTemplate ($template);
52
53         /**
54          * Compile all variables by inserting their respective values
55          *
56          * @return      void
57          */
58         function compileVariables ();
59
60
61         /**
62          * Compile all required code/web/email-templates into the current one
63          *
64          * @return      void
65          */
66         function compileTemplate ();
67
68         /**
69          * Adds a variable to current group
70          *
71          * @param       $variableName   Variable to set
72          * @param       $value                  Value to store in variable
73          * @return      void
74          */
75         function addGroupVariable ($variableName, $value);
76
77         /**
78          * Removes a given variable
79          *
80          * @param       $variableName   The variable we are looking for
81          * @param       $variableGroup  Name of variable group (default: 'general')
82          * @return      void
83          */
84         function removeVariable ($variableName, $variableGroup = 'general');
85
86         /**
87          * Assign a given congfiguration variable with a value
88          *
89          * @param       $variableName   The configuration variable we want to assign
90          * @return      void
91          */
92         function assignConfigVariable ($variableName);
93
94         /**
95          * Compiles configuration place-holders in all variables. This 'walks'
96          * through the variable stack 'general'. It interprets all values from that
97          * variables as configuration entries after compiling them.
98          *
99          * @return      void
100          */
101         function compileConfigInVariables ();
102
103         /**
104          * Assigns the last loaded raw template content with a given variable
105          *
106          * @param       $templateName   Name of the template we want to assign
107          * @param       $variableName   Name of the variable we want to assign
108          * @return      void
109          */
110         function assignTemplateWithVariable ($templateName, $variableName);
111
112         /**
113          * Transfers the content of this template engine to a given response instance
114          *
115          * @param       $responseInstance       An instance of a response class
116          * @return      void
117          */
118         function transferToResponse (Responseable $responseInstance);
119
120         /**
121          * Assigns all the application data with template variables
122          *
123          * @param       $applicationInstance    A manageable application instance
124          * @return      void
125          */
126         function assignApplicationData (ManageableApplication $applicationInstance);
127
128         /**
129          * "Compiles" a variable by replacing {?var?} with it's content
130          *
131          * @param       $rawCode                        Raw code to compile
132          * @param       $setMatchAsCode         Sets $match if readVariable() returns empty result (default: FALSE)
133          * @return      $rawCode                        Compile code with inserted variable value
134          */
135         function compileRawCode ($rawCode, $setMatchAsCode = FALSE);
136
137         /**
138          * Renames a variable in code and in stack
139          *
140          * @param       $oldName        Old name of variable
141          * @param       $newName        New name of variable
142          * @return      void
143          */
144         function renameVariable ($oldName, $newName);
145
146         /**
147          * Renders the given XML content
148          *
149          * @param       $content        Valid XML content or if not set the current loaded raw content
150          * @return      void
151          * @throws      XmlParserException      If an XML error was found
152          */
153         function renderXmlContent ($content = NULL);
154
155         /**
156          * Enables or disables language support
157          *
158          * @param       $languageSupport        New language support setting
159          * @return      void
160          */
161         function enableLanguageSupport ($languageSupport = TRUE);
162
163         /**
164          * Checks whether language support is enabled
165          *
166          * @return      $languageSupport        Whether language support is enabled or disabled
167          */
168         function isLanguageSupportEnabled ();
169
170         /**
171          * Enables or disables XML compacting
172          *
173          * @param       $xmlCompacting  New XML compacting setting
174          * @return      void
175          */
176         function enableXmlCompacting ($xmlCompacting = TRUE);
177
178         /**
179          * Checks whether XML compacting is enabled
180          *
181          * @return      $xmlCompacting  Whether XML compacting is enabled or disabled
182          */
183         function isXmlCompactingEnabled ();
184
185         /**
186          * Removes all comments, tabs and new-line charcters to compact the content
187          *
188          * @param       $uncompactedContent             The uncompacted content
189          * @return      $compactedContent               The compacted content
190          */
191         function compactContent ($uncompactedContent);
192 }
193
194 // [EOF]
195 ?>