*/
class WebDefaultNewsController extends BaseController implements Controller {
/**
- * Instance of a CommandResolver class
- */
- private $resolverInstance = null;
-
- /**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Standart-Controller mit News-Auflistung");
-
- // Create unique ID number
- $this->createUniqueID();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
// Set the command resolver
$controllerInstance->setResolverInstance($resolverInstance);
+ // Add news filters to this controller
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_class'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_class'));
+
// Return the prepared instance
return $controllerInstance;
}
- /**
- * Setter for a command resolver instance
- *
- * @param $resolverInstance An instance of a command resolver class
- * @return void
- */
- public final function setResolverInstance (CommandResolver $resolverInstance) {
- $this->resolverInstance = $resolverInstance;
- }
-
/**
* Handles the given request and response
*
* @return void
*/
public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
- // Get the command instance from the resolver by sending a request instance to the resolver
- $commandInstance = $this->resolverInstance->resolvCommandByRequest($requestInstance);
+ // Run the pre filters
+ $this->executePreFilters($requestInstance, $responseInstance);
- // Get the news page variable from the request instance
- $newsPage = $requestInstance->getRequestElement("news_page");
+ // Get the command instance from the resolver by sending a request instance to the resolver
+ $commandInstance = $this->getResolverInstance()->resolvCommandByRequest($requestInstance);
- // Load the news here
- $this->loadNews($newsPage);
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
// Execute the command
$commandInstance->execute($requestInstance, $responseInstance);
+ // Run the pre filters
+ $this->executePostFilters($requestInstance, $responseInstance);
+
// Flush the response out
$responseInstance->flushBuffer();
}
-
- /**
- * Loads news from the connected database for later usage
- *
- * @param $newsPage Page of listed news we want to read
- * @return void
- */
- private function loadNews ($newsPage) {
- }
}
// [EOF]