public function action_cat_create() { $this->template->title = __("Thêm mới mục bài viết"); $this->template->section_title = __("Thêm mới mục bài viết"); $data = array(); if (Request::$method == "POST") { $cat = new NewsCategory(); $active = isset($_POST['active']); $post = $cat->validate_create($_POST); if ($post->check()) { $post = $post->as_array(); $cat->name = $post['name']; $cat->slug = $post['slug']; $cat->active = $active; $cat->User = Auth::instance()->get_user(); $cat->save(); Request::instance()->redirect('admin/news/cat_index'); } else { $data['errors'] = $post->errors('admin/newscategory'); $_POST = $post->as_array(); } } $this->template->content = View::factory('admin/news/cat_create', $data); }