29 lines
No EOL
867 B
PHP
29 lines
No EOL
867 B
PHP
<?php
|
|
|
|
class Blog_ArchiveController extends Fiktiv_Controller_Action
|
|
{
|
|
public function indexAction()
|
|
{
|
|
$blogposts = new ModelBlogPost();
|
|
$this->view->postsByMonthYear = $blogposts->findByMonth();
|
|
}
|
|
|
|
public function filterAction()
|
|
{
|
|
$blogposts = new ModelBlogPost();
|
|
$params = $this->_getAllParams();
|
|
|
|
|
|
if (array_key_exists('date', $params)) {
|
|
$this->view->filterType = 'date';
|
|
$this->view->filterValue = str_replace('-',' ',$params['date']);
|
|
$this->view->posts = $blogposts->findByDate($params['date'], 'yyyy-MMMM');
|
|
|
|
} else if (array_key_exists('tag', $params)) {
|
|
$this->view->filterType = 'tag';
|
|
$this->view->filterValue = $params['tag'];
|
|
$this->view->posts = $blogposts->findByTag($params['tag']);
|
|
}
|
|
|
|
}
|
|
} |