class_WebLoginAreaController.php

Go to the documentation of this file.
00001 <?php
00024 class WebLoginAreaController extends BaseController implements Controller {
00030         protected function __construct () {
00031                 // Call parent constructor
00032                 parent::__construct(__CLASS__);
00033         }
00034 
00042         public final static function createWebLoginAreaController (CommandResolver $resolverInstance) {
00043                 // Create the instance
00044                 $controllerInstance = new WebLoginAreaController();
00045 
00046                 // Set the command resolver
00047                 $controllerInstance->setResolverInstance($resolverInstance);
00048 
00049                 // User auth filter
00050                 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter'));
00051 
00052                 // User update filter
00053                 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_filter'));
00054 
00055                 // News fetcher filter
00056                 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter'));
00057 
00058                 // News proccess/display-preparation
00059                 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter'));
00060 
00061                 // Return the prepared instance
00062                 return $controllerInstance;
00063         }
00064 
00072         public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
00073                 // Get the command instance from the resolver by sending a request instance to the resolver
00074                 $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
00075 
00076                 // Add more filters by the command
00077                 $commandInstance->addExtraFilters($this, $requestInstance);
00078 
00079                 // Try to run the pre filters, if auth exceptions come through redirect here
00080                 try {
00081                         // Run the pre filters
00082                         $this->executePreFilters($requestInstance, $responseInstance);
00083                 } catch (UserAuthorizationException $e) {
00084                         // Redirect to main page
00085                         $responseInstance->redirectToConfiguredUrl('login_failed_url');
00086 
00087                         // Exit here
00088                         exit();
00089                 }
00090 
00091                 // This request was valid! :-D
00092                 $requestInstance->requestIsValid();
00093 
00094                 // Execute the command
00095                 $commandInstance->execute($requestInstance, $responseInstance);
00096 
00097                 // Run the pre filters
00098                 $this->executePostFilters($requestInstance, $responseInstance);
00099 
00100                 // Flush the response out
00101                 $responseInstance->flushBuffer();
00102         }
00103 }
00104 
00105 // [EOF]
00106 ?>

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