Skip to content

Commit

Permalink
ENHANCEMENT: Paginated list for blog entries. Check WidgetAreaEditor
Browse files Browse the repository at this point in the history
class exists.
  • Loading branch information
frankmullenger committed Jul 3, 2012
1 parent 697ed18 commit c3d9ee4
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions code/BlogTree.php
Expand Up @@ -113,8 +113,8 @@ function getCMSFields() {
"INHERIT" => "Take value from parent Blog Tree"
)));

//$fields->addFieldToTab("Root.Widgets", new CheckboxField("InheritSideBar", 'Inherit Sidebar From Parent'));
//$fields->addFieldToTab("Root.Widgets", new WidgetAreaEditor("SideBar"));
$fields->addFieldToTab("Root.Widgets", new CheckboxField("InheritSideBar", 'Inherit Sidebar From Parent'));
if (class_exists('WidgetAreaEditor')) $fields->addFieldToTab("Root.Widgets", new WidgetAreaEditor("SideBar"));

return $fields;
}
Expand Down Expand Up @@ -151,7 +151,7 @@ public function BlogHolderIDs() {
* @param string $where
* @return DataObjectSet
*/
public function Entries($tag = '', $date = '', $retrieveCallback = null, $filter = '') {
public function Entries($limit = '', $tag = '', $date = '', $retrieveCallback = null, $filter = '') {

$tagCheck = '';
$dateCheck = '';
Expand Down Expand Up @@ -213,7 +213,9 @@ public function Entries($tag = '', $date = '', $retrieveCallback = null, $filter
->where($filter)
->sort($order);

return new PaginatedList($entries, Controller::curr()->request);
$list = new PaginatedList($entries, Controller::curr()->request);
$list->setPageLength($limit);
return $list;
}
}

Expand Down Expand Up @@ -263,14 +265,10 @@ function BlogEntries($limit = null) {
else if(isset($_GET['authorID'])) {
$filter .= " \"BlogEntry\".\"AuthorID\" = '". Convert::raw2sql($_GET['authorID']). "'";
}

$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;


$date = $this->SelectedDate();

$list = $this->Entries($this->SelectedTag(), ($date) ? $date : '', null, $filter);
$list->setPageLength($limit);
return $list;
return $this->Entries($limit, $this->SelectedTag(), ($date) ? $date : '', null, $filter);
}

/**
Expand Down

0 comments on commit c3d9ee4

Please sign in to comment.