class_WebLoginCommand.php

Go to the documentation of this file.
00001 <?php
00024 class WebLoginCommand extends BaseCommand implements Commandable {
00030         protected function __construct () {
00031                 // Call parent constructor
00032                 parent::__construct(__CLASS__);
00033         }
00034 
00041         public final static function createWebLoginCommand (CommandResolver $resolverInstance) {
00042                 // Get new instance
00043                 $commandInstance = new WebLoginCommand();
00044 
00045                 // Set the application instance
00046                 $commandInstance->setResolverInstance($resolverInstance);
00047 
00048                 // Return the prepared instance
00049                 return $commandInstance;
00050         }
00051 
00059         public function execute (Requestable $requestInstance, Responseable $responseInstance) {
00060                 // Get the application instance
00061                 $appInstance = $this->getResolverInstance()->getApplicationInstance();
00062 
00063                 // Prepare a template instance
00064                 $templateInstance = $this->prepareTemplateInstance($appInstance);
00065 
00066                 // Assign application data with template engine
00067                 $templateInstance->assignApplicationData($appInstance);
00068 
00069                 // Assign base URL
00070                 $templateInstance->assignConfigVariable('base_url');
00071 
00072                 // Load the master template
00073                 $masterTemplate = $appInstance->getMasterTemplate();
00074 
00075                 // Load header template
00076                 $templateInstance->loadCodeTemplate('header');
00077 
00078                 // Compile and assign it with a variable
00079                 $templateInstance->compileTemplate();
00080                 $templateInstance->assignTemplateWithVariable('header', 'header');
00081 
00082                 // Load footer template
00083                 $templateInstance->loadCodeTemplate('footer');
00084 
00085                 // Compile and assign it with a variable
00086                 $templateInstance->compileTemplate();
00087                 $templateInstance->assignTemplateWithVariable('footer', 'footer');
00088 
00089                 // Load the home template
00090                 $templateInstance->loadCodeTemplate('login_form');
00091 
00092                 // Assign the home template with the master template as a content ... ;)
00093                 $templateInstance->assignTemplateWithVariable('login_form', 'content');
00094 
00095                 // Load the master template
00096                 $templateInstance->loadCodeTemplate($masterTemplate);
00097 
00098                 // Set title
00099                 $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_login_title'));
00100 
00101                 // ... and all variables. This should be merged together in a pattern
00102                 // to make things easier. A cache mechanism should be added between
00103                 // these two calls to cache compiled templates.
00104                 $templateInstance->compileVariables();
00105 
00106                 // Get the content back from the template engine and put it in response class
00107                 $templateInstance->transferToResponse($responseInstance);
00108         }
00109 
00117         public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
00118                 // Empty for now
00119         }
00120 }
00121 
00122 // [EOF]
00123 ?>

Generated on Mon Dec 8 01:06:45 2008 for Ship-Simulator by  doxygen 1.5.6