<?php
/**
- * An ??? template engine class for XML templates
+ * A RequestNodeListAnswer template engine class for XML templates
*
- * @author Roland Haeder <webmaster@ship-simu.org>
+ * @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
* @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
+ * @link http://www.shipsimu.org
* @todo This template engine does not make use of setTemplateType()
*
* This program is free software: you can redistribute it and/or modify
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class XmlRequestNodeListAnswerTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+class XmlRequestNodeListAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable {
+ // Constants for array elements
+ const REQUEST_DATA_SESSION_ID = 'session-id';
+ const REQUEST_DATA_NODE_LIST = 'node-list';
+
/**
* Protected constructor
*
parent::__construct(__CLASS__);
// Init sub-nodes array
- $this->subNodes = array(
- XmlRequestNodeListTemplateEngine::REQUEST_DATA_ACCEPTED_OBJECT_TYPES,
- XmlRequestNodeListTemplateEngine::REQUEST_DATA_SESSION_ID,
- );
+ $this->setSubNodes(array(
+ self::REQUEST_DATA_SESSION_ID,
+ self::REQUEST_DATA_NODE_LIST,
+ // Answer status (generic field)
+ self::ANSWER_STATUS,
+ ));
}
/**
// Init instance
$templateInstance->initXmlTemplateEngine('node', 'request_node_list_answer');
+ // Get a template instance for list entries (as they are dynamic)
+ $entriesInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_request_node_list_entries_template_class');
+
+ // Set it here
+ $templateInstance->setTemplateInstance($entriesInstance);
+
// Return the prepared instance
return $templateInstance;
}
// Is this string empty?
if (empty($characters)) {
// Then skip it silently
- return false;
+ return;
} // END - if
/*
* Assign the found characters to variable and use the last entry from
* stack as the name.
*/
- parent::assignVariable($this->getStackerInstance()->getNamed('node_request_node_list_answer'), $characters);
+ parent::assignVariable($this->getStackInstance()->getNamed('node_request_node_list_answer'), $characters);
}
/**
*/
protected function startRequestNodeListAnswer () {
// Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_request_node_list_answer', 'request-node-list-answer');
+ $this->getStackInstance()->pushNamed('node_request_node_list_answer', 'request-node-list-answer');
+ }
+
+ /**
+ * Starts the session-id
+ *
+ * @return void
+ */
+ protected function startSessionId () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_request_node_list_answer', self::REQUEST_DATA_SESSION_ID);
+ }
+
+ /**
+ * Starts the node-list
+ *
+ * @return void
+ */
+ protected function startNodeList () {
+ // Push the node name on the stacker
+ $this->getStackInstance()->pushNamed('node_request_node_list_answer', self::REQUEST_DATA_NODE_LIST);
+ }
+
+ /**
+ * Finishes the node-list
+ *
+ * @return void
+ */
+ protected function finishNodeList () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_request_node_list_answer');
+ }
+
+ /**
+ * Finishes the session-id
+ *
+ * @return void
+ */
+ protected function finishSessionId () {
+ // Pop the last entry
+ $this->getStackInstance()->popNamed('node_request_node_list_answer');
}
/**
*/
protected function finishRequestNodeListAnswer () {
// Pop the last entry
- $this->getStackerInstance()->popNamed('node_request_node_list_answer');
+ $this->getStackInstance()->popNamed('node_request_node_list_answer');
}
}