50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php defined('SYSPATH') OR die('No direct access allowed.');
|
|
|
|
class Page_Controller extends Base_Admin_Controller
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->view->path = 'Strony';
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
return $this->edit('home');
|
|
}
|
|
|
|
public function edit($name = null)
|
|
{
|
|
$name = implode('/', $this->uri->argument_array());
|
|
$page = new Page_Model();
|
|
$page_view = new View('admin/page_edit');
|
|
|
|
$page = ORM::factory('page')->where('name', $name)->find();
|
|
if (!$page->loaded)
|
|
{
|
|
return $this->error404();
|
|
}
|
|
|
|
if($this->input->post())
|
|
{
|
|
$page->title = $this->input->post('page_title');
|
|
$page->header = $this->input->post('page_header');
|
|
$page->content = $this->input->post('page_content');
|
|
$page->meta_description = $this->input->post('meta_description');
|
|
$page->meta_keywords = $this->input->post('meta_keywords');
|
|
$page->save();
|
|
|
|
if ($page->saved)
|
|
{
|
|
$this->session->set_flash('message','Strona została zapisana.');
|
|
}
|
|
url::redirect(url::current());
|
|
}
|
|
|
|
$this->view->path .= $this->path_arrow . html::span_class($page->name, 'path_active');
|
|
|
|
$page_view->page = $page;
|
|
$this->view->content = $page_view;
|
|
$this->view->render(true);
|
|
}
|
|
} |