public function action_create() { $this->template->title = __("Thêm mới kênh truyền hình"); $this->template->section_title = __("Thêm mới kênh truyền hình"); $data = array(); if (Request::$method == "POST") { $channel = new LichTruyenHinh(); $post = $channel->validate_create($_POST); if ($post->check()) { $post = $post->as_array(); $channel->user_id = Auth::instance()->get_user()->id; $channel->channel_name = $post['channel_name']; $channel->active = true; $channel->slug = $post['slug']; $channel->meta_keys = $post['meta_keys']; $channel->meta_desc = $post['meta_desc']; $channel->xml_uri = $post['xml_uri']; $channel->created_at = date("Y-m-d h:i:s"); $channel->save(); Message::success('Thêm mới kênh truyền hình thành công!'); Request::instance()->redirect('/admin/lichtruyenhinh/index'); } else { $_POST = $post->as_array(); $data['errors'] = $post->errors(); } } // $categories = TruyenCuoiCategory::bll()->getCatById_WithStoryCount(); // $data['categories'] = $categories; $this->template->content = View::factory('/admin/lichtruyenhinh/create', $data); }
/** * Index action (default) */ public function action_index() { $this->template->title = __('Lịch chiếu các kênh truyền hình'); $this->template->section_title = __('Lịch chiếu các kênh truyền hình'); $data['channel_list'] = LichTruyenHinh::bll()->getAllChannels(false); $this->template->content = View::factory('front/lichtruyenhinh/index', $data); }