| Server IP : 103.48.194.25 / Your IP : 216.73.217.33 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 8.2.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/nhadatkhangdien.net-bk/public_html/admin/templates/sanpham/ |
Upload File : |
<style type="text/css">
.blue_table {}
.blue_table td, .blue_table th {
padding:8px;
}
.center {
text-align:center;
}
.w25 {
width:25px;
}
.w60 {
width:60px;
}
</style>
<script language="javascript">
$(document).ready(function() {
$("#chonhet").click(function(){
var status=this.checked;
$("input[name='chon']").each(function(){this.checked=status;})
});
$("#xoahet").click(function(){
var listid="";
$("input[name='chon']").each(function(){
if (this.checked) listid = listid+","+this.value;
})
listid=listid.substr(1); //alert(listid);
if (listid=="") { alert("Bạn chưa chọn mục nào"); return false;}
hoi= confirm("Bạn có chắc chắn muốn xóa?");
if (hoi==true) document.location = "index.php?com=sanpham&act=delete&listid=" + listid;
});
});
</script>
<h3><a href="index.php?com=sanpham&act=add">Thêm dự án</a></h3>
Danh mục cấp 1
<?=get_main_category()?>
<script language="javascript">
function select_onchange()
{
var b=document.getElementById("id_cat");
window.location ="index.php?com=sanpham&act=man&id_cat="+b.value;
return true;
}
function select_onchange1()
{
var b=document.getElementById("id_cat");
var c=document.getElementById("id_list");
window.location ="index.php?com=sanpham&act=man&id_cat="+b.value+"&id_list="+c.value;
return true;
}
function select_onchange2()
{
var b=document.getElementById("id_cat");
var c=document.getElementById("id_list");
var a=document.getElementById("id_item");
window.location ="index.php?com=sanpham&act=man&id_cat="+b.value+"&id_list="+c.value+"&id_item="+a.value;
return true;
}
</script>
<?php
$id_cat = (int) isset($_REQUEST['id_cat']) ? $_REQUEST['id_cat'] : 0;
$id_list = isset($_REQUEST['id_list']) ? $_REQUEST['id_list'] : 0;
$id_item = isset($_REQUEST['id_item']) ? $_REQUEST['id_item'] : 0;
function get_product_cat()
{
global $d ;
$sql_danhmuc = "select id,ten as name from table_product_cat";
$d->query($sql_danhmuc);
$items = $d->result_array();
return $items;
}
$list_cat = get_product_cat();
?>
<table class="blue_table">
<tr>
<th style="width:3%" align="center"><input type="checkbox" name="chonhet" id="chonhet" /></th>
<th style="width:4%;">Stt</th>
<th style="width:4%;">Hình ảnh</th>
<th style="width:12%;">Danh mục</th>
<th>Tên dự án</th>
<th style="width:12%;">Thêm dữ liệu</th>
<th style="width:4%;">Hot</th>
<th style="width:4%;">Hiển thị</th>
<th class="w25 center">Sửa</th>
<th class="w25 center">Xóa</th>
</tr>
<?php
for($i=0, $count=count($items); $i<$count; $i++)
{
$ur="";
if(isset($_REQUEST['id_cat']) && $_REQUEST['id_cat']!='')
{
$ur="&id_cat=".$id_cat;
$ur.="&id_list=".$id_list;
}
$curPage = (isset($_REQUEST['curPage']) && $_REQUEST['curPage']!='')? '&curPage='.$_REQUEST['curPage'] : '';
$id_list = (isset($_REQUEST['id_list']) && ($_REQUEST['id_list']!='')) ? "&id_list=".$_REQUEST['id_list'] : '' ;
$id_item = (isset($_REQUEST['id_item']) && ($_REQUEST['id_item']!='')) ? "&id_item=".$_REQUEST['id_item'] : '' ;
$lb_images = (!empty($items[$i]['photo']) && file_exists(_upload_sanpham.$items[$i]['photo']))? _upload_sanpham.$items[$i]['photo'] : urlimg.'noimage.png' ;
?>
<tr>
<td style="width:3%;" align="center"><input type="checkbox" name="chon" id="chon" value="<?=$items[$i]['id']?>" class="chon" /></td>
<td style="width:4%;"><?=$items[$i]['stt']?></td>
<td style="width:4%;"><img src="<?=$lb_images?>" width="100" /></td>
<td style="width:12%;" class="cat"><?=$items[$i]['id_cat']?></td>
<td><a href="index.php?com=sanpham&act=edit&id=<?=$items[$i]['id']?>"><?=$items[$i]['ten']?></a></td>
<td style="width:8%;">
<a href="index.php?com=mausac&act=default&id_product=<?=$items[$i]['id']?>&id_cat=<?=$id_cat?>&id_list=<?=$id_list?>&id_item=<?=$id_item?>" style="text-decoration:none;" class="view-pic"> <?php echo "Thêm hình";?> </a> <br>
<a href="index.php?com=vdsp&act=default&id_product=<?=$items[$i]['id']?>&id_cat=<?=$id_cat?>&id_list=<?=$id_list?>&id_item=<?=$id_item?>" style="text-decoration:none;" class="view-pic"> <?php echo "Thêm video";?> </a></td>
<td class="w25 center"><?php if($items[$i]['hot']>0){?>
<a href="index.php?com=sanpham&act=man<?=$ur?>&hot=<?=$items[$i]['id']?><?=$curPage?>"><img src="media/images/ok.gif" border="0" /></a>
<?php }else{?>
<a href="index.php?com=sanpham&act=man<?=$ur?>&hot=<?=$items[$i]['id']?><?=$curPage?>"><img src="media/images/no.png" border="0" /></a>
<?php } ?></td>
<td class="w25 center">
<?php
if(@$items[$i]['hienthi']==1)
{
?>
<a href="index.php?com=sanpham&act=man<?=$ur;?>&hienthi=<?=$items[$i]['id']?><?=$curPage?>"><img src="media/images/active_1.png" border="0" /></a>
<?
}
else
{
?>
<a href="index.php?com=sanpham&act=man<?=$ur;?>&hienthi=<?=$items[$i]['id']?><?=$curPage?>"><img src="media/images/active_0.png" border="0"/></a>
<?php }?></td>
<td class="w25 center"><a href="index.php?com=sanpham&act=edit&id=<?=$items[$i]['id']?>"><img src="media/images/edit.png" /></a></td>
<td class="w25 center"><a href="index.php?com=sanpham&act=delete&id=<?=$items[$i]['id']?>" onClick="if(!confirm('Xác nhận xóa')) return false;"><img src="media/images/delete.png" /></a></td>
</tr>
<?php }?>
</table>
<a href="index.php?com=sanpham&act=add=<?=$id_cat?><?=$id_list?><?=$id_item?>"><img src="media/images/add.jpg" border="0" /></a>
<a href="#" id="xoahet"><img src="media/images/delete.jpg" border="0" /></a>
<div class="paging"><?=$paging['paging']?></div>
<div id="listcat" style="display:none"><?=json_encode($list_cat)?></div>
<script language="javascript">
function mkselected(id, value)
{
var loca = document.getElementById(id).options ;
for(var i=0;i<loca.length;i++){
if(loca[i].value == value)
loca[i].selected = true ;
}
}
(function($){
$.fn.extend({
showname: function(options){
var name = [{id:0,name:'Chưa chọn'}] ;
var defaults = {
data: name
}
var options = $.extend(defaults, options);
return this.each(function(){
var obj = $(this);
var list = jQuery.parseJSON(options.data);
for( i in list)
{
var id = obj.html();
if(list[i].id==id)
obj.html(list[i].name);
}
});
}
});
})(jQuery);
$(document).ready(function(e) {
mkselected('id_cat','<?=$id_cat?>');
var listcat = $('#listcat').html();
$('.cat').showname({data:listcat});
$('#id_cat').change(function(e) {
var cat_id = $(this).val();
window.location = "<?=site?>admin/index.php?com=sanpham&act=man&id_cat="+cat_id;
});
});
</script>