Generic code added
authorRoland Häder <roland@mxchange.org>
Fri, 21 Aug 2009 20:42:21 +0000 (20:42 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 21 Aug 2009 20:42:21 +0000 (20:42 +0000)
inc/classes/main/commands/web/class_WebStatusCommand.php

index 9988097..f227726 100644 (file)
@@ -58,7 +58,56 @@ class WebStatusCommand extends BaseCommand implements Commandable {
         * @todo        0% done
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               $this->partialStub('Unfinished method.');
+               // Get the application instance
+               $appInstance = $this->getResolverInstance()->getApplicationInstance();
+
+               // Prepare a template instance
+               $templateInstance = $this->prepareTemplateInstance($appInstance);
+
+               // Transfer application data
+               $templateInstance->assignApplicationData($appInstance);
+
+               // Load the master template
+               $masterTemplate = $appInstance->buildMasterTemplateName();
+
+               // Load header template
+               $templateInstance->loadCodeTemplate('header');
+
+               // Compile and assign it with a variable
+               $templateInstance->compileTemplate();
+               $templateInstance->assignTemplateWithVariable('header', 'header');
+
+               // Load footer template
+               $templateInstance->loadCodeTemplate('footer');
+
+               // Compile and assign it with a variable
+               $templateInstance->compileTemplate();
+               $templateInstance->assignTemplateWithVariable('footer', 'footer');
+
+               // Load the status template
+               $templateInstance->loadCodeTemplate('status');
+
+               // Assign the status template with the master template as a content ... ;)
+               $templateInstance->assignTemplateWithVariable('status', 'content');
+
+               // Load the master template
+               $templateInstance->loadCodeTemplate($masterTemplate);
+
+               // Set title
+               $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_status_title'));
+
+               // 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('status_menu_class', array($appInstance));
+
+               // ... 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();
+
+               // Get the content back from the template engine and put it in response class
+               $templateInstance->transferToResponse($responseInstance);
+       }
        }
 
        /**