]> git.mxchange.org Git - hub.git/blob - application/hub/main/template/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php
0a3e44b9df97fe802fb96855256cc9076d76081e
[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         // Constants for array elements
27         const REQUEST_DATA_SESSION_ID            = 'session-id';
28
29         /**
30          * Protected constructor
31          *
32          * @return      void
33          */
34         protected function __construct () {
35                 // Call parent constructor
36                 parent::__construct(__CLASS__);
37
38                 // Init sub-nodes array
39                 $this->subNodes = array(
40                         XmlRequestNodeListTemplateEngine::REQUEST_DATA_SESSION_ID,
41                 );
42         }
43
44         /**
45          * Creates an instance of the class TemplateEngine and prepares it for usage
46          *
47          * @return      $templateInstance               An instance of TemplateEngine
48          * @throws      BasePathIsEmptyException                If the provided $templateBasePath is empty
49          * @throws      InvalidBasePathStringException  If $templateBasePath is no string
50          * @throws      BasePathIsNoDirectoryException  If $templateBasePath is no
51          *                                                                                      directory or not found
52          * @throws      BasePathReadProtectedException  If $templateBasePath is
53          *                                                                                      read-protected
54          */
55         public static final function createXmlRequestNodeListAnswerTemplateEngine () {
56                 // Get a new instance
57                 $templateInstance = new XmlRequestNodeListAnswerTemplateEngine();
58
59                 // Init instance
60                 $templateInstance->initXmlTemplateEngine('node', 'request_node_list_answer');
61
62                 // Get a template instance for list entries (as they are dynamic)
63                 $entriesInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_request_node_list_entries_template_class');
64
65                 // Set it here
66                 $templateInstance->setTemplateInstance($entriesInstance);
67
68                 // Return the prepared instance
69                 return $templateInstance;
70         }
71
72         /**
73          * Currently not used
74          *
75          * @param       $resource               XML parser resource (currently ignored)
76          * @param       $characters             Characters to handle
77          * @return      void
78          * @todo        Find something useful with this!
79          */
80         public function characterHandler ($resource, $characters) {
81                 // Trim all spaces away
82                 $characters = trim($characters);
83
84                 // Is this string empty?
85                 if (empty($characters)) {
86                         // Then skip it silently
87                         return false;
88                 } // END - if
89
90                 /*
91                  * Assign the found characters to variable and use the last entry from
92                  * stack as the name.
93                  */
94                 parent::assignVariable($this->getStackerInstance()->getNamed('node_request_node_list_answer'), $characters);
95         }
96
97         /**
98          * Getter for cache file (FQFN)
99          *
100          * @return      $fqfn   Full-qualified file name of the menu cache
101          */
102         public function getRequestNodeListAnswerCacheFqfn () {
103                 $this->partialStub('Please implement this method.');
104         }
105
106         /**
107          * Starts the 'request-node-list-answer'
108          *
109          * @return      void
110          */
111         protected function startRequestNodeListAnswer () {
112                 // Push the node name on the stacker
113                 $this->getStackerInstance()->pushNamed('node_request_node_list_answer', 'request-node-list-answer');
114         }
115
116         /**
117          * Finishes the 'request-node-list-answer'
118          *
119          * @return      void
120          */
121         protected function finishRequestNodeListAnswer () {
122                 // Pop the last entry
123                 $this->getStackerInstance()->popNamed('node_request_node_list_answer');
124         }
125 }
126
127 // [EOF]
128 ?>