]> git.mxchange.org Git - shipsimu.git/blobdiff - application/selector/class_ApplicationHelper.php
Updated to latest 'core' + convertToClassName() and convertDashesToUnderscores()...
[shipsimu.git] / application / selector / class_ApplicationHelper.php
index 3eba4589649c953170aaf9f4de3d0a80781070de..204800fa0989a380bd091bf2684522ff4badb73b 100644 (file)
@@ -20,7 +20,7 @@
  * Please remember that this include file is being loaded *before* the class
  * loader is loading classes from "exceptions", "interfaces" and "main"!
  *
- * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0
  * @copyright  Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2012 Ship-Simu Developer Team
  * @license            GNU GPL 3.0 or any newer version
@@ -153,11 +153,11 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                Registry::getRegistry()->addInstance('app', $this);
 
                // Default response is console
-               $response = $this->getResponseTypeFromSystem();
-               $responseType = $this->getResponseTypeFromSystem();
+               $response = self::getResponseTypeFromSystem();
+               $responseType = self::getResponseTypeFromSystem();
 
                // Create a new request object
-               $requestInstance = ObjectFactory::createObjectByName($this->convertToClassName($response) . 'Request');
+               $requestInstance = ObjectFactory::createObjectByName(self::convertToClassName($response) . 'Request');
 
                // Remember request instance here
                $this->setRequestInstance($requestInstance);
@@ -170,7 +170,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                } // END - if
 
                // ... and a new response object
-               $responseClass = sprintf("%sResponse", $this->convertToClassName($response));
+               $responseClass = sprintf('%sResponse', self::convertToClassName($response));
                $responseInstance = ObjectFactory::createObjectByName($responseClass, array($this));
 
                // Remember response instance here
@@ -182,23 +182,39 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                // If it is null then get default command
                if (is_null($commandName)) {
                        // Get default command
-                       $commandName = $responseInstance->getDefaultCommand();
+                       $commandName = $responseInstance->determineDefaultCommand();
 
                        // Set it in request
                        $requestInstance->setRequestElement('command', $commandName);
                } // END - if
 
-               // Get a resolver
-               $resolverClass = $this->convertToClassName($this->getAppShortName() . '_' . $responseType);
+               // Get a controller resolver
+               $resolverClass = self::convertToClassName($this->getAppShortName() . '_' . $responseType . '_controller_resolver');
                $resolverInstance = ObjectFactory::createObjectByName($resolverClass, array($commandName, $this));
 
                // Get a controller instance as well
                $this->setControllerInstance($resolverInstance->resolveController());
 
+               // Initialize language system
+               $languageInstance = ObjectFactory::createObjectByConfiguredName('language_system_class');
+
+               // And set it here
+               $this->setLanguageInstance($languageInstance);
+
                // Launch the main routine here
                $this->getControllerInstance()->handleRequest($requestInstance, $responseInstance);
        }
 
+       /**
+        * Assigns extra application-depending data
+        *
+        * @param       $templateInstance       An instance of a CompileableTemplate
+        * @return      void
+        * @todo        Nothing to add?
+        */
+       public function assignExtraTemplateData (CompileableTemplate $templateInstance) {
+       }
+
        /**
         * Handle the indexed array of fatal messages and puts them out in an
         * acceptable fasion