<?php
/*
 * created on 11.3.2007
 * project: zend-hello-world
 * author: vlasta
 * version: $
 */
Zend::loadClass('Zend_Controller_Action');

class ArticleController extends Zend_Controller_Action {
	
	public function __contruct() {
		parent::__construct();
	}
	
	public function indexAction() {}
	
	public function overviewAction() {
		$view = Zend::registry('view');
		$articleService = Zend::registry('articleService');
		$categoryStr = $this->_getParam('categoryStr');
		$category = $articleService->getCategoryByStr($categoryStr);
		
		if($category == null) {
			$this->_forward('noRoute', 'index');
			return;
		}
		$view->assign('category', $category);
		
		$out = $view->render('category.php');
		$this->getResponse()->appendBody($out);
	}
	
	public function detailAction() {
		$view = Zend::registry('view');
		$articleService = Zend::registry('articleService');
		$articleStr = $this->_getParam('articleStr');
		$article = $articleService->getArticleByStr($articleStr);
		
		$view->assign('article', $article);
		
		$out = $view->render('article.php');
		$this->getResponse()->appendBody($out);
	}
}
?>