Archived
1
0
Fork 0
This repository has been archived on 2026-05-10. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
fiktivkod/application/modules/blog/controllers/ArchiveController.php
2011-05-28 18:33:37 +02:00

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']);
}
}
}