]> git.mxchange.org Git - hub.git/blob - application/hub/main/template/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php
Added template class for entries in a request-node-list
[hub.git] / application / hub / main / template / answer / requests / class_XmlRequestNodeListAnswerTemplateEngine.php
1 <?php
2 /**
3  * A RequestNodeListAnswer template engine class for XML templates
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  * @todo                This template engine does not make use of setTemplateType()
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  */
25 class XmlRequestNodeListAnswerTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
26         /**
27          * Protected constructor
28          *
29          * @return      void
30          */
31         protected function __construct () {
32                 // Call parent constructor
33                 parent::__construct(__CLASS__);
34
35                 // Init sub-nodes array
36                 $this->subNodes = array(
37                         XmlRequestNodeListTemplateEngine::REQUEST_DATA_SESSION_ID,
38                 );
39         }
40
41         /**
42          * Creates an instance of the class TemplateEngine and prepares it for usage
43          *
44          * @return      $templateInstance               An instance of TemplateEngine
45          * @throws      BasePathIsEmptyException                If the provided $templateBasePath is empty
46          * @throws      InvalidBasePathStringException  If $templateBasePath is no string
47          * @throws      BasePathIsNoDirectoryException  If $templateBasePath is no
48          *                                                                                      directory or not found
49          * @throws      BasePathReadProtectedException  If $templateBasePath is
50          *                                                                                      read-protected
51          */
52         public static final function createXmlRequestNodeListAnswerTemplateEngine () {
53                 // Get a new instance
54                 $templateInstance = new XmlRequestNodeListAnswerTemplateEngine();
55
56                 // Init instance
57                 $templateInstance->initXmlTemplateEngine('node', 'request_node_list_answer');
58
59                 // Get a template instance for list entries (as they are dynamic)
60                 $entriesInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_request_node_list_entries_template_class');
61
62                 // Set it here
63                 $templateInstance->setTemplateInstance($entriesInstance);
64
65                 // Return the prepared instance
66                 return $templateInstance;
67         }
68
69         /**
70          * Currently not used
71          *
72          * @param       $resource               XML parser resource (currently ignored)
73          * @param       $characters             Characters to handle
74          * @return      void
75          * @todo        Find something useful with this!
76          */
77         public function characterHandler ($resource, $characters) {
78                 // Trim all spaces away
79                 $characters = trim($characters);
80
81                 // Is this string empty?
82                 if (empty($characters)) {
83                         // Then skip it silently
84                         return false;
85                 } // END - if
86
87                 /*
88                  * Assign the found characters to variable and use the last entry from
89                  * stack as the name.
90                  */
91                 parent::assignVariable($this->getStackerInstance()->getNamed('node_request_node_list_answer'), $characters);
92         }
93
94         /**
95          * Getter for cache file (FQFN)
96          *
97          * @return      $fqfn   Full-qualified file name of the menu cache
98          */
99         public function getRequestNodeListAnswerCacheFqfn () {
100                 $this->partialStub('Please implement this method.');
101         }
102
103         /**
104          * Starts the 'request-node-list-answer'
105          *
106          * @return      void
107          */
108         protected function startRequestNodeListAnswer () {
109                 // Push the node name on the stacker
110                 $this->getStackerInstance()->pushNamed('node_request_node_list_answer', 'request-node-list-answer');
111         }
112
113         /**
114          * Finishes the 'request-node-list-answer'
115          *
116          * @return      void
117          */
118         protected function finishRequestNodeListAnswer () {
119                 // Pop the last entry
120                 $this->getStackerInstance()->popNamed('node_request_node_list_answer');
121         }
122 }
123
124 // [EOF]
125 ?>