]> git.mxchange.org Git - hub.git/blob - application/hub/main/template/requests/class_XmlRequestNodeListTemplateEngine.php
Updated 'core'.
[hub.git] / application / hub / main / template / requests / class_XmlRequestNodeListTemplateEngine.php
1 <?php
2 /**
3  * An ??? template engine class for XML templates
4  *
5  * @author              Roland Haeder <webmaster@shipsimu.org>
6  * @version             0.0.0
7  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
8  * @license             GNU GPL 3.0 or any newer version
9  * @link                http://www.shipsimu.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 XmlRequestNodeListTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
26         // Constants for array elements
27         const REQUEST_DATA_ACCEPTED_OBJECT_TYPES = 'accepted-object-types';
28         const REQUEST_DATA_SESSION_ID            = 'session-id';
29
30         /**
31          * Protected constructor
32          *
33          * @return      void
34          */
35         protected function __construct () {
36                 // Call parent constructor
37                 parent::__construct(__CLASS__);
38
39                 // Init sub nodes
40                 $this->setSubNodes(array(
41                         self::REQUEST_DATA_ACCEPTED_OBJECT_TYPES,
42                         self::REQUEST_DATA_SESSION_ID,
43                 ));
44         }
45
46         /**
47          * Creates an instance of the class TemplateEngine and prepares it for usage
48          *
49          * @return      $templateInstance               An instance of TemplateEngine
50          * @throws      BasePathIsEmptyException                If the provided $templateBasePath is empty
51          * @throws      InvalidBasePathStringException  If $templateBasePath is no string
52          * @throws      BasePathIsNoDirectoryException  If $templateBasePath is no
53          *                                                                                      directory or not found
54          * @throws      BasePathReadProtectedException  If $templateBasePath is
55          *                                                                                      read-protected
56          */
57         public static final function createXmlRequestNodeListTemplateEngine () {
58                 // Get a new instance
59                 $templateInstance = new XmlRequestNodeListTemplateEngine();
60
61                 // Init template instance
62                 $templateInstance->initXmlTemplateEngine('node', 'request_node_list');
63
64                 // Return the prepared instance
65                 return $templateInstance;
66         }
67
68         /**
69          * Currently not used
70          *
71          * @param       $resource               XML parser resource (currently ignored)
72          * @param       $characters             Characters to handle
73          * @return      void
74          * @todo        Find something useful with this!
75          */
76         public function characterHandler ($resource, $characters) {
77                 // Trim all spaces away
78                 $characters = trim($characters);
79
80                 // Is this string empty?
81                 if (empty($characters)) {
82                         // Then skip it silently
83                         return;
84                 } // END - if
85
86                 // Assign data with matching variable here
87                 parent::assignVariable($this->getStackInstance()->getNamed('node_request_node_list'), $characters);
88         }
89
90         /**
91          * Getter for cache file (FQFN)
92          *
93          * @return      $fqfn   Full-qualified file name of the menu cache
94          */
95         public function getRequestNodeListCacheFqfn () {
96                 $this->partialStub('Please implement this method.');
97         }
98
99         /**
100          * Starts the node-request-node-list
101          *
102          * @return      void
103          */
104         protected function startRequestNodeList () {
105                 // Push the node name on the stacker
106                 $this->getStackInstance()->pushNamed('node_request_node_list', 'node-request-node-list');
107         }
108
109         /**
110          * Starts the accepted-object-types
111          *
112          * @return      void
113          */
114         protected function startAcceptedObjectTypes () {
115                 // Push the node name on the stacker
116                 $this->getStackInstance()->pushNamed('node_request_node_list', self::REQUEST_DATA_ACCEPTED_OBJECT_TYPES);
117         }
118
119         /**
120          * Starts the session-id
121          *
122          * @return      void
123          */
124         protected function startSessionId () {
125                 // Push the node name on the stacker
126                 $this->getStackInstance()->pushNamed('node_request_node_list', self::REQUEST_DATA_SESSION_ID);
127         }
128
129         /**
130          * Finishes the session-id
131          *
132          * @return      void
133          */
134         protected function finishSessionId () {
135                 // Pop the last entry
136                 $this->getStackInstance()->popNamed('node_request_node_list');
137         }
138
139         /**
140          * Finishes the accepted-object-types
141          *
142          * @return      void
143          */
144         protected function finishAcceptedObjectTypes () {
145                 // Pop the last entry
146                 $this->getStackInstance()->popNamed('node_request_node_list');
147         }
148
149         /**
150          * Finishes the node-request-node-list
151          *
152          * @return      void
153          */
154         protected function finishRequestNodeList () {
155                 // Pop the last entry
156                 $this->getStackInstance()->popNamed('node_request_node_list');
157         }
158 }
159
160 // [EOF]
161 ?>