]> git.mxchange.org Git - shipsimu.git/blobdiff - inc/classes/main/response/class_HttpResponse.php
Several MVC classes added, entryPoint method rewritten
[shipsimu.git] / inc / classes / main / response / class_HttpResponse.php
index 8b29afeda321b7683c7adcf4875f84d51f58422e..3679fe96a33bae43603dd8c35154dc288c40dfa9 100644 (file)
@@ -3,10 +3,10 @@
  * A class for an HTTP response on an HTTP request
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.3.0
+ * @version            0.0.0
  * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
  * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.mxchange.org
+ * @link               http://www.ship-simu.org
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -37,6 +37,11 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable {
         */
        private $responseBody = "";
 
+       /**
+        * Instance of the template engine
+        */
+       private $templateEngine = null;
+
        /**
         * Protected constructor
         *
@@ -60,12 +65,16 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable {
        /**
         * Creates an object of this class
         *
+        * @param       $appInstance            An instance of a manageable application
         * @return      $responseInstance       A prepared instance of this class
         */
-       public final static function createHttpResponse () {
+       public final static function createHttpResponse (ManageableApplication $appInstance) {
                // Get a new instance
                $responseInstance = new HttpResponse();
 
+               // Initialize the template engine here
+               $responseInstance->initTemplateEngine($appInstance);
+
                // Return the prepared instance
                return $responseInstance;
        }
@@ -110,7 +119,7 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable {
         * @throws      ResponseHeadersAlreadySentException             Thrown if headers are
         *                                                                                                      already sent
         */
-       public function flushResponse($force=false) {
+       public function flushResponse ($force=false) {
                if ((headers_sent()) && (!$force)) {
                        // Headers are already sent!
                        throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT);
@@ -127,6 +136,25 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable {
                $this->reponseBody = "";
                $this->responseHeaders = array();
        }
+
+       /**
+        * Initializes the template engine instance
+        *
+        * @param       $appInstance    An instance of a manageable application
+        * @return      void
+        */
+       public final function initTemplateEngine (ManageableApplication $appInstance) {
+               $this->templateEngine = $this->prepareTemplateEngine($appInstance);
+       }
+
+       /**
+        * Getter for the template engine instance
+        *
+        * @return      $templateEngine         An instance of the used template engine
+        */
+       public final function getTemplateEngine () {
+               return $this->templateEngine;
+       }
 }
 
 // [EOF]