]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/commands/html/class_HtmlConfirmCommand.php
Continued:
[core.git] / framework / main / classes / commands / html / class_HtmlConfirmCommand.php
index ee869aa6a26f2b369702b3931e1b48fe5354c27e..79f8bdf4968ebe6d0626adf0712d2f77a3218d2d 100644 (file)
@@ -1,24 +1,27 @@
 <?php
 // Own namespace
-namespace CoreFramework\Command\Guest;
+namespace Org\Mxchange\CoreFramework\Command\Guest;
 
 // Import framework stuff
-use CoreFramework\Command\BaseCommand;
-use CoreFramework\Command\Commandable;
-use CoreFramework\Controller\Controller;
-use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Generic\NullPointerException;
-use CoreFramework\Registry\Registry;
-use CoreFramework\Request\Requestable;
-use CoreFramework\Resolver\Command\CommandResolver;
-use CoreFramework\Response\Responseable;
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Command\BaseCommand;
+use Org\Mxchange\CoreFramework\Command\Commandable;
+use Org\Mxchange\CoreFramework\Controller\Controller;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
+use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
+use Org\Mxchange\CoreFramework\Generic\NullPointerException;
+use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry;
+use Org\Mxchange\CoreFramework\Request\Requestable;
+use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
+use Org\Mxchange\CoreFramework\Response\Responseable;
 
 /**
  * A command for the confirmation link handling
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -41,7 +44,7 @@ class HtmlConfirmCommand extends BaseCommand implements Commandable {
         *
         * @return      void
         */
-       protected function __construct () {
+       private function __construct () {
                // Call parent constructor
                parent::__construct(__CLASS__);
        }
@@ -72,76 +75,73 @@ class HtmlConfirmCommand extends BaseCommand implements Commandable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Get the application instance
-               $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
-
-               // Prepare a template instance
-               $templateInstance = $this->prepareTemplateInstance($applicationInstance);
+               $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Assign application data with template engine
-               $templateInstance->assignApplicationData($applicationInstance);
+               $this->getTemplateInstance()->assignApplicationData();
 
                // Assign base URL
-               $templateInstance->assignConfigVariable('base_url');
+               $this->getTemplateInstance()->assignConfigVariable('base_url');
 
                // Load the master template
                $masterTemplate = $applicationInstance->buildMasterTemplateName();
 
                // Load header template
-               $templateInstance->loadCodeTemplate('header');
+               $this->getTemplateInstance()->loadCodeTemplate('header');
 
                // Compile and assign it with a variable
-               $templateInstance->compileTemplate();
-               $templateInstance->assignTemplateWithVariable('header', 'header');
+               $this->getTemplateInstance()->compileTemplate();
+               $this->getTemplateInstance()->assignTemplateWithVariable('header', 'header');
 
                // Load footer template
-               $templateInstance->loadCodeTemplate('footer');
+               $this->getTemplateInstance()->loadCodeTemplate('footer');
 
                // Compile and assign it with a variable
-               $templateInstance->compileTemplate();
-               $templateInstance->assignTemplateWithVariable('footer', 'footer');
+               $this->getTemplateInstance()->compileTemplate();
+               $this->getTemplateInstance()->assignTemplateWithVariable('footer', 'footer');
 
                // Load the home template
-               $templateInstance->loadCodeTemplate('confirm_link');
+               $this->getTemplateInstance()->loadCodeTemplate('confirm_link');
 
                // Assign the home template with the master template as a content ... ;)
-               $templateInstance->assignTemplateWithVariable('confirm_link', 'main_content');
+               $this->getTemplateInstance()->assignTemplateWithVariable('confirm_link', 'main_content');
 
                // Load the master template
-               $templateInstance->loadCodeTemplate($masterTemplate);
+               $this->getTemplateInstance()->loadCodeTemplate($masterTemplate);
 
                // Set title
-               $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_confirm_link_title'));
+               $this->getTemplateInstance()->assignVariable('title', FrameworkBootstrap::getLanguageInstance()->getMessage('page_confirm_link_title'));
 
                // Get user instance
                try {
-                       $userInstance = Registry::getRegistry()->getInstance('user');
+                       $userInstance = ObjectRegistry::getRegistry('generic')->getInstance('user');
                } catch (NullPointerException $e) {
                        // Not found user, e.g. when the user is somehow invalid
                        $responseInstance->redirectToConfiguredUrl('html_cmd_user_is_null');
                }
 
                // Set username
-               $templateInstance->assignVariable('username', $userInstance->getField(UserDatabaseWrapper::DB_COLUMN_USERNAME));
+               $this->getTemplateInstance()->assignVariable('username', $userInstance->getField(UserDatabaseFrontend::DB_COLUMN_USERNAME));
 
                // Construct the menu in every command. We could do this in BaseCommand class. But this means
                // *every* command has a navigation system and that is want we don't want.
-               $menuInstance = ObjectFactory::createObjectByConfiguredName('confirm_menu_class', array($applicationInstance));
+               $menuInstance = ObjectFactory::createObjectByConfiguredName('confirm_menu_class');
 
                // Render the menu
                $menuInstance->renderMenu();
 
                // Transfer it to the template engine instance
-               $menuInstance->transferContentToTemplateEngine($templateInstance);
+               $menuInstance->transferContentToTemplateEngine($this->getTemplateInstance());
 
                /*
                 * ... and all variables. This should be merged together in a pattern
                 * to make things easier. A cache mechanism should be added between
                 * these two calls to cache compiled templates.
                 */
-               $templateInstance->compileVariables();
+               $this->getTemplateInstance()->compileVariables();
 
                // Get the content back from the template engine and put it in response class
-               $templateInstance->transferToResponse($responseInstance);
+               $this->getTemplateInstance()->transferToResponse($responseInstance);
        }
 
        /**