ÿØÿà JFIF ÿÛ „ ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/truyentranh/code/manager/module/ |
<?php global $INFO,$DB,$print,$CORE,$v_lang; function get_op_module_cat($id){ global $arr_module_cat,$v_lang; $txt_op=''; foreach($arr_module_cat as $key=>$val){ $txt_op.='<optgroup label="'.$key.'">'; foreach($val as $key2=>$val2){ if($id==$key2) { $txt_op .= '<option value="' . $key2 . '" selected>' . $val2[$v_lang] . '</option>'; }else{ $txt_op .= '<option value="' . $key2 . '">' . $val2[$v_lang] . '</option>'; } } $txt_op.='</optgroup>'; } return $txt_op; } $CORE->page_title = 'Modules'; $type = isset($CORE->input['type']) ? $CORE->input['type'] : ''; switch ($type){ case 'tree_module': $html_block = 'tree_module'; $query_menu = $DB->query("SELECT * FROM tb_module_category ORDER BY module_category_pos"); while($rows_menu = $DB->fetch_row($query_menu)) { if($v_lang=='en') { $rows_menu['module_category_name'] = $rows_menu['module_category_ename']; } $arr_id_cat[] = $rows_menu['module_category_id']; $categories[] = $rows_menu; } $list_module_2 = array(); if(!empty($arr_id_cat)) { $txt_id_cat = implode(',', $arr_id_cat); $q_modules = $DB->query("SELECT module_cat,module_url,module_name,module_ename FROM tb_module WHERE module_cat IN (" . $txt_id_cat . ") ORDER BY module_pos"); while ($r_modules = $DB->fetch_row($q_modules)) { if ($v_lang == 'en') { $r_modules['module_name'] = $r_modules['module_ename']; } $list_module_2[] = $r_modules; } } foreach ($categories as $val=>$item){ foreach ($list_module_2 as $val2=>$item2){ if($item['module_category_id']==$item2['module_cat']){ $categories[$val]['modules'][] = $list_module_2[$val2]; } } } break; case 'delete': $module_id = $CORE->input['module_id']; $DB->query("DELETE FROM tb_module WHERE module_id='".$module_id."' "); $print->refresh('index.php?act=manager&code=module'); break; case 'post' : $module_id = isset($CORE->input['module_id']) ? intval($CORE->input['module_id']) : 0; $row_check = $DB->get_colum_tb('tb_module'); if(isset($_GET['module_name'])){ $row_check=$_GET; } $txt_list_funtion = ''; if($module_id>0) { $row_check = $DB->fetch_row($DB->query("SELECT * FROM `tb_module` WHERE `module_id` = '$module_id' ")); /*$q_function = $DB->query("SELECT * FROM tb_function WHERE module_id='$module_id' "); while ($r_function = $DB->fetch_row($q_function)){ $txt_list_funtion .= '<li class="list-group-item d-flex justify-content-between align-items-center" id="function_'.$r_function['function_id'].'">'.$r_function['function_name'].' <span class="delete_function badge badge-primary badge-pill" rel="'.$r_function['function_id'].'">Xóa</span></li>'; }*/ } $html_block = 'post'; if(isset($CORE->input['submitbt'])){ $f = $CORE->input['f']; //$arr_company_id = $CORE->input['company_id']; if($f['module_name']!='') { /*$v_location = ROOT_PATH.$f['module_location']; if(!file_exists($v_location)){ $print->refresh('index.php?act=manager&code=module&type=post&'.http_build_query($f),'No '.$v_location.' file find!',10); }*/ if(intval($f['module_id'])>0){ $row_check_module = $DB->fetch_row($DB->query("SELECT * FROM tb_module WHERE module_url='".$f['module_url']."' AND module_id<>'".$f['module_id']."' ")); if($row_check_module){ $print->refresh('index.php?act=manager&code=module&type=post&'.http_build_query($f),'Module is exist, please create another module.',5); } $DB->query("UPDATE tb_module SET module_name='".$f['module_name']."' ,module_ename='".$f['module_ename']."' , module_cat='".$f['module_cat']."',module_url='".$f['module_url']."',module_location='',module_icon='".$f['module_icon']."',module_image='".$f['module_image']."',module_time='".date('Y-m-d')."', module_status='".$f['module_status']."', module_pos='".$f['module_pos']."', module_des='".$f['module_des']."', module_edes='".$f['module_edes']."', module_guide='".$f['module_guide']."' WHERE module_id='".intval($f['module_id'])."'"); $v_module_id = intval($f['module_id']); }else { $row_check_module = $DB->fetch_row($DB->query("SELECT * FROM tb_module WHERE module_url='".$f['module_url']."' ")); if($row_check_module){ $print->refresh('index.php?act=manager&code=module&type=post&'.http_build_query($f),'Module is exist, please create another module.',5); } $DB->query("INSERT INTO `tb_module` ( `module_name`, `module_ename`, `module_cat`, `module_url`, `module_location`,`module_icon`,`module_image`, `module_time`, `module_status`, `module_pos`, `module_des`, `module_edes`,`module_guide`) VALUES ( '".$f['module_name']."', '".$f['module_ename']."', '".$f['module_cat']."','".$f['module_url']."', '','".$f['module_icon']."','".$f['module_image']."', '".date('Y-m-d')."', '".$f['module_status']."', '".$f['module_pos']."', '".$f['module_des']."', '".$f['module_edes']."','".$f['module_guide']."');"); $v_module_id = $DB->insert_id(); $print->refresh('index.php?act=manager&code=module&type=post&module_id='.$v_module_id); } $print->refresh('index.php?act=manager&code=module'); } } break; case 'post_funtion': //?act=manager&code=module&type=post_funtion&module_id='+module_id+'&function_name='+function_name+'&function_url='+function_url+'&function_pos='+function_pos $arr['module_id'] = $module_id = $CORE->input['module_id']; $arr['function_name'] = $function_name = $CORE->input['function_name']; $arr['function_url'] = $function_url = $CORE->input['function_url']; $arr['function_pos'] = $function_pos = intval($CORE->input['function_pos']); if($function_name!='' && $function_url!='') { $DB->query("INSERT INTO `tb_function` ( `module_id`, `function_name`, `funtion_url`, `function_pos`) VALUES ( '".$module_id."', '".$function_name."', '".$function_url."', '".$function_pos."');"); $arr['function_id'] =$DB->insert_id(); }else{ $arr['function_id'] = 0; } echo json_encode($arr); exit(); break; case 'delete_function': $arr['function_id'] = $CORE->input['function_id']; $DB->query("DELETE FROM tb_function WHERE function_id='".$arr['function_id']."'"); echo json_encode($arr); exit(); break; default: $keyword = isset($CORE->input['fkeyword']) ? $CORE->input['fkeyword'] : ''; $where = " WHERE module_name<>'' "; if($keyword!='') { $where .= " AND (module_name LIKE '%".$keyword."%' or module_ename LIKE '%".$keyword."%') "; } $pageNum = isset($_GET['pageNum']) ? intval($_GET['pageNum']) : 1; $pageSize = 100; $from = (($pageNum * $pageSize) - $pageSize); $t = $DB->fetch_row($DB->query("SELECT count(*) as total FROM tb_module ".$where)); $total = $t['total']; $totalPage = ceil($total / $pageSize); $query = $DB->query("SELECT * FROM tb_module ".$where." ORDER BY `module_pos` ASC LIMIT $from, $pageSize"); $txt_list_module = ''; while($row = $DB->fetch_row($query)) { $row_module_cat_check = $DB->fetch_row($DB->query("SELECT module_category_name,module_category_ename FROM tb_module_category WHERE module_category_id='".$row['module_cat']."' ")); if($v_lang=='en'){ $row_module_cat_check['module_category_name']=$row_module_cat_check['module_category_ename']; } $txt_list_module .= '<tr> <td><input name="txt_pos['.$row['module_id'].'][]" class="form-control" type="text" value="'.$row['module_pos'].'" style="width:100px;"></td> <td>'.$row['module_name'].'</td> <td>'.$row['module_ename'].'</td> <td>'.$row_module_cat_check['module_category_name'].'</td> <td><span class="label label-table label-success">'.$row['module_status'].'</span> </td> <td> <a href="?act=manager&code=module&type=post&module_id='.$row['module_id'].'" class="btn btn-sm btn-icon btn-pure btn-outline delete-row-btn">Edit</a> <a href="?act=manager&code=module&type=delete&module_id='.$row['module_id'].'" class="btn btn-sm btn-icon btn-pure btn-outline delete-row-btn" onclick="return confirm(\'Are you sure want to delete?\');">Delete</a> </td> </tr>'; } $nav = $print->Pagination($totalPage,$pageNum,'menu','index.php?act=manager&code=module&fkeyword='.$keyword); $html_block = 'list'; $type2 = isset($CORE->input['type2']) ? $CORE->input['type2'] : ''; if($type2=='update_pos'){ $pos = $CORE->input['txt_pos']; foreach ($pos as $key=>$val){ $DB->query("UPDATE tb_module SET module_pos = '".$val[0]."' WHERE module_id='$key' "); } unset($pos); $print->refresh('index.php?act=manager&code=module'); } break; } ?> <?php include ROOT_PATH . 'include/block/header_admin.php'; ?> <div class="container-fluid page-body-wrapper"> <div class="main-panel"> <div class="content-wrapper"> <div class="card"> <div class="card-body"> <nav aria-label="breadcrumb"> <ol class="breadcrumb breadcrumb-custom bg-inverse-info"> <li class="breadcrumb-item"><a href="index.php">Home</a></li> <li class="breadcrumb-item"><a href="?act=manager&code=module"><?php echo $CORE->page_title;?></a></li> <li class="breadcrumb-item active" aria-current="page"><span><?php echo $CORE->page_title;?> manager</span></li> </ol> </nav> <div class="container-fluid"> <div class="row"> <div class="col-12"> <?php if($html_block=='tree_module'){ ?> <nav class="mt-2"> <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false"> <?php showCategories($categories,0,'');?> </ul> </nav> <?php } ?> <?php if($html_block=='post'){ ?> <div class="card card-outline-info"> <div class="card-header"> Post module </div> <div class="card-body"> <form action="?act=manager&code=module&type=post" method="post"> <input type="hidden" value="<?php echo $row_check['module_id'];?>" name="f[module_id]"> <div class="form-body"> <div class="row p-t-20"> <div class="col-md-6"> <div class="form-group"> <label class="control-label">Module name</label> <input type="text" class="form-control" placeholder="" name="f[module_name]" value="<?php echo $row_check['module_name'];?>" required> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="control-label">Module english name</label> <input type="text" class="form-control" name="f[module_ename]" value="<?php echo $row_check['module_ename'];?>" required> </div> </div> </div> <div class="row p-t-20"> <div class="col-md-6"> <div class="form-group"> <label class="control-label">Module description</label> <input type="text" class="form-control" placeholder="" name="f[module_des]" value="<?php echo $row_check['module_des'];?>" required> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="control-label">Module english description</label> <input type="text" class="form-control" name="f[module_edes]" value="<?php echo $row_check['module_edes'];?>" required> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label class="control-label">Module url</label> <input type="text" class="form-control" placeholder="" name="f[module_url]" value="<?php echo $row_check['module_url'];?>" required> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label class="control-label">Module icon</label> <input type="text" class="form-control" placeholder="" name="f[module_icon]" value="<?php echo $row_check['module_icon'];?>"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="control-label">Module image</label> <input type="text" class="form-control" placeholder="" name="f[module_image]" value="<?php echo $row_check['module_image'];?>"> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label class="control-label">Position:</label> <div class="form-check"> <input type="text" class="form-control" placeholder="" name="f[module_pos]" value="<?php echo $row_check['module_pos'];?>" required> </div> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="control-label">Status:</label> <div class="form-check"> <select class="form-control" name="f[module_status]"> <option value="active" <?php if($row_check['module_status']!='' and $row_check['module_status']=='active'){ echo 'selected';} ?>>Active</option> <option value="pending" <?php if($row_check['module_status']!='' and $row_check['module_status']=='pending'){ echo 'selected';} ?>>Pending</option> </select> </div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label class="control-label">Module category</label> <select class="form-control" name="f[module_cat]"> <?php function showCategories_md($categories, $parent_id = 0, $char = '', $selected_id) { foreach ($categories as $key => $item) { // Nếu là chuyên mục con thì hiển thị if ($item['module_category_parentid'] == $parent_id) { if($selected_id==$item['module_category_id']) { echo '<option value="' . $item['module_category_id'] . '" selected>'; echo $char . $item['module_category_name']; echo '</option>'; }else{ echo '<option value="' . $item['module_category_id'] . '">'; echo $char . $item['module_category_name']; echo '</option>'; } // Xóa chuyên mục đã lặp unset($categories[$key]); // Tiếp tục đệ quy để tìm chuyên mục con của chuyên mục đang lặp showCategories_md($categories, $item['module_category_id'], $char.'|--', $selected_id); } } } showCategories_md($categories, $parent_id = 0, $char = '', $row_check['module_cat']); ?> </select> </div> </div> </div> <div class="row"> <div class="col-md-12"><div class="form-group"> <label class="control-label">Module guide:</label> <textarea class="summernote" name="f[module_guide]"><?php echo $row_check['module_guide'];?></textarea> </div></div> </div> </div> <div class="form-actions"> <button type="submit" class="btn btn-success" name="submitbt"> <i class="fa fa-check"></i> Save</button> <button type="button" class="btn btn-inverse" onclick="location.href='index.php?act=manager&code=module'">Cancel</button> </div> </form> <ul class="txt_list_funtion list-group mt-2"> <?php echo $txt_list_funtion;?> </ul> </div> </div> <?php } ?> <?php if($html_block=='list'){ ?> <div class="card"> <div class="card-body"> <div class="m-t-40"> <div class="d-flex"> <div class="mr-auto"> <div class="form-group"> <a href="?act=manager&code=module&type=post" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> Add New </a> <a href="javascript:void(0);" class="btn btn-primary btn-sm" id="update_pos"><i class="fa fa-bars"></i> Update pos </a> </div> </div> <div class="ml-auto"> <div class="form-group"> <input id="demo-input-search2" type="text" placeholder="Search" autocomplete="off" class="module_title_search" value="<?php echo $keyword;?>"> <input type="hidden" value="act=manager&code=module" id="txt_code_search"> </div> </div> </div> </div> <form action="" method="post" id="form_quick_update"> <input type="hidden" name="type2" value=""> <table class="table table-bordered color-table info-table"> <thead> <tr> <th>Order</th> <th>Module name</th> <th>Module english name</th> <th>Category</th> <th>Status</th> <th>#</th> </tr> </thead> <tbody> <?php echo $txt_list_module;?> </tbody> </table> </form> <div class="text-right footable"> <ul class="pagination" style="float: right;"> <?php echo $nav;?> </ul> </div> </div> </div> <?php } ?> </div> </div> </div> </div> </div> </div> </div> </div> <?php include ROOT_PATH . 'include/block/footer_admin.php'; ?>