* 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 XmlAnnouncementTemplateEngine extends BaseTemplateEngine implements CompileableTemplate {
+class XmlAnnouncementTemplateEngine extends BaseTemplateEngine implements CompileableTemplate, Registerable {
/**
* Main nodes in the XML tree
*/
'listener',
'hub-listener',
'client-listener',
- 'node-id',
'node-status',
'tcp-port',
'udp-port',
/**
* Creates an instance of the class TemplateEngine and prepares it for usage
*
- * @param $applicationInstance A manageable application
* @return $templateInstance An instance of TemplateEngine
* @throws BasePathIsEmptyException If the provided $templateBasePath is empty
* @throws InvalidBasePathStringException If $templateBasePath is no string
* @throws BasePathReadProtectedException If $templateBasePath is
* read-protected
*/
- public static final function createXmlAnnouncementTemplateEngine (ManageableApplication $applicationInstance) {
+ public static final function createXmlAnnouncementTemplateEngine () {
// Get a new instance
$templateInstance = new XmlAnnouncementTemplateEngine();
+ // Get the application instance from registry
+ $applicationInstance = Registry::getRegistry()->getInstance('app');
+
// Determine base path
$templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $applicationInstance->getRequestInstance()->getRequestElement('app') . '/';
// Set template extensions
$templateInstance->setRawTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('raw_template_extension'));
- $templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('announcement_template_extension'));
+ $templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('node_announcement_template_extension'));
// Absolute output path for compiled templates
$templateInstance->setCompileOutputPath($templateInstance->getConfigInstance()->getConfigEntry('base_path') . $templateInstance->getConfigInstance()->getConfigEntry('compile_output_path'));
// Init a variable stacker
- $stackerInstance = ObjectFactory::createObjectByConfiguredName('announcement_stacker_class');
+ $stackerInstance = ObjectFactory::createObjectByConfiguredName('node_announcement_stacker_class');
// Set it
$templateInstance->setStackerInstance($stackerInstance);
*/
public function loadAnnouncementTemplate ($template = 'self_announcement') {
// Set template type
- $this->setTemplateType($this->getConfigInstance()->getConfigEntry('announcement_template_type'));
+ $this->setTemplateType($this->getConfigInstance()->getConfigEntry('node_announcement_template_type'));
// Load the special template
$this->loadTemplate($template);
* @param $resource XML parser resource (currently ignored)
* @param $characters Characters to handle
* @return void
- * @todo Find something useful with this!
*/
public function characterHandler ($resource, $characters) {
// Trim all spaces away
// Is the template dependency set?
if ((!empty($templateDependency)) && (!isset($this->dependencyContent[$node]))) {
// Get a temporay template instance
- $templateInstance = ObjectFactory::createObjectByConfiguredName('announcement_template_class', array($this->getApplicationInstance()));
+ $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_announcement_template_class');
// Then load it
$templateInstance->loadAnnouncementTemplate($templateDependency);
$this->getStackerInstance()->pushNamed('announcement', 'announcement-data');
}
- /**
- * Starts the node id
- *
- * @return void
- */
- private function startNodeId () {
- // Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('announcement', 'node-id');
- }
-
/**
* Starts the node status
*
$this->getStackerInstance()->popNamed('announcement');
}
- /**
- * Finishes the node id
- *
- * @return void
- */
- private function finishNodeId () {
- // Pop the last entry
- $this->getStackerInstance()->popNamed('announcement');
- }
-
/**
* Finishes the announcement data
*