[Beeframework-svn] SF.net SVN: beeframework:[302] trunk/framework/Bee
Brought to you by:
b_hartmann,
m_plomer
From: <m_p...@us...> - 2015-03-12 20:06:29
|
Revision: 302 http://sourceforge.net/p/beeframework/code/302 Author: m_plomer Date: 2015-03-12 20:06:26 +0000 (Thu, 12 Mar 2015) Log Message: ----------- - default page size set in PaginationBase Modified Paths: -------------- trunk/framework/Bee/MVC/ModelAndView.php trunk/framework/Bee/MVC/View/AbstractView.php trunk/framework/Bee/Persistence/PaginationBase.php Modified: trunk/framework/Bee/MVC/ModelAndView.php =================================================================== --- trunk/framework/Bee/MVC/ModelAndView.php 2015-03-12 19:49:28 UTC (rev 301) +++ trunk/framework/Bee/MVC/ModelAndView.php 2015-03-12 20:06:26 UTC (rev 302) @@ -153,6 +153,6 @@ */ public function renderModelInView() { // @todo: assert a resolvedView is set - $this->resolvedView->render($this->getModel()); + $this->resolvedView->render($this->getModel()); } } \ No newline at end of file Modified: trunk/framework/Bee/MVC/View/AbstractView.php =================================================================== --- trunk/framework/Bee/MVC/View/AbstractView.php 2015-03-12 19:49:28 UTC (rev 301) +++ trunk/framework/Bee/MVC/View/AbstractView.php 2015-03-12 20:06:26 UTC (rev 302) @@ -60,17 +60,17 @@ */ public final function render(array $model = null) { // Consolidate static and dynamic model attributes. - - $oldModelValues = Model::getModelValues(); + + $oldModelValues = Model::getModelValues(); Model::clear(); // Model::addValuesToModel($this->staticAttributes); Model::addValuesToModel($model); - $this->prepareResponse(); + $this->prepareResponse(); $this->outputStatusHeader(); - $this->renderMergedOutputModel(); + $this->renderMergedOutputModel(); Model::clear(); Model::addValuesToModel($oldModelValues); Modified: trunk/framework/Bee/Persistence/PaginationBase.php =================================================================== --- trunk/framework/Bee/Persistence/PaginationBase.php 2015-03-12 19:49:28 UTC (rev 301) +++ trunk/framework/Bee/Persistence/PaginationBase.php 2015-03-12 20:06:26 UTC (rev 302) @@ -31,11 +31,19 @@ */ private $state = array(); - /** + /** + * + */ + function __construct() { + $this->setPageSize(50); + } + + + /** * @return int */ public function getPageSize() { - return $this->state['pageSize']; + return $this->getIndexSave('pageSize'); } /** @@ -56,7 +64,7 @@ * @return int */ public function getCurrentPage() { - return $this->state['currentPage']; + return $this->getIndexSave('currentPage'); } /** @@ -81,7 +89,7 @@ * @return int */ public function getResultCount() { - return $this->state['resultCount']; + return $this->getIndexSave('resultCount'); } /** @@ -112,4 +120,8 @@ function jsonSerialize() { return array('pageCount' => $this->getPageCount(), 'pageSize' => $this->getPageSize(), 'currentPage' => $this->getCurrentPage(), 'resultCount' => $this->getResultCount()); } + + private function getIndexSave($idx, $defaultVal = 0) { + return array_key_exists($idx, $this->state) ? $this->state[$idx] : $defaultVal; + } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |