<?php require_once "model/Ptype.php"; $model = new Ptype(); $link = "index.php?mod=project_type&act=list"; if (isset($_GET['status']) && $_GET['status'] > 0) { $lang_id = (int) $_GET['status']; $status .= "&status={$status}"; } else { $status = -1; } $listTotal = $model->getListPtypeByStatus($status, -1, -1); $total_record = mysql_num_rows($listTotal); $total_page = ceil($total_record / LIMIT); $page = isset($_GET['page']) ? (int) $_GET['page'] : 1; $offset = LIMIT * ($page - 1); $list = $model->getListPtypeByStatus($status, $offset, LIMIT); ?> <div class="row"> <div class="col-md-12"> <button class="btn btn-primary btn-sm right" onclick="location.href='index.php?mod=project_type&act=form'">Tạo mới</button> <div class="box-header"> <h3 class="box-title">Danh sách loại dự án</h3> </div><!-- /.box-header --> <div class="box"> <div class="box-body"> <table class="table table-bordered table-striped"> <tbody><tr> <th style="width: 10px">No.</th> <th>Name</th>
<?php if (isset($_GET['project_type_id'])) { $project_type_id = (int) $_GET['project_type_id']; require_once "model/Ptype.php"; $model = new Ptype(); $detail = $model->getDetailPtype($project_type_id); } ?> <div class="row"> <div class="col-md-8"> <!-- Custom Tabs --> <button class="btn btn-primary btn-sm" onclick="location.href='index.php?mod=project_type&act=list'">Danh sách</button> <div style="clear:both;margin-bottom:10px"></div> <div class="box box-primary"> <div class="box-header"> <h3 class="box-title"><?php echo $project_type_id > 0 ? "Cập nhật" : "Tạo mới"; ?> loại dự án</h3> </div><!-- /.box-header --> <!-- form start --> <form role="form" method="post" action="controller/Ptype.php"> <?php if ($project_type_id > 0) { ?> <input type="hidden" value="<?php echo $project_type_id;
<?php $url = "../index.php?mod=project_type&act=list"; require_once "../model/Ptype.php"; $model = new Ptype(); $project_type_id = (int) $_POST['project_type_id']; $project_type_name = $model->processData($_POST['project_type_name']); $project_type_alias = $model->changeTitle($project_type_name); if ($project_type_id > 0) { $model->updatePtype($project_type_id, $project_type_name, $project_type_alias); header('location:' . $url); } else { $model->insertPtype($project_type_name, $project_type_alias); header('location:' . $url); }