Show "selected author" headline when filtering

This commit is contained in:
Ingo Schommer 2013-02-28 17:33:21 +01:00
parent 1f5aaa51bd
commit 50b19daca1
3 changed files with 30 additions and 10 deletions

View File

@ -348,6 +348,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();

View File

@ -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 %>

View File

@ -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 %>