]> git.mxchange.org Git - mailer.git/blobdiff - inc/classes/main/controller/default/class_WebDefaultNewsController.php
Code base synced
[mailer.git] / inc / classes / main / controller / default / class_WebDefaultNewsController.php
index ff86531c71e8a5e59670dd1d9c022f38961b16e3..f4ef9fbc42b69eaf10823beb92990cc7b85fddf8 100644 (file)
  */
 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();
        }
 
        /**
@@ -59,20 +45,14 @@ class WebDefaultNewsController extends BaseController implements Controller {
                // 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
         *
@@ -81,30 +61,24 @@ class WebDefaultNewsController extends BaseController implements Controller {
         * @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]