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