<?php

$toandanhmuc = $_POST['CheckAllCate' . $idcommon] != '' ? 1 : 0;
//NEU CHON TOAN BO DANH MUC
//them moi vo bang tbl_module_pro_common
$where11 = whereParentLevel($tableCategoryConfigId, $parent_categor);
$sqlcommon_pro = "select * from {$tableConfigId} where {$where11} or id=" . $oldid . " and {$whereStatus}";
$resultcommon_pro = @mysql_query($sqlcommon_pro, $conn);
while ($common_pro = @mysql_fetch_array($resultcommon_pro)) {
    if ($toandanhmuc == '0') {
        //KIEM TRA CO CHON TOAN BO DANH MUC HAY KHONG
        $commonDef = $common_pro['id'] == $oldid ? '1' : '0';
    } elseif ($toandanhmuc == '1') {
        //NEU CHON TAON BO DANH MUC
        $commonDef = 1;
    }
    //KIEM TRA CO CHON TOAN BO DANH MUC HAY KHONG===KET THUC
    $id_common_pro = $common_pro['id'];
    $id_common_pro_parent = $common_pro['parent'];
    $fields_arrcommon_pro = array("id_parent" => "{$id_parent}", "id_code" => "'{$oldid}'", "id_pro_common" => "'{$id_common_pro}'", "id_common" => "'{$idcommon}'", "parent_categor" => "'{$id_common_pro_parent}'", "common" => "{$commonDef}", "status" => "0", "date_added" => "now()", "last_modified" => "now()");
    if (!countRecord($tableConfigCommon_product, "id_code=" . $oldid . " and id_common=" . $idcommon . " and id_pro_common=" . $id_common_pro)) {
        //kiem tra neu trong bang chua co thi them moi
        $resultcommon_proInsertDD = insert($tableConfigCommon_product, $fields_arrcommon_pro);
    }
}
if ($toandanhmuc == '0') {
    //KIEM TRA CO CHON TOAN BO DANH MUC HAY KHONG
    //update them moi
    if ($_POST['common' . $idcommon] != '') {
        $wherecommon_pro = '';
        foreach ($_POST['common' . $idcommon] as $idcommon_pro) {
</td>
      </tr>
    </table></td>
  </tr>
  <tr>
   
   
   <td align="left" colspan="2" valign="top" id="showComes_div">
	
	
	
	
	<?php 
//echo $comes;
if ($comes != '0' and $comes != '') {
    $whereComes = whereParentLevel($tableCategoryConfigId, $comes);
    $showComesAll = '
<div class="div_scroll" style="height:160px; width:95%; float:left">
<table  border="0" cellspacing="0" cellpadding="0">';
    $sqlComes = "select * from {$tableConfigId} where " . $whereComes;
    $resultComes = mysql_query($sqlComes, $conn);
    while ($Comes = mysql_fetch_array($resultComes)) {
        $id_common_pro_parent = $Comes['parent'];
        $CommonName1 = getRecord($tableConfig, 'id_code=' . $Comes['id'] . " and lang='" . $_lang_A . "'");
        $checkeComesShow = countRecord($tableConfigComes_product, 'id_code=' . $oldid . ' and id_comes=' . $Comes['id'] . '  and comes=1');
        $checkedshowCommonAllDefault = $checkeComesShow == 1 ? 'checked="checked"' : '';
        $showComesAll .= '
 <tr>
    <td align="left" valign="middle" class="smallfont" style="padding-left:2px; padding-right:4px;">
			 <input name="comesChack[]" id="comesChack' . $Comes['id'] . '" type="checkbox"  value="' . $Comes['id'] . '"  ' . $checkedshowCommonAllDefault . ' />			 	</td>
    <td align="left"  valign="middle" class="smallfont" style="padding-left:0px; padding-right:4px;">' . $CommonName1['name'] . '</td>
 $con_type4 = '';
 //kiem tra danh muc nay co menu con khong
 $con_typeShow4 = '';
 $keywords4 = strip_tags(str_replace('"', "", $rowMenuProductNam4['keywords']));
 $description4 = strip_tags(str_replace('"', "", $rowMenuProductNam4['description']));
 $array_where1 .= ",'" . $IdMenuProduct4 . "'";
 $array_where2 .= ",'" . $IdMenuProduct4 . "'";
 $array_where3 .= ",'" . $IdMenuProduct4 . "'";
 $nameMenuProduct4 = str_replace($ojer, $ojers, $rowMenuProductNam4['name']);
 $titleMenuProduct4 = str_replace($ojer, $ojers, $rowMenuProductNam4['title_t']);
 $IdMenuProduct4 = $rowMenuProduct4['id'];
 $urlMenuProduct4 = $rowMenuProductNam4['url'];
 $parentMenuProduct4 = $rowMenuProduct4['parent'];
 $parentMenuProduct4_1 = $rowMenuProduct4['parent_1'];
 $imageProduct4 = $rowMenuProduct4['image'];
 $whereProduct4 = "(" . whereParentLevel($tableCategoryNewId, $IdMenuProduct4) . ")";
 $totalProduct4 = countRecord($tableNewId, $whereProduct4);
 //tong sp muc nay
 $totalProductShow4 = $totalProduct4 > 0 ? $totalProduct4 : 0;
 $whereMenuCon_type4 = "parent=" . $IdMenuProduct4;
 $con_type4 = countRecord($tableCategoryNewId, $whereMenuCon_type4);
 //kiem tra danh muc nay co menu con khong
 $con_typeShow4 = $con_type4 > 0 ? $con_type4 : 0;
 //exp parent url=========================================1
 $exp_parent4 = '<?php $' . 'url_c	= "' . $urlMenuProduct4 . '"; $' . 'name_c	= "' . $nameMenuProduct4 . '"; ?>';
 $ft_p4 = "../inc/new/" . $IdMenuProduct4 . $ln . ".inc";
 $ft_p4 = fopen($ft_p4, "w");
 fwrite($ft_p4, $exp_parent4);
 @chmod($ft_p4, 0777);
 $urlCodeUpXml4 = trim(str_replace("-", "", $urlMenuProduct4));
 $exp_url4 = '<?php $' . 'parent_1_c	= "' . $parentMenuProduct4_1 . '"; $' . 'parent_c	= "' . $IdMenuProduct4 . '"; $' . 'name_c	= "' . $nameMenuProduct4 . '"; $' . 'title_c	= "' . $titleMenuProduct4 . '"; $' . 'descriptionMeta_category	= "' . $description4 . '"; $' . 'keywordsMeta_category	= "' . $keywords4 . '"; ?>';
Ejemplo n.º 4
0
                $whereNewAll = "parent_1=" . $parent_1_c . " and " . $whereLang;
            } else {
                if ($parent_1_c == 120) {
                    $whereNewAll = "(parent2=" . $parent_c . " or type_search=" . $parent_c . ")";
                } else {
                    $array_search = explode('_', $code_frame);
                    $type_seach = $array_search[1];
                    if ($type_seach != '') {
                        $typeSearchAll = getRecord($tableCategoryNew, "url='" . $type_seach . "' and " . $whereLang);
                        if ($typeSearchAll['parent'] == 346) {
                            $whereNewAll = " and parent2=" . $typeSearchAll['id_code'];
                        } else {
                            $whereNewAll = " and type_search=" . $typeSearchAll['id_code'];
                        }
                    }
                    $whereNewAll = whereParentLevel($tableCategoryNewId, $parent_c) . $whereNewAll;
                    //"parent=".$parent_c." and ".$whereLang;
                }
                //$rowCategoryName		=	getRecord($tableCategoryNew,"id_code='".$parent_1_c."' and ".$whereLang);
                ///$showHtmlTitlePage		=	"<a href=\"".$serverName.$rowCategoryName['url']."/\" title=\"".$rowCategoryName['name']."\">".$rowCategoryName['name']."</a> &nbsp; / &nbsp;";
            }
            $whereOthe = "parent_1=" . $parent_1 . " and id_code<>{$idProduct}";
            //DANH MUC TITLE PAGE===========================================================TOP
            $titlePage = $name_title_c;
            $keywordsMeta = $keywordsMeta_category != '' ? $keywordsMeta_category : METAKEYWORDSHOME;
            $descriptionMeta = $descriptionMeta_category != '' ? $descriptionMeta_category : METADESCRIPTIONHOME;
            include $folderNew . "/home.php";
            //DANH MUC TITLE PAGE===========================================================TOP-KET THUC
        }
        break;
}

<?php 
$_lang = $_GET['lang'];
require "../../qweasd/hoanghung.php";
require "../../qweasd/common_start.php";
include "../../lib/func.lib.php";
include 'table_act.php';
$idCategory = $_GET['idCategory'];
$idType = $_GET['idType'];
$idproduct = $_GET['idproduct'];
?>


<?php 
$where = whereParentLevel($tableCategoryConfigId, $idCategory);
$showCommonAll = '
<div class="div_scroll" style="height:160px; width:95%; float:left">
<table  border="0" cellspacing="0" cellpadding="0">';
$sqlCommon1 = "select * from {$tableConfigId} where " . $where;
$resultCommon1 = mysql_query($sqlCommon1, $conn);
while ($Common = mysql_fetch_array($resultCommon1)) {
    $id_common_pro_parent = $Common['parent'];
    $CommonName = getRecord($tableConfig, 'id_code=' . $Common['id'] . " and lang='" . $_lang . "'");
    $checkedshow = getRecord($tableConfigCommon_product, 'id_pro_common=' . $Common['id'] . " and id_common=" . $idType . " and parent_categor=" . $id_common_pro_parent . " and id_code=" . $idproduct);
    $checkedshowCommonAllDefault = $checkedshow['common'] == 1 ? 'checked="checked"' : '';
    $showCommonAll .= '
 <tr>
    <td align="left" valign="middle" class="smallfont" style="padding-left:2px; padding-right:4px;">
			 <input name="common' . $idType . '[]" type="checkbox"  value="' . $Common['id'] . '"  ' . $checkedshowCommonAllDefault . ' />			 	</td>
    <td align="left"  valign="middle" class="smallfont" style="padding-left:0px; padding-right:4px;">' . $CommonName['name'] . '</td>
         $urlMenuProduct1 = $rowMenuProduct1Nam['url'];
         $urlHrefMenuProduct1 = $serverName . $moduleProductName . "/" . $urlMenuProduct1 . "/" . $ln;
         //LAY DANH MUC MENU ref_type=library-booksCon============================
         $whereProductLibrarybooks1 = "(" . whereParentLevel($tableCategoryProductId, $IdMenuProduct1) . ") and type_member=0";
         $totalProductDanhmucLibrarybooks1 = countRecord($tableProductId, $whereProductLibrarybooks1);
         $totalProductDanhmucHtmlLibrarybooks1 = $totalProductDanhmucLibrarybooks1 > 0 ? '<span>(' . $totalProductDanhmucLibrarybooks1 . ')</span>' : '<span>(0)</span>';
         $showHtmlMenuProductLibrarybooksCon .= '<li><a href=\\"' . $urlHrefMenuProduct1 . '?ref_type=librarybooks\\" title=\\"' . $nameMenuProduct1 . '\\">' . $nameMenuProduct1 . $totalProductDanhmucHtmlLibrarybooks1 . '</a></li>';
         //LAY DANH MUC MENU ref_type=library-booksCon============================KET THUC
         //LAY DANH MUC MENU ref_type=library-sharebooks============================
         $whereProductsharebooks1 = "(" . whereParentLevel($tableCategoryProductId, $IdMenuProduct1) . ") and type_member=1";
         $totalProductDanhmucsharebooks1 = countRecord($tableProductId, $whereProductsharebooks1);
         $totalProductDanhmucHtmlsharebooks1 = $totalProductDanhmucsharebooks1 > 0 ? '<span>(' . $totalProductDanhmucsharebooks1 . ')</span>' : '<span>(0)</span>';
         $showHtmlMenuProductsharebooksCon .= '<li><a href=\\"' . $urlHrefMenuProduct1 . '?ref_type=sharebooks\\" title=\\"' . $nameMenuProduct1 . '\\">' . $nameMenuProduct1 . $totalProductDanhmucHtmlsharebooks1 . '</a></li>';
         //LAY DANH MUC MENU ref_type=library-sharebooks============================KET THUC
         //LAY DANH MUC MENU ref_type=library-audiobooks============================
         $whereProductaudiobooks1 = "(" . whereParentLevel($tableCategoryProductId, $IdMenuProduct1) . ") and type_book=1";
         $totalProductDanhmucaudiobooks1 = countRecord($tableProductId, $whereProductaudiobooks1);
         $totalProductDanhmucHtmlaudiobooks1 = $totalProductDanhmucaudiobooks1 > 0 ? '<span>(' . $totalProductDanhmucaudiobooks1 . ')</span>' : '<span>(0)</span>';
         $showHtmlMenuProductaudiobooksCon .= '<li><a href=\\"' . $urlHrefMenuProduct1 . '?ref_type=audiobooks\\" title=\\"' . $nameMenuProduct1 . '\\">' . $nameMenuProduct1 . $totalProductDanhmucHtmlaudiobooks1 . '</a></li>';
         //LAY DANH MUC MENU ref_type=library-audiobooks============================KET THUC
     }
     $showHtmlMenuProductLibrarybooksConView = '<span class=\\"submenu\\" id=\\"sub' . $IdMenuProduct . '\\"><ul>' . $showHtmlMenuProductLibrarybooksCon . '</ul></span>';
     $showHtmlMenuProductLibrarybooksConSub = 'onmouseover=\\"SwitchMenu(' . "'sub" . $IdMenuProduct . "')" . '\\"';
     $showHtmlMenuProductsharebooksConView = '<span class=\\"submenu\\" id=\\"sub' . $IdMenuProduct . '\\"><ul>' . $showHtmlMenuProductsharebooksCon . '</ul></span>';
     $showHtmlMenuProductsharebooksConSub = 'onmouseover=\\"SwitchMenu(' . "'sub" . $IdMenuProduct . "')" . '\\"';
     $showHtmlMenuProductaudiobooksConView = '<span class=\\"submenu\\" id=\\"sub' . $IdMenuProduct . '\\"><ul>' . $showHtmlMenuProductaudiobooksCon . '</ul></span>';
     $showHtmlMenuProductaudiobooksConSub = 'onmouseover=\\"SwitchMenu(' . "'sub" . $IdMenuProduct . "')" . '\\"';
 } else {
     $showHtmlMenuProductLibrarybooksConSub = "";
     $showHtmlMenuProductLibrarybooksConView = "";
     $showHtmlMenuProductLibrarybooksCon = "";
<tr>
<td  height="25" align="left" valign="middle" class="normalfont" style="border-bottom-color:#CCCCCC; font-weight:500; padding-left:' . $padding . 'px; padding-right:3px; background:#fff">  ' . $linkAllLeft1 . '
</td>
</tr>

';
        ///lay con cua cap 1-----------------------------------------------------------------
        $sql2 = "select * from {$tableCategoryConfigId}  where parent=" . $row1['id'] . " {$whereSachdient}  and {$whereStatus} {$sortby} ";
        $result2 = @mysql_query($sql2, $conn);
        while ($row2 = @mysql_fetch_array($result2)) {
            //vong while lay tat cap 2
            $defauName2 = getRecord($tableCategoryConfig, " id_code=" . $row2['id'] . " and lang='" . $_lang_A . "'");
            $padding2 = 6;
            $totalProduct = countRecord($tableConfigId, $wherePostNew . "parent=" . $row2['id']);
            if ($totalProduct == 0) {
                $where = whereParentLevel($tableCategoryConfigId, $row2['id']);
                $sqlcount21 = "select count(id) as numrow1 from {$tableConfigId} where {$where}";
                $querycount21 = @mysql_query($sqlcount21, $conn);
                $rowcount21 = @mysql_fetch_assoc($querycount21);
                $totalProduct = $rowcount21['numrow1'];
            }
            $sqlcount2 = "select count(id) as numrow from {$tableCategoryConfigId} where parent=" . $row2['id'];
            $rowcount2 = mysql_query($sqlcount2, $conn);
            $rowcount2 = mysql_fetch_assoc($rowcount2);
            $rowcount2 = $rowcount2['numrow'];
            if ((countRecord($tableUserLevel, $whereLevelId . " parent_level1=" . $row2['id']) > 0 or $rowcount > 0 or $_SESSION['level'] > 0) and $rowcount2 < 1) {
                $linkAllLeft2 = '<a href="./?act=' . $row2['code_module'] . '&codeParent=' . $row2['id'] . '&lang=' . $_lang_A . '">' . $defauName2['name'] . '</a>(' . $totalProduct . ')';
                $linkAllLeftCate2 = '<b><a href="./?act=module_new_category&codeParent=' . $row2['id'] . '&typec=0&lang=' . $_lang_A . '">' . $defauName2['name'] . '</a></b>';
            } else {
                $linkAllLeftCate2 = '<b><a href="./?act=module_new_category&codeParent=' . $row2['id'] . '&typec=0&lang=' . $_lang_A . '">' . $defauName2['name'] . '</a></b>';
                $linkAllLeft2 = "<label style=\"color:#7E0101;font-weight:bold;\">" . $defauName2['name'] . "(" . $totalProduct . ")</label>";