Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clean code #15

Merged
merged 1 commit into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion admin/controllers/backupdb/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
require_once('admin/models/backupDB.php');

$title = 'Backup Cơ sở dữ liệu Dababase';
$backupdb = 'class="active open"';
$backupDbClass = 'class="active open"';

if (isset($_POST['back_u_P_Data_base'])) {
backup_db();
Expand Down
2 changes: 1 addition & 1 deletion admin/controllers/backupdb/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
permission_moderator();

$title = 'Danh sách file Backup Cơ sở dữ liệu Dababase';
$backupdb = 'class="active open"';
$backupDbClass = 'class="active open"';

require('admin/views/backupdb/list.php');
2 changes: 1 addition & 1 deletion admin/controllers/backupdb/result.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
permission_moderator();

$title = 'Kết quả Backup Cơ sở dữ liệu Dababase';
$backupdb = 'class="active open"';
$backupDbClass = 'class="active open"';

require('admin/views/backupdb/resultBackupdb.php');
4 changes: 2 additions & 2 deletions admin/controllers/category/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

require_once('admin/models/category.php');

$subcate_id = intval($_GET['subcate_id']);
subcategories_delete($subcate_id);
$subCateId = intval($_GET['subcate_id']);
subcategories_delete($subCateId);

header('location:admin.php?controller=category');
10 changes: 5 additions & 5 deletions admin/controllers/category/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
));

if (isset($_GET['subcate_id'])) {
$subcate_id = intval($_GET['subcate_id']);
$subCateId = intval($_GET['subcate_id']);
} else {
$subcate_id = 0;
$subCateId = 0;
}

$title = ($subcate_id == 0) ? 'Thêm danh mục con' : 'Sửa danh mục con';
$nav_category = 'class="active open"';
$subcategory = get_a_record('subcategory', $subcate_id);
$title = $subCateId === 0 ? 'Thêm danh mục con' : 'Sửa danh mục con';
$navCategory = 'class="active open"';
$subcategory = get_a_record('subcategory', $subCateId);

require('admin/views/category/edit.php');
3 changes: 1 addition & 2 deletions admin/controllers/category/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
);
$title = 'Danh mục sản phẩm';
$subcategories = get_all('subcategory', $options);
$nav_category = 'class="active open"';
$navCategory = 'class="active open"';

//load view
require('admin/views/category/index.php');
4 changes: 2 additions & 2 deletions admin/controllers/comment/approved.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require_once('admin/models/comments.php');

if (isset($_GET['comment_id'])) {
$comment_id = intval($_GET['comment_id']);
comment_Approved($comment_id);
$commentId = intval($_GET['comment_id']);
comment_Approved($commentId);
header('location:admin.php?controller=comment');
}
4 changes: 2 additions & 2 deletions admin/controllers/comment/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

require_once('admin/models/comments.php');

$comment_id = intval($_GET['comment_id']);
comment_delete($comment_id);
$commentId = intval($_GET['comment_id']);
comment_delete($commentId);

header('location:admin.php?controller=comment');
8 changes: 4 additions & 4 deletions admin/controllers/comment/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
}

if (isset($_GET['comment_id'])) {
$comment_id = intval($_GET['comment_id']);
$commentId = intval($_GET['comment_id']);
} else {
$comment_id = 0;
$commentId = 0;
}

$title = $comment_id === 0 ? '' : 'Sửa phần bình luận của khách hàng';
$comment = get_a_record('comments', $comment_id);
$title = $commentId === 0 ? '' : 'Sửa phần bình luận của khách hàng';
$comment = get_a_record('comments', $commentId);

if ($comment['post_id'] <> 0) {
$post = get_a_record('posts', $comment['post_id']);
Expand Down
2 changes: 1 addition & 1 deletion admin/controllers/shop/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
else $cate_id = 0;
$title = ($cate_id == 0) ? 'Thêm danh mục' : 'Sửa danh mục';
$category = get_a_record('categories', $cate_id);
$nav_category = 'class="active open"';
$navCategory = 'class="active open"';
require('admin/views/shop/edit.php');
2 changes: 1 addition & 1 deletion admin/controllers/shop/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
);
$title = 'Nhóm Danh mục sản phẩm';
$categories = get_all('categories', $options);
$nav_category = 'class="active open"';
$navCategory = 'class="active open"';
//load view
require('admin/views/shop/index.php');
4 changes: 2 additions & 2 deletions admin/views/shared/leftnavbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
</li>
<?php if ($user_info_nav['role_id'] != 0) :
if ($user_info_nav['role_id'] == 1) : ?>
<li <?php if (isset($nav_category)) echo $nav_category; ?>> <a href="javascript:void(0);" class="menu-toggle"><i class="zmdi zmdi-folder"></i><span>Quản lý danh mục</span></a>
<li <?= $navCategory ?? ''; ?>> <a href="javascript:void(0);" class="menu-toggle"><i class="zmdi zmdi-folder"></i><span>Quản lý danh mục</span></a>
<ul class="ml-menu">
<li><a href="admin.php?controller=shop">1. Nhóm danh mục</a></li>
<li><a href="admin.php?controller=shop&amp;action=edit">2. Add nhóm danh mục mới</a></li>
<li><a href="admin.php?controller=category">3. Danh mục con</a></li>
<li><a href="admin.php?controller=category&amp;action=edit">4. Add danh mục con mới</a></li>
</ul>
</li>
<li <?php if (isset($backupdb)) echo $backupdb; ?>><a href="javascript:void(0);" class="menu-toggle"><i class="zmdi zmdi-dns"></i><span>Backup</span></a>
<li <?= $backupDbClass ?? '' ?>><a href="javascript:void(0);" class="menu-toggle"><i class="zmdi zmdi-dns"></i><span>Backup</span></a>
<ul class="ml-menu">
<li><a href="admin.php?controller=backupdb">Backup CSDL</a></li>
<li><a href="admin.php?controller=backupdb&action=list">List Backup CSDL</a></li>
Expand Down