]> git.mxchange.org Git - shipsimu.git/blobdiff - application/ship-simu/class_ApplicationHelper.php
Registration stub added, naming convention applied, support for PHP code (keep it...
[shipsimu.git] / application / ship-simu / class_ApplicationHelper.php
index ccce7378c793b276335b2a3c2e9b7f136a5860c1..75373862f40ca89aeb65ecd34ed0ef64a1781c05 100644 (file)
@@ -37,7 +37,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplication {
        /**
@@ -55,22 +55,27 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
         */
        private $shortName = "";
 
+       /**
+        * The name of the master template
+        */
+       private $masterTemplate = "shipsimu_main";
+
        /**
         * An instance of this class
         */
        private static $thisInstance = null;
 
        /**
-        * Private constructor
+        * Protected constructor
         *
         * @return      void
         */
-       private function __construct () {
+       protected function __construct () {
                // Call parent constructor
-               parent::constructor(__CLASS__);
+               parent::__construct(__CLASS__);
 
                // Set description
-               $this->setPartDescr("Application-Helper");
+               $this->setObjectDescription("Application-Helper");
 
                // Create an unique ID
                $this->createUniqueID();
@@ -97,7 +102,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
        /**
         * Getter for the version number
         *
-        * @return      $appVersion     The application's version number
+        * @return      $appVersion             The application's version number
         */
        public final function getAppVersion () {
                return $this->appVersion;
@@ -106,7 +111,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
        /**
         * Setter for the version number
         *
-        * @param               $appVersion     The application's version number
+        * @param       $appVersion             The application's version number
         * @return      void
         */
        public final function setAppVersion ($appVersion) {
@@ -127,7 +132,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
        /**
         * Setter for human-readable name
         *
-        * @param               $appName        The application's human-readable name
+        * @param       $appName        The application's human-readable name
         * @return      void
         */
        public final function setAppName ($appName) {
@@ -148,7 +153,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
        /**
         * Setter for short uni*-like name
         *
-        * @param               $shortName      The application's short uni*-like name
+        * @param       $shortName      The application's short uni*-like name
         * @return      void
         */
        public final function setAppShortName ($shortName) {
@@ -157,23 +162,38 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                $this->shortName = $shortName;
        }
 
+       /**
+        * Getter for master template name
+        *
+        * @return      $masterTemplate         Name of the master template
+        */
+       public final function getMasterTemplate () {
+               return $this->masterTemplate;
+       }
+
        /**
         * Launches the ship-simulator game
         *
         * @return      void
         */
        public final function entryPoint () {
-               // Handle the request
-               $this->handleRequest();
+               // Create a new request object
+               $requestInstance = HttpRequest::createHttpRequest();
 
-               // Prepare the template engine
-               $tplEngine = $this->prepareTemplateEngine($this);
+               // ... and a new response object
+               $responseInstance = HttpResponse::createHttpResponse($this);
 
-               // Load the main template
-               $tplEngine->loadCodeTemplate("shipsimu_main");
+               // Get default command
+               $defaultCommand = $this->getConfigInstance()->readConfig("default_command");
 
-               // Raise an error here
-               trigger_error(__METHOD__.": Unfinished work!");
+               // Get a resolver
+               $resolverInstance = WebControllerResolver::createWebControllerResolver($defaultCommand, $this);
+
+               // Get a new controller instance as well
+               $controllerInstance = $resolverInstance->resolveDefaultController();
+
+               // Handle the request
+               $controllerInstance->handleRequest($requestInstance, $responseInstance);
        }
 }