<?php defined('SYSPATH') or die('No direct access allowed.');

/**
 * This class provides static pages
 *
 * @package    OSB
 * @category   Controllers
 * @author     Deon George
 * @copyright  (c) 2010 Deon George
 * @license    http://dev.leenooks.net/license.html
 */
class Controller_StaticPage extends Controller_TemplateDefault {
	/**
	 * By default show a menu of available categories
	 * @todo Only show categories according to their validity dates
	 */
	public function action_view() {
		$id = $this->request->param('id');

		$sp = ORM::factory('staticpage',$id);

		if (! $sp->loaded())
			Request::current()->redirect('staticpage_category/index');

		Breadcrumb::name($this->request->uri(),$sp->staticpage_translate->find()->title);

		Block::add(array(
			'title'=>$sp->staticpage_translate->find()->title,
			'body'=>View::factory($this->viewpath())
				->set('record',$sp),
			));
	}
}
?>