ENHANCEMENT: Added option to view archives just by year (ticket #5667)

ENHANCEMENT: added action on BlogTree
This commit is contained in:
Carlos Barberis 2010-07-01 23:30:13 +00:00
parent 9cfd303ecf
commit d491c442dc
3 changed files with 23 additions and 7 deletions

View File

@ -210,7 +210,8 @@ class BlogTree_Controller extends Page_Controller {
static $allowed_actions = array(
'index',
'rss',
'tag'
'tag',
'date'
);
function init() {
@ -255,7 +256,7 @@ class BlogTree_Controller extends Page_Controller {
$date = $this->SelectedDate();
return $this->Entries("$start,$limit", $this->SelectedTag(), ($date) ? $date->Format('Y-m') : '', null, $filter);
return $this->Entries("$start,$limit", $this->SelectedTag(), ($date) ? $date : '', null, $filter);
}
/**
@ -311,13 +312,28 @@ class BlogTree_Controller extends Page_Controller {
$month = $this->request->latestParam('OtherID');
if(is_numeric($year) && is_numeric($month) && $month < 13) {
$date = new Date();
$date->setValue($year .'-'. $month);
$date = $year .'-'. $month;
return $date;
} else {
if(is_numeric($year)) return $year;
}
}
return false;
}
function SelectedNiceDate(){
$date = $this->SelectedDate();
if(strpos($date, '-')) {
$date = explode("-",$date);
return date("F", mktime(0, 0, 0, $date[1], 1, date('Y'))). " " .date("Y", mktime(0, 0, 0, date('m'), 1, $date[0]));
} else {
return date("Y", mktime(0, 0, 0, date('m'), 1, $date));
}
}
}

View File

@ -7,7 +7,7 @@
<% if SelectedTag %>
<h3><% _t('VIEWINGTAGGED', 'Viewing entries tagged with') %> '$SelectedTag'</h3>
<% else_if SelectedDate %>
<h3><% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedDate.Month $SelectedDate.Year</h3>
<h3><% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedNiceDate</h3>
<% end_if %>
<% if BlogEntries %>

View File

@ -7,7 +7,7 @@
<% if SelectedTag %>
<h3><% _t('VIEWINGTAGGED', 'Viewing entries tagged with') %> '$SelectedTag'</h3>
<% else_if SelectedDate %>
<h3><% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedDate.Month $SelectedDate.Year</h3>
<h3><% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedNiceDate</h3>
<% end_if %>
<% if BlogEntries %>