private function loadDataGridRecentPosts()
{
// filter on category?
if ($this->categoryId != null) {
// create datagrid
$this->dgRecent = new BackendDataGridDB(BackendBlogModel::QRY_DATAGRID_BROWSE_RECENT_FOR_CATEGORY, array($this->categoryId, 'active', BL::getWorkingLanguage(), 4));
// set the URL
$this->dgRecent->setURL('&category=' . $this->categoryId, true);
} else {
// create datagrid
$this->dgRecent = new BackendDataGridDB(BackendBlogModel::QRY_DATAGRID_BROWSE_RECENT, array('active', BL::getWorkingLanguage(), 4));
}
// set headers
$this->dgRecent->setHeaderLabels(array('user_id' => \SpoonFilter::ucfirst(BL::lbl('Author'))));
// hide columns
$this->dgRecent->setColumnsHidden(array('revision_id'));
// set paging
$this->dgRecent->setPaging(false);
// set column functions
$this->dgRecent->setColumnFunction(array(new BackendDataGridFunctions(), 'getLongDate'), array('[edited_on]'), 'edited_on', true);
$this->dgRecent->setColumnFunction(array(new BackendDataGridFunctions(), 'getUser'), array('[user_id]'), 'user_id', true);
// our JS needs to know an id, so we can highlight it
$this->dgRecent->setRowAttributes(array('id' => 'row-[revision_id]'));
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('Edit')) {
// set colum URLs
$this->dgRecent->setColumnURL('title', BackendModel::createURLForAction('Edit') . '&id=[id]&category=' . $this->categoryId);
// add edit column
$this->dgRecent->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('Edit') . '&id=[id]&category=' . $this->categoryId, BL::lbl('Edit'));
}
}