<?php //$id = $_GET['cid']; $db = new libraries_cate(); if (isset($_POST['type'])) { $id = $_POST['cate_id']; $db->del_cate("tbl_category", $id); die; /*header("location:index.php?mod=menu&act=list"); exit();*/ }
<?php $data = array(); $data['title'] = "Danh sách các menu"; $data['template'] = "menu/list_menu"; $data['act'] = 1; $cate = new libraries_cate(); $pager = new libraries_pager(); $limit = 10; $pager->set_link("index.php?mod=menu&act=list"); $total = $cate->total_cate(); $start = $pager->start(); $pages = $pager->page($total, $limit); $data['pagelist'] = $pager->listpage($pages, $start, $limit); $data['list'] = $cate->list_cate($start, $limit); loadview("layout", $data);
<?php $data = array(); $db = new libraries_cate(); $cate_id = $_POST['rel']; if (isset($_POST['type'])) { $status = $_POST['val']; if ($status == 0) { $data = array("cate_status" => 1); //print_r($cate_id); $db->update_cate($data, $cate_id); die; /*header("location:index.php?mod=menu&act=list"); exit();*/ } else { $data = array("cate_status" => 0); $db->update_cate($data, $cate_id); die; } } /*else($status == 1){ $id = $_GET['cid']; $data['info'] = $db->getdata($id); }*/ loadview("layout", $data);
<?php $data = array(); $data['title'] = "Sửa danh mục"; $data['template'] = "menu/edit_menu"; $data['act'] = 1; $db = new libraries_cate(); if (isset($_POST['type'])) { $title = $_POST['cate_title']; //$status = $_POST['cate_status']; $cate_id = $_POST['cate_id']; if ($title == "") { echo "false"; die; } $data = array("cate_name" => $title, "cate_rewrite" => replace($title)); //print_r($cate_id); $db->update_cate($data, $cate_id); die; /*header("location:index.php?mod=menu&act=list"); exit();*/ } else { $id = $_GET['cid']; $data['info'] = $db->getdata($id); } loadview("layout", $data);
<?php $data = array(); $data['title'] = "Thêm mới danh mục"; $data['template'] = "menu/add_menu"; $data['act'] = 1; $db = new libraries_cate(); if (isset($_POST['type'])) { $title = $_POST['cate_title']; //$title = $_POST['cate_title']; if ($title == "") { echo "false"; die; } $data = array("cate_name" => $title, "cate_rewrite" => replace($title)); $db->add_cate($data); die; /*header("location:index.php?mod=menu&act=list"); exit();*/ } loadview("layout", $data);