X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=application%2Fship-simu%2Fclass_ApplicationHelper.php;h=75373862f40ca89aeb65ecd34ed0ef64a1781c05;hb=7625f0ed496dbf1bb3efbb3bd327dbd0fd747af4;hp=ccce7378c793b276335b2a3c2e9b7f136a5860c1;hpb=87db91afa01eda4ca4f3b72a3f795cd2cc28d6f0;p=shipsimu.git diff --git a/application/ship-simu/class_ApplicationHelper.php b/application/ship-simu/class_ApplicationHelper.php index ccce737..7537386 100644 --- a/application/ship-simu/class_ApplicationHelper.php +++ b/application/ship-simu/class_ApplicationHelper.php @@ -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 . + * along with this program. If not, see . */ 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); } }