class_DefaultNewsReader.php

Go to the documentation of this file.
00001 <?php
00024 class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews, Registerable {
00030         protected function __construct () {
00031                 // Call parent constructor
00032                 parent::__construct(__CLASS__);
00033 
00034                 // Clean up a little
00035                 $this->removeNumberFormaters();
00036                 $this->removeSystemArray();
00037         }
00038 
00045         public final static function createDefaultNewsReader (Requestable $requestInstance) {
00046                 // Get a new instance
00047                 $readerInstance = new DefaultNewsReader();
00048 
00049                 // Set request instance
00050                 $readerInstance->setRequestInstance($requestInstance);
00051 
00052                 // Return prepared instance
00053                 return $readerInstance;
00054         }
00055 
00062         public function initializeReader () {
00063                 // Get "page" for saving some calls
00064                 $page = $this->getRequestInstance()->getRequestElement('page');
00065 
00066                 // First get a wrapper instance
00067                 $wrapperInstance = ObjectFactory::createObjectByConfiguredName('news_db_wrapper_class');
00068 
00069                 // Next create a searchable criteria instance
00070                 $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
00071 
00072                 // Add the page as criteria to it at lease
00073                 $criteriaInstance->addCriteria("page", $page);
00074 
00075                 // Add limitation from config
00076                 $criteriaInstance->setLimit($this->getConfigInstance()->readConfig("news_{$page}_limit"));
00077 
00078                 // Get a resultInstance back from the database
00079                 $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
00080 
00081                 // Save that resultInstance in this class
00082                 $this->setResultInstance($resultInstance);
00083         }
00084 }
00085 
00086 // [EOF]
00087 ?>

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