public function editService($id = 0) { // Xử lý dấu tiếng việt cho đường link $slug = $this->input->post('service_name'); $slug = mb_strtolower(url_title(removesign($slug))); $data = array('service_name' => ascii_to_entities($this->input->post('service_name')), 'status' => $this->input->post('status'), 'online' => $this->input->post('online'), 'coquan' => ascii_to_entities($this->input->post('coquan')), 'trinhtu' => ascii_to_entities($this->input->post('trinhtu')), 'cachthuc' => ascii_to_entities($this->input->post('cachthuc')), 'doituong' => ascii_to_entities($this->input->post('doituong')), 'thoihan' => ascii_to_entities($this->input->post('thoihan')), 'lephi' => ascii_to_entities($this->input->post('lephi')), 'ketqua' => ascii_to_entities($this->input->post('ketqua')), 'donmau' => ascii_to_entities($this->input->post('donmau')), 'profile' => ascii_to_entities($this->input->post('profile')), 'profile_quantity' => ascii_to_entities($this->input->post('profile_quantity')), 'yeucau' => ascii_to_entities($this->input->post('yeucau')), 'cancuphaply' => ascii_to_entities($this->input->post('cancuphaply')), 'slug' => $slug, 'field_id' => $this->input->post('field_id'), 'staff_id' => $this->session->userdata('staff_id')); return $this->db->update('service', $data, array('service_id' => $id)); }
public function getlinkseo() { $this->load->helper('write_url'); echo removesign($_POST['value']) . '.html'; }
/** * INSERT and UPDATE */ public function edit($id = null) { //Thiết lập thông số mặc định chung //Thiết lập thông số mặc định, Tiêu đề, Rules, CkEditor if ($id != null) { //Giá trị form - Get $this->data['category'] = $this->categories_m->get($id); $this->data['category_seo'] = $this->categories_seo_m->get($id); //Tittle $this->data['title'] = 'Sửa thông tin Danh mục'; //Add Ckfinder to Ckeditor $this->ckfinder->SetupCKEditor($this->ckeditor, '../../../publics/admin/js/ckfinder/'); //Rules $this->form_validation->set_rules('name', 'Tên danh mục', 'trim|required|min_length[2]|max_length[250]', array('required' => 'Vui lòng nhập Tên danh mục', 'min_length' => 'Tên danh mục không được dưới 2 ký tự', 'max_length' => 'Tên danh mục không được trên 250 ký tự')); } else { //Giá trị form - New $this->data['category'] = $this->categories_m->get_new(); $this->data['category_seo'] = $this->categories_seo_m->get_new(); //Tittle $this->data['title'] = 'Thêm danh mục'; //Add Ckfinder to Ckeditor $this->ckfinder->SetupCKEditor($this->ckeditor, '../../publics/admin/js/ckfinder/'); //Rules $this->form_validation->set_rules('name', 'Tên danh mục', 'trim|required|min_length[2]|max_length[250]|is_unique[myo_categories.name]', array('required' => 'Vui lòng nhập Tên danh mục', 'min_length' => 'Tên danh mục không được dưới 2 ký tự', 'max_length' => 'Tên danh mục không được trên 250 ký tự', 'is_unique' => 'Tên danh mục đã tồn tại')); } //POST SUBMIT if ($_SERVER['REQUEST_METHOD'] == 'POST') { //GET FORM DATA // //Thông tin chung $this->data['category']->name = $this->input->post('name'); $this->data['category']->alias = $this->input->post('alias'); $this->data['category']->parent_id = $this->input->post('parent_id'); $this->data['category']->image = $this->input->post('image'); $this->data['category_seo']->seo_desc = $this->input->post('seo_desc'); $this->data['category_seo']->seo_keyword = $this->input->post('seo_keyword'); $this->data['category']->note = $this->input->post('note'); $this->data['category']->published = $this->input->post('published'); $this->data['category']->tags = $this->input->post('tags'); $this->data['category']->created_time = $this->input->post('created_time'); $this->data['category']->created_user_id = $this->input->post('created_user_id'); $this->data['category']->modified_time = $this->input->post('modified_time'); $this->data['category']->modified_user_id = $this->input->post('modified_user_id'); //SEO $this->data['category_seo']->seo_title = $this->input->post('seo_title'); $this->data['category_seo']->seo_revisit = $this->input->post('seo_revisit'); $this->data['category_seo']->seo_language = $this->input->post('seo_language'); $this->data['category_seo']->seo_abstract = $this->input->post('seo_abstract'); $this->data['category_seo']->seo_author = $this->input->post('seo_author'); $this->data['category_seo']->seo_copy = $this->input->post('seo_copy'); $this->data['category_seo']->seo_bing = $this->input->post('seo_bing'); $this->data['category_seo']->seo_robots = $this->input->post('seo_robots'); $this->data['category_seo']->seo_canonical = $this->input->post('seo_canonical'); $this->data['category_seo']->seo_next = $this->input->post('seo_next'); $this->data['category_seo']->seo_prev = $this->input->post('seo_prev'); $this->data['category_seo']->seo_publisher = $this->input->post('seo_publisher'); $this->data['category_seo']->seo_schema_name = $this->input->post('seo_schema_name'); $this->data['category_seo']->seo_schema_desc = $this->input->post('seo_schema_desc'); $this->data['category_seo']->seo_schema_image = $this->input->post('seo_schema_image'); $this->data['category_seo']->seo_graph_title = $this->input->post('seo_graph_title'); $this->data['category_seo']->seo_graph_locale = $this->input->post('seo_graph_locale'); $this->data['category_seo']->seo_graph_type = $this->input->post('seo_graph_type'); $this->data['category_seo']->seo_graph_url = $this->input->post('seo_graph_url'); $this->data['category_seo']->seo_graph_image = $this->input->post('seo_graph_image'); $this->data['category_seo']->seo_graph_desc = $this->input->post('seo_graph_desc'); $this->data['category_seo']->seo_graph_sitename = $this->input->post('seo_graph_sitename'); $this->data['category_seo']->seo_graph_admin = $this->input->post('seo_graph_admin'); //NOT ERRORS FOUND if ($this->form_validation->run() == TRUE) { //Lưu dữ liệu vào biến Category $category['name'] = $this->data['category']->name; $category['alias'] = mb_strtolower(url_title(removesign($category['name']))); $category['parent_id'] = $this->data['category']->parent_id; $category['image'] = $this->data['category']->image; $category_seo['seo_desc'] = $this->data['category_seo']->seo_desc; $category_seo['seo_keyword'] = $this->data['category_seo']->seo_keyword; $category['note'] = $this->data['category']->note; $category['published'] = $this->data['category']->published; $category['tags'] = $this->data['category']->tags; $category['created_time'] = $this->data['category']->created_time; $category['created_user_id'] = $this->data['category']->created_user_id; $category['modified_time'] = $this->data['category']->modified_time; $category['modified_user_id'] = $this->data['category']->modified_user_id; $category_seo['seo_title'] = $this->data['category_seo']->seo_title; $category_seo['seo_revisit'] = $this->data['category_seo']->seo_revisit; $category_seo['seo_language'] = $this->data['category_seo']->seo_language; $category_seo['seo_abstract'] = $this->data['category_seo']->seo_abstract; $category_seo['seo_author'] = $this->data['category_seo']->seo_author; $category_seo['seo_copy'] = $this->data['category_seo']->seo_copy; $category_seo['seo_bing'] = $this->data['category_seo']->seo_bing; $category_seo['seo_robots'] = $this->data['category_seo']->seo_robots; $category_seo['seo_canonical'] = $this->data['category_seo']->seo_canonical; $category_seo['seo_next'] = $this->data['category_seo']->seo_next; $category_seo['seo_prev'] = $this->data['category_seo']->seo_prev; $category_seo['seo_publisher'] = $this->data['category_seo']->seo_publisher; $category_seo['seo_schema_name'] = $this->data['category_seo']->seo_schema_name; $category_seo['seo_schema_desc'] = $this->data['category_seo']->seo_schema_desc; $category_seo['seo_schema_image'] = $this->data['category_seo']->seo_schema_image; $category_seo['seo_graph_title'] = $this->data['category_seo']->seo_graph_title; $category_seo['seo_graph_locale'] = $this->data['category_seo']->seo_graph_locale; $category_seo['seo_graph_type'] = $this->data['category_seo']->seo_graph_type; $category_seo['seo_graph_url'] = $this->data['category_seo']->seo_graph_url; $category_seo['seo_graph_image'] = $this->data['category_seo']->seo_graph_image; $category_seo['seo_graph_desc'] = $this->data['category_seo']->seo_graph_desc; $category_seo['seo_graph_sitename'] = $this->data['category_seo']->seo_graph_sitename; $category_seo['seo_graph_admin'] = $this->data['category_seo']->seo_graph_admin; $new_id = $this->categories_m->save($category, $id); //Gán Categories ID cho if ($id == null) { $category_seo['categories_id'] = $new_id; } $this->categories_seo_m->save($category_seo, $id); /* * Choose Submit */ //Lưu if ($this->input->post('submit') == 'save') { redirect('admin/categories/edit/' . $new_id); } //Lưu và thoát if ($this->input->post('submit') == 'saveandexit') { redirect('admin/categories/index'); } //Lưu và thêm mới if ($this->input->post('submit') == 'saveandnew') { redirect('admin/categories/edit'); } } } //Get Categories $this->showTree_List(0, isset($this->data['category']->parent_id) ? $this->data['category']->parent_id : null); //Chạy hàm lấy dữ liệu $this->data['categories'] = $this->table; //Gán giữ liệu vào dropdownlist cho ra view //Khai báo view $this->data['subview'] = 'admin/categories/edit'; $this->load->view('admin/_layout_main', $this->data); }