<?php

/*
'**************************************************************************************************
' 程序名称: CCTVAI开源音乐管理系统
' 官方网站: http://www.cctvai.com
' 联系 Q Q: 1542367792
' QQ交流群：136687984
' 版本：(终结版)
' 备注：未经书面授权，不得向任何第三方提供本软件系统！
' 功能，模板，插件，扩展，定制请联系QQ：1542367792
'**************************************************************************************************
*/
error_reporting(0);
//if (!eregi($_SERVER['SERVER_NAME'], $_SERVER['HTTP_REFERER'])) { exit();}
header("Content-type: text/html;charset=gb2312");
include "../../include/cctvai.conn.php";
$ac= SafeRequest("ac", "get");
if($ac) {
	switch($ac) {
		case 'dance':$class='class';break;
		case 'video':$class='videoclass';break;
		case 'malbum':$class='malbumclass';break;
		case 'valbum':$class='valbumclass';break;
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="/www.w3.org/1999/xhtml">
 <head> 
  <meta http-equiv="Content-Type" content="text/html; charset=gbk" /> 
  <title>分类选择</title> 
  <link href="style.css" rel="stylesheet" type="text/css" /> 
 </head> 
 <body> 
<script type="text/javascript">
function ReturnValue(reimg){
this.parent.document.form.rclassId.value=reimg;
this.parent.$.tipMessage('OK！', 0, 1000);
this.parent.layer.closeAll();
}
</script>
  <div class="popDiyTags-form form-box"> 
<?php
function Get_Fclass($id,$class) { 
global $db;
$Fsql="select CD_ID,CD_Name from " . tname($class) . " where CD_FatherID='".$id."' and CD_IsHide=0 order by CD_TheOrder asc";
$Fresult=$db->query($Fsql);
    if($Fresult && $db->num_rows($Fresult)){
        while($Frow=$db->fetch_array($Fresult)) { 
            $str .= '<dd><a href="javascript:ReturnValue(\''.$Frow['CD_ID'].'\');">'.$Frow['CD_Name'].'</a></dd>';
            Get_Fclass($Frow['CD_ID']); 
        } 
    } 
    return $str; 
}
global $db;
$sql="select CD_ID,CD_Name from " . tname($class) . " where CD_FatherID=0 and CD_IsHide=0 order by CD_TheOrder asc";
$result=$db->query($sql);
$classnum=$db->num_rows($result);
if($result) {
	while($row=$db->fetch_array($result)) {
?>
   <dl class="popDiyTags-list clearfix">
    <dt><?php echo $row['CD_Name']?></dt>
    <dd><a href="javascript:ReturnValue('<?php echo $row['CD_ID']?>');"><?php echo $row['CD_Name']?></a></dd>
<?php
echo get_Fclass($row['CD_ID'],$class);
echo'</dl>';
}
}
?>
  </div>  
 </body>
</html>