From: Roland Häder Date: Fri, 21 Aug 2009 20:42:21 +0000 (+0000) Subject: Generic code added X-Git-Url: https://git.mxchange.org/?p=core.git;a=commitdiff_plain;h=2c6581eac64f7443d0d5e2cb104e4f7e0a6082aa Generic code added --- diff --git a/inc/classes/main/commands/web/class_WebStatusCommand.php b/inc/classes/main/commands/web/class_WebStatusCommand.php index 99880979..f2277267 100644 --- a/inc/classes/main/commands/web/class_WebStatusCommand.php +++ b/inc/classes/main/commands/web/class_WebStatusCommand.php @@ -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); + } } /**