83 lines
2.0 KiB
PHP
83 lines
2.0 KiB
PHP
<?php defined('SYSPATH') OR die('No direct access allowed.');
|
|
|
|
class Page_Controller extends Base_Front_Controller
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
public function __call($method, $arguments)
|
|
{
|
|
if ($arguments) {
|
|
$method .= '/'. implode('/', $arguments);
|
|
}
|
|
return $this->show($method);
|
|
}
|
|
|
|
public function homepage()
|
|
{
|
|
return url::redirect('o-firmie');
|
|
}
|
|
|
|
public function show($name)
|
|
{
|
|
#$name = implode('/', $this->uri->argument_array());
|
|
$page_view = new View('front/page_show');
|
|
$page = ORM::factory('page')->where('name', $name)->find();
|
|
if (!$page->loaded) {
|
|
return $this->error404();
|
|
}
|
|
|
|
if ($page->title) {
|
|
$this->view->title = $page->title .' - '. $this->view->title;
|
|
}
|
|
if ($page->meta_description) {
|
|
$this->view->meta_description = $page->meta_description;
|
|
}
|
|
if ($page->meta_keywords) {
|
|
$this->view->meta_keywords = $page->meta_keywords;
|
|
}
|
|
|
|
/*
|
|
$this->view->path = array(
|
|
array('', 'Strona główna'),
|
|
array($name, $page->header)
|
|
);
|
|
*/
|
|
$page_view->page = $page;
|
|
$this->view->content = $page_view;
|
|
$this->view->render(true);
|
|
}
|
|
|
|
public function contact()
|
|
{
|
|
$page_view = new View('front/page_contact');
|
|
|
|
$page = ORM::factory('page')->where('name', 'kontakt')->find();
|
|
if (!$page->loaded) {
|
|
return $this->error404();
|
|
}
|
|
if($page->title) {
|
|
$this->view->title = $page->title .' - '. $this->view->title;
|
|
}
|
|
if ($page->meta_description) {
|
|
$this->view->meta_description = $page->meta_description;
|
|
}
|
|
if($page->meta_keywords) {
|
|
$this->view->meta_keywords = $page->meta_keywords;
|
|
}
|
|
|
|
$center = Kohana::config('application.gmaps.center');
|
|
$marker = Kohana::config('application.gmaps.marker');
|
|
|
|
$page_view->page = $page;
|
|
$page_view->map_center = $center;
|
|
$page_view->map_marker = $marker;
|
|
$this->view->content = $page_view;
|
|
$this->view->message = $this->session->get('message');
|
|
$this->view->render(true);
|
|
}
|
|
|
|
}
|