X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=application%2Fselector%2Fclass_ApplicationHelper.php;h=5c69c52656106656206ec340845516f54a5d2739;hb=f695b17ece7b104b29f010ad2b06503c42f907ed;hp=1d4f9e710e6f7026aa9c519f17bbea257107b3ec;hpb=2b7c3e43b2fe0f3c5ae0455d13fa7743b638049f;p=shipsimu.git
diff --git a/application/selector/class_ApplicationHelper.php b/application/selector/class_ApplicationHelper.php
index 1d4f9e7..5c69c52 100644
--- a/application/selector/class_ApplicationHelper.php
+++ b/application/selector/class_ApplicationHelper.php
@@ -63,7 +63,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication
/**
* An instance of this class
*/
- private static $thisInstance = null;
+ private static $selfInstance = null;
/**
* Protected constructor
@@ -78,16 +78,16 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication
/**
* Getter for an instance of this class
*
- * @return $thisInstance An instance of this class
+ * @return $selfInstance An instance of this class
*/
- public final static function getInstance () {
+ public final static function getSelfInstance () {
// Is the instance there?
- if (is_null(self::$thisInstance)) {
- self::$thisInstance = new ApplicationHelper();
- }
+ if (is_null(self::$selfInstance)) {
+ self::$selfInstance = new ApplicationHelper();
+ } // END - if
// Return the instance
- return self::$thisInstance;
+ return self::$selfInstance;
}
/**
@@ -160,7 +160,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication
*/
public function buildMasterTemplateName () {
// Get short name and add suffix
- $masterTemplateName = str_replace("-", "", $this->getAppShortName()) . "_main";
+ $masterTemplateName = str_replace('-', '', $this->getAppShortName()) . '_main';
// Return it
return $masterTemplateName;
@@ -172,12 +172,15 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication
* @return void
*/
public final function entryPoint () {
+ // Set this application in registry
+ Registry::getRegistry()->addInstance('app', $this);
+
// Create a new request object
$requestInstance = ObjectFactory::createObjectByName('HttpRequest');
- // Default response is HTTP (HTML page) and type is "Web"
- $response = "http";
- $responseType = "web";
+ // Default response is HTTP (HTML page) and type is 'Web'
+ $response = 'http';
+ $responseType = 'web';
// Do we have another response?
if ($requestInstance->isRequestElementSet('request')) {
@@ -199,7 +202,11 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication
// If it is null then get default command
if (is_null($commandName)) {
+ // Get default command
$commandName = $responseInstance->getDefaultCommand();
+
+ // Set it in request
+ $requestInstance->setRequestElement('page', $commandName);
} // END - if
// Get a resolver
@@ -209,6 +216,12 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication
// Get a controller instance as well
$this->controllerInstance = $resolverInstance->resolveController();
+ // Get a web output class
+ $outputInstance = ObjectFactory::createObjectByConfiguredName('output_class', array($this));
+
+ // Set it in this application
+ $this->setWebOutputInstance($outputInstance);
+
// Handle the request
$this->controllerInstance->handleRequest($requestInstance, $responseInstance);
}
@@ -223,7 +236,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication
public function handleFatalMessages (array $messageList) {
// Walk through all messages
foreach ($messageList as $message) {
- print("MSG:".$message."
\n");
+ print("MSG:" . $message . "
\n");
} // END - if
}