00001 <?php 00024 class WebDefaultNewsController extends BaseController implements Controller { 00030 protected function __construct () { 00031 // Call parent constructor 00032 parent::__construct(__CLASS__); 00033 } 00034 00041 public final static function createWebDefaultNewsController (CommandResolver $resolverInstance) { 00042 // Create the instance 00043 $controllerInstance = new WebDefaultNewsController(); 00044 00045 // Set the command resolver 00046 $controllerInstance->setResolverInstance($resolverInstance); 00047 00048 // Add news filters to this controller 00049 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter')); 00050 $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter')); 00051 00052 // Return the prepared instance 00053 return $controllerInstance; 00054 } 00055 00063 public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { 00064 // Get the command instance from the resolver by sending a request instance to the resolver 00065 $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); 00066 00067 // Add more filters by the command 00068 $commandInstance->addExtraFilters($this, $requestInstance); 00069 00070 // Run the pre filters 00071 $this->executePreFilters($requestInstance, $responseInstance); 00072 00073 // This request was valid! :-D 00074 $requestInstance->requestIsValid(); 00075 00076 // Execute the command 00077 $commandInstance->execute($requestInstance, $responseInstance); 00078 00079 // Run the pre filters 00080 $this->executePostFilters($requestInstance, $responseInstance); 00081 00082 // Flush the response out 00083 $responseInstance->flushBuffer(); 00084 } 00085 } 00086 00087 // [EOF] 00088 ?>
1.5.6