$theloai = "ebook"; $listdanhmuc = DanhMuc::LayDanhMucEbook(); break; } ?> <div class="tab-left">Danh mục <?php echo $theloai; ?> </div> <ul class="cont-menu"> <?php foreach ($listdanhmuc as $dm) { echo '<li>'; echo '<a class="collapse" > ' . $dm->Ten . ' </a>'; echo '<ol>'; $ldmc = DanhMucCon::LayTheoDanhMuc($dm->ID); $type = "ebook"; if (isset($_GET['type'])) { $type = $_GET['type']; } foreach ($ldmc as $dmc) { $s = $dmc->ID == $selected ? 'id = "selected"' : ''; echo '<li ' . $s . '><a href="index.php?type=' . $type . '&d=' . $dmc->ID . '"> ' . $dmc->Ten . ' </a></li>'; } echo '</ol>'; echo '</li>'; } ?> </ul> </div>
</th> <th> <a href="#">Mô tả</a> </th> <th> <a href="#">Danh mục</a> </th> <th> Tác vụ </th> </tr> </thead> <tbody> <!--Danh sách tài khoản--> <?php $dsdanhmuccon = DanhMucCon::LayTatCa(); foreach ($dsdanhmuccon as $dmc) { ?> <tr id="<?php echo 'danhmuccon' . $dmc->ID; ?> " content='<?php echo json_encode($dmc, JSON_UNESCAPED_UNICODE); ?> '> <td> <?php echo $dmc->ID; ?> </td>
function ShowProduct($id, $danhmuc, $ten, $mota, $nguoiupload, $luotxem, $luotdownload, $hinhanh, $loaifile, $type, $idnguoiupload) { if (is_numeric($danhmuc)) { $danhmuc = DanhMucCon::LayTenDanhMucConTheoID($danhmuc); } $tip = ShowTableTip($ten, $danhmuc, $mota, $loaifile); echo '<div class="item" item="' . $id . '"> <p>'; Showiconhover($id, $loaifile); echo '</p> <p><center><a href="?act=xem&type=' . $type . '&item=' . $id . '"> <img class="itemimg" tip="' . $tip . '" src="' . $hinhanh . '" ></a></center></p> <p><a href="?act=xem&type=' . $type . '&item=' . $id . '">' . $ten . '</a></p> <p><span>Chia sẻ: </span><span><a href="?act=view&k=' . $idnguoiupload . '">' . $nguoiupload . '</a></span></p> <p><span>Lượt xem: </span><span>' . $luotxem . '</span></p> <p><span>Tải về: </span><span>' . $luotdownload . '</span></p> </div>'; }
echo $tl->ID; ?> ')"><img src="imagestyle/remove.png" title="Xóa"></a> </td> </tr> <?php } ?> </tbody> </table> </center> </div> <script> var data = jQuery.parseJSON('<?php echo json_encode(DanhMucCon::LayDSDanhMucCon(), JSON_UNESCAPED_UNICODE); ?> '); function CapNhatDanhMuc() { var loai = $('#dfloai').val(); $('#dfdanhmuc').children().remove(); $.each(data[loai], function (tenloai, dulieu) { $('#dfdanhmuc').append('<option value="' + tenloai + '">' + tenloai + '</option>'); }); } function CapNhatDanhMucCon() { var loai = $('#dfloai').val(); var danhmuc = $('#dfdanhmuc').val(); $('#dftendanhmuccon').children().remove();
$result = -3; //khong dươc phep include_once '../include/functions.php'; include_once '../objects/taikhoan.php'; include_once '../objects/danhmuccon.php'; if (isset($_SESSION['taikhoan'])) { $tk = unserialize($_SESSION['taikhoan']); if ($tk->Admin == 1) { if (isset($_GET['HanhDong']) && isset($_GET['Ten']) && isset($_GET['DanhMuc'])) { $hanhdong = $_GET['HanhDong']; $ten = $_GET['Ten']; $mota = $_GET['MoTa']; $danhmuc = $_GET['DanhMuc']; if (strlen($hanhdong) > 0 && strlen($ten) > 0 && strlen($danhmuc) > 0) { switch ($hanhdong) { case "them": $result = DanhMucCon::ThemDanhMucCon($ten, $mota, $danhmuc); break; case "sua": $result = DanhMucCon::SuaDanhMucCon($_GET['ID'], $ten, $mota, $danhmuc); break; } } else { $result = -2; //thieu thong tin } } } } echo $result; //-1 da co, 0 khong duoc, 1 ok
public static function XoaDanhMucConTheoDanhMuc($idDanhMuc) { $arrDanhMucCon = DanhMucCon::LayTheoDanhMuc($idDanhMuc); foreach ($arrDanhMucCon as $value) { //echo $value->ID.'</br>'; DanhMucCon::XoaDanhMucCon($value->ID); } }
public static function XoaDanhMuc($id) { DanhMucCon::XoaDanhMucConTheoDanhMuc($id); $query = "DELETE FROM danhmuc WHERE ID = '{$id}'"; $r = Query($query); if (mysql_affected_rows() > 0) { return 1; } else { return 0; } }