<input type="text" id="example-text-input" name="menu_name" class="form-control" placeholder="Tên menu" value="<?php if (isset($_GET['id'])) { echo $temp['menu_name']; } ?> "> </div> </div> <div class="form-group"> <label class="col-md-3 control-label" for="example-select">Kiểu menu</label> <div class="col-md-6"> <select id="type-menu-select" name="menu_type" class="form-control" size="1"> <option value="0">Chọn kiểu menu</option> <?php $menu_type_obj = new menu_type(); $temp_menu_type = $menu_type_obj->getAllMenuType(); foreach ($temp_menu_type as $val) { ?> <option data-url="<?php echo $val['view']; ?> " value="<?php echo $val['mn_type_id']; ?> " <?php if (isset($_GET['id'])) { if ($val['mn_type_id'] == $temp['mn_type_id']) { echo "selected"; }
<?php require_once '../models/class-menu.php'; $menu_type_obj = new menu_type(); $sort = ''; if (isset($_GET['sort'])) { $sort = $_GET['sort']; } switch ($sort) { case 'type_name': $a = $menu_type_obj->getAllMenuType('type_name'); break; default: $a = $menu_type_obj->getAllMenuType(); } ?> <table class="table table-bordered table-striped table-condensed flip-content"> <thead class="flip-content"> <tr> <th>ID</th> <th><a href="index.php?view=list-menu-type&sort=type_name">Type Name</a></th> <th class="numeric">Kiểu view</th> <th class="numeric">Sửa</th> <th class="numeric">Xóa</th> </tr> </thead> <tbody> <?php $i = 0; foreach ($a as $val) { $i++;
<?php require_once '../models/config.php'; require_once '../models/class.php'; require_once '../models/class-menu.php'; if (isset($_GET['id'])) { $menu_obj = new menu_type(); $temp = $menu_obj->getMenuTypeById($_GET['id']); //print_r($temp); } ?> <div class="panel panel-danger"> <div class="panel-heading"> <h3 class="panel-title"> <i class="livicon" data-name="bell" data-loop="true" data-color="#fff" data-hovercolor="#fff" data-size="18"></i> <?php if (isset($_GET['act'])) { echo $_GET['act'] == 'update' ? 'Sửa' : 'Thêm'; } else { echo "Thêm"; } ?> menu </h3> <span class="pull-right"> <i class="fa fa-fw fa-chevron-up clickable"></i> <i class="fa fa-fw fa-times removepanel clickable"></i> </span> </div> <div class="panel-body border"> <form action="control/proccess-menu-type.php" method="post" class="form-horizontal form-bordered">
$id = $_POST['id']; if ($menu_type_obj->updateMenuType($type_name, $view, $id)) { header("Location: ../index.php?view=list-menu-type&stt=success"); } else { header("Location: ../index.php?view=list-menu-type&stt=fail"); } } break; case "xoa": $id = $_POST['id']; $menu_type_obj = new menu_type(); if ($menu_type_obj->delMenuType($id)) { header("Location: ../index.php?view=list-menu-type&stt=success"); } else { header("Location: ../index.php?view=list-menu-type&stt=fail"); } break; default: if (isset($_POST['type_name']) && isset($_POST['view'])) { $menu_type_obj = new menu_type(); $type_name = $_POST['type_name']; $view = $_POST['view']; if ($menu_type_obj->insertMenuType($type_name, $view)) { header("Location: ../index.php?view=list-menu-type&stt=success"); } else { header("Location: ../index.php?view=form-menu-type&stt=fail"); } } break; } }