]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/template/menu/class_MenuTemplateEngine.php
Changed all true/false to TRUE/FALSE respectively as PHP constants are better than...
[core.git] / inc / classes / main / template / menu / class_MenuTemplateEngine.php
index b67f7207d6bf6da2270ad2a86f41d1b8044b9e76..7b638fbffeb1cdda9d2ef2ba9b18ee5a4bced7ba 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -60,7 +60,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
        /**
         * Menu instance
         */
-       private $menuInstance = null;
+       private $menuInstance = NULL;
 
        /**
         * Current main node
@@ -85,7 +85,6 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
        /**
         * Creates an instance of the class TemplateEngine and prepares it for usage
         *
-        * @param       $applicationInstance    A manageable application
         * @param       $menuInstance                   A RenderableMenu instance
         * @return      $templateInstance               An instance of TemplateEngine
         * @throws      BasePathIsEmptyException                If the provided $templateBasePath is empty
@@ -95,10 +94,13 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         * @throws      BasePathReadProtectedException  If $templateBasePath is
         *                                                                                      read-protected
         */
-       public static final function createMenuTemplateEngine (ManageableApplication $applicationInstance, RenderableMenu $menuInstance) {
+       public static final function createMenuTemplateEngine (RenderableMenu $menuInstance) {
                // Get a new instance
                $templateInstance = new MenuTemplateEngine();
 
+               // 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') . '/';
 
@@ -237,7 +239,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         * @return      void
         * @throws      XmlNodeMismatchException        If current main node mismatches the closing one
         */
-       public function endElement ($resource, $nodeName) {
+       public function finishElement ($resource, $nodeName) {
                // Make all lower-case
                $nodeName = strtolower($nodeName);
 
@@ -271,7 +273,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
                // 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
@@ -290,7 +292,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
                // Is the template dependency set?
                if ((!empty($templateDependency)) && (!isset($this->dependencyContent[$node]))) {
                        // Get a temporay menu template instance
-                       $templateInstance = ObjectFactory::createObjectByConfiguredName('menu_template_class', array($this->getApplicationInstance(), $this->getMenuInstance()));
+                       $templateInstance = ObjectFactory::createObjectByConfiguredName('menu_template_class', array($this->getMenuInstance()));
 
                        // Then load it
                        $templateInstance->loadMenuTemplate($templateDependency);