Renamed variables, removeVariable() does not expect indexes
[core.git] / inc / classes / interfaces / template / class_CompileableTemplate.php
1 <?php
2 /**
3  * An interface for template engines
4  *
5  * @author              Roland Haeder <webmaster@ship-simu.org>
6  * @version             0.0.0
7  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
8  * @license             GNU GPL 3.0 or any newer version
9  * @link                http://www.ship-simu.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          * @return      void
82          */
83         function removeVariable ($variableName);
84
85         /**
86          * Assign a given congfiguration variable with a value
87          *
88          * @param       $variableName   The configuration variable we want to assign
89          * @return      void
90          */
91         function assignConfigVariable ($variableName);
92
93         /**
94          * Compiles configuration place-holders in all variables. This 'walks'
95          * through the variable stack 'general'. It interprets all values from that
96          * variables as configuration entries after compiling them.
97          *
98          * @return      void
99          */
100         function compileConfigInVariables ();
101
102         /**
103          * Assigns the last loaded raw template content with a given variable
104          *
105          * @param       $templateName   Name of the template we want to assign
106          * @param       $variableName   Name of the variable we want to assign
107          * @return      void
108          */
109         function assignTemplateWithVariable ($templateName, $variableName);
110
111         /**
112          * Transfers the content of this template engine to a given response instance
113          *
114          * @param       $responseInstance       An instance of a response class
115          * @return      void
116          */
117         function transferToResponse (Responseable $responseInstance);
118
119         /**
120          * Assigns all the application data with template variables
121          *
122          * @param       $applicationInstance    A manageable application instance
123          * @return      void
124          */
125         function assignApplicationData (ManageableApplication $applicationInstance);
126
127         /**
128          * "Compiles" a variable by replacing {?var?} with it's content
129          *
130          * @param       $rawCode                        Raw code to compile
131          * @param       $setMatchAsCode         Sets $match if readVariable() returns empty result
132          * @return      $rawCode        Compile code with inserted variable value
133          */
134         function compileRawCode ($rawCode, $setMatchAsCode=false);
135
136         /**
137          * Renames a variable in code and in stack
138          *
139          * @param       $oldName        Old name of variable
140          * @param       $newName        New name of variable
141          * @return      void
142          */
143         function renameVariable ($oldName, $newName);
144
145         /**
146          * Renders the given XML content
147          *
148          * @param       $content        Valid XML content or if not set the current loaded raw content
149          * @return      void
150          * @throws      XmlParserException      If an XML error was found
151          */
152         function renderXmlContent ($content = NULL);
153
154         /**
155          * Enables or disables language support
156          *
157          * @param       $languageSupport        New language support setting
158          * @return      void
159          */
160         function enableLanguageSupport ($languageSupport = true);
161
162         /**
163          * Checks whether language support is enabled
164          *
165          * @return      $languageSupport        Whether language support is enabled or disabled
166          */
167         function isLanguageSupportEnabled ();
168
169         /**
170          * Enables or disables XML compacting
171          *
172          * @param       $xmlCompacting  New XML compacting setting
173          * @return      void
174          */
175         function enableXmlCompacting ($xmlCompacting = true);
176
177         /**
178          * Checks whether XML compacting is enabled
179          *
180          * @return      $xmlCompacting  Whether XML compacting is enabled or disabled
181          */
182         function isXmlCompactingEnabled ();
183
184         /**
185          * Removes all comments, tabs and new-line charcters to compact the content
186          *
187          * @param       $uncompactedContent             The uncompacted content
188          * @return      $compactedContent               The compacted content
189          */
190         function compactContent ($uncompactedContent);
191 }
192
193 // [EOF]
194 ?>