<?php
/**
- * A default news reader class reads news from database layer
+ * A console news reader class reads news from database layer
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews, Registerable {
+class ConsoleNewsReader extends BaseFrameworkSystem implements ReadableNews, Registerable {
/**
* Protected constructor
*
* @param $requestInstance An instance of a Requestable class
* @return $readerInstance An instance of this reader class
*/
- public final static function createDefaultNewsReader (Requestable $requestInstance) {
+ public final static function createConsoleNewsReader (Requestable $requestInstance) {
// Get a new instance
- $readerInstance = new DefaultNewsReader();
+ $readerInstance = new ConsoleNewsReader();
// Set request instance
$readerInstance->setRequestInstance($requestInstance);
}
/**
- * Initializes this reader class by pre-fetching news depending on 'page'
+ * Initializes this reader class by pre-fetching news depending on 'command'
* (outside or login area), which amount of news and how much to skip
*
* @return void
*/
public function initializeReader () {
- // Get 'page' for saving some calls
- $page = $this->getRequestInstance()->getRequestElement('page');
+ // Get 'command' for saving some calls
+ $command = $this->getRequestInstance()->getRequestElement('command');
// First get a wrapper instance
$wrapperInstance = ObjectFactory::createObjectByConfiguredName('news_db_wrapper_class');
// Next create a searchable criteria instance
$criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
- // Add the page as criteria to it at lease
- $criteriaInstance->addCriteria('page', $page);
+ // Add the command as criteria to it at lease
+ $criteriaInstance->addCriteria('page', $command);
// Add limitation from config
- $criteriaInstance->setLimit($this->getConfigInstance()->readConfig('news_' . $page . '_limit'));
+ $criteriaInstance->setLimit($this->getConfigInstance()->readConfig('news_' . $command . '_limit'));
// Get a resultInstance back from the database
$resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);