ENHANCEMENT: Paginated list for blog entries. Check WidgetAreaEditor

class exists.
This commit is contained in:
Frank Mullenger 2012-07-03 20:16:23 +12:00
parent 697ed18dbd
commit c3d9ee41e7

View File

@ -113,8 +113,8 @@ class BlogTree extends Page {
"INHERIT" => "Take value from parent Blog Tree" "INHERIT" => "Take value from parent Blog Tree"
))); )));
//$fields->addFieldToTab("Root.Widgets", new CheckboxField("InheritSideBar", 'Inherit Sidebar From Parent')); $fields->addFieldToTab("Root.Widgets", new CheckboxField("InheritSideBar", 'Inherit Sidebar From Parent'));
//$fields->addFieldToTab("Root.Widgets", new WidgetAreaEditor("SideBar")); if (class_exists('WidgetAreaEditor')) $fields->addFieldToTab("Root.Widgets", new WidgetAreaEditor("SideBar"));
return $fields; return $fields;
} }
@ -151,7 +151,7 @@ class BlogTree extends Page {
* @param string $where * @param string $where
* @return DataObjectSet * @return DataObjectSet
*/ */
public function Entries($tag = '', $date = '', $retrieveCallback = null, $filter = '') { public function Entries($limit = '', $tag = '', $date = '', $retrieveCallback = null, $filter = '') {
$tagCheck = ''; $tagCheck = '';
$dateCheck = ''; $dateCheck = '';
@ -213,7 +213,9 @@ class BlogTree extends Page {
->where($filter) ->where($filter)
->sort($order); ->sort($order);
return new PaginatedList($entries, Controller::curr()->request); $list = new PaginatedList($entries, Controller::curr()->request);
$list->setPageLength($limit);
return $list;
} }
} }
@ -264,13 +266,9 @@ class BlogTree_Controller extends Page_Controller {
$filter .= " \"BlogEntry\".\"AuthorID\" = '". Convert::raw2sql($_GET['authorID']). "'"; $filter .= " \"BlogEntry\".\"AuthorID\" = '". Convert::raw2sql($_GET['authorID']). "'";
} }
$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
$date = $this->SelectedDate(); $date = $this->SelectedDate();
$list = $this->Entries($this->SelectedTag(), ($date) ? $date : '', null, $filter); return $this->Entries($limit, $this->SelectedTag(), ($date) ? $date : '', null, $filter);
$list->setPageLength($limit);
return $list;
} }
/** /**