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
@ -348,6 +348,30 @@ class BlogTree_Controller extends Page_Controller {
|
|||||||
|
|
||||||
return false;
|
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(){
|
function SelectedNiceDate(){
|
||||||
$date = $this->SelectedDate();
|
$date = $this->SelectedDate();
|
||||||
|
@ -5,17 +5,11 @@
|
|||||||
<% include BreadCrumbs %>
|
<% include BreadCrumbs %>
|
||||||
|
|
||||||
<% if SelectedTag %>
|
<% if SelectedTag %>
|
||||||
<div class="selectedTag">
|
<h3><% _t('VIEWINGTAGGED', 'Viewing entries tagged with') %> '$SelectedTag'</h3>
|
||||||
<em>
|
|
||||||
<% _t('VIEWINGTAGGED', 'Viewing entries tagged with') %> '$SelectedTag'
|
|
||||||
</em>
|
|
||||||
</div>
|
|
||||||
<% else_if SelectedDate %>
|
<% else_if SelectedDate %>
|
||||||
<div class="selectedTag">
|
<h3><% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedNiceDate</h3>
|
||||||
<em>
|
<% else_if SelectedAuthor %>
|
||||||
<% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedNiceDate
|
<h3><% _t('VIEWINGPOSTEDBY', 'Viewing entries posted by') %> $SelectedAuthor</h3>
|
||||||
</em>
|
|
||||||
</div>
|
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
|
||||||
<% if BlogEntries %>
|
<% if BlogEntries %>
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
<h3><% _t('VIEWINGTAGGED', 'Viewing entries tagged with') %> '$SelectedTag'</h3>
|
<h3><% _t('VIEWINGTAGGED', 'Viewing entries tagged with') %> '$SelectedTag'</h3>
|
||||||
<% else_if SelectedDate %>
|
<% else_if SelectedDate %>
|
||||||
<h3><% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedNiceDate</h3>
|
<h3><% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedNiceDate</h3>
|
||||||
|
<% else_if SelectedAuthor %>
|
||||||
|
<h3><% _t('VIEWINGPOSTEDBY', 'Viewing entries posted by') %> $SelectedAuthor</h3>
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
|
||||||
<% if BlogEntries %>
|
<% if BlogEntries %>
|
||||||
|
Loading…
Reference in New Issue
Block a user