mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Show "selected author" headline when filtering
This commit is contained in:
parent
1f5aaa51bd
commit
50b19daca1
@ -349,6 +349,30 @@ class BlogTree_Controller extends Page_Controller {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String
|
||||
*/
|
||||
function SelectedAuthor() {
|
||||
if($this->request->getVar('author')) {
|
||||
$hasAuthor = BlogEntry::get()->filter('Author', $this->request->getVar('author'))->Count();
|
||||
return $hasAuthor ? Convert::raw2xml($this->request->getVar('author')) : null;
|
||||
} elseif($this->request->getVar('authorID')) {
|
||||
$hasAuthor = BlogEntry::get()->filter('AuthorID', $this->request->getVar('authorID'))->Count();
|
||||
if($hasAuthor) {
|
||||
$member = Member::get()->byId($this->request->getVar('authorID'));
|
||||
if($member) {
|
||||
if($member->hasMethod('BlogAuthorTitle')) {
|
||||
return Convert::raw2xml($member->BlogAuthorTitle);
|
||||
} else {
|
||||
return Convert::raw2xml($member->Title);
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function SelectedNiceDate(){
|
||||
$date = $this->SelectedDate();
|
||||
|
||||
|
@ -5,17 +5,11 @@
|
||||
<% include BreadCrumbs %>
|
||||
|
||||
<% if SelectedTag %>
|
||||
<div class="selectedTag">
|
||||
<em>
|
||||
<% _t('VIEWINGTAGGED', 'Viewing entries tagged with') %> '$SelectedTag'
|
||||
</em>
|
||||
</div>
|
||||
<h3><% _t('VIEWINGTAGGED', 'Viewing entries tagged with') %> '$SelectedTag'</h3>
|
||||
<% else_if SelectedDate %>
|
||||
<div class="selectedTag">
|
||||
<em>
|
||||
<% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedNiceDate
|
||||
</em>
|
||||
</div>
|
||||
<h3><% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedNiceDate</h3>
|
||||
<% else_if SelectedAuthor %>
|
||||
<h3><% _t('VIEWINGPOSTEDBY', 'Viewing entries posted by') %> $SelectedAuthor</h3>
|
||||
<% end_if %>
|
||||
|
||||
<% if BlogEntries %>
|
||||
|
@ -8,6 +8,8 @@
|
||||
<h3><% _t('VIEWINGTAGGED', 'Viewing entries tagged with') %> '$SelectedTag'</h3>
|
||||
<% else_if SelectedDate %>
|
||||
<h3><% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedNiceDate</h3>
|
||||
<% else_if SelectedAuthor %>
|
||||
<h3><% _t('VIEWINGPOSTEDBY', 'Viewing entries posted by') %> $SelectedAuthor</h3>
|
||||
<% end_if %>
|
||||
|
||||
<% if BlogEntries %>
|
||||
|
Loading…
Reference in New Issue
Block a user