<?php
/*
'**************************************************************************************************
' 程序名称: CCTVAI开源音乐管理系统
' 官方网站: http://www.cctvai.com
' 联系 Q Q: 1542367792
' QQ交流群：136687984
' 版本：(终结版)
' 备注：未经书面授权，不得向任何第三方提供本软件系统！
' 功能，模板，插件，扩展，定制请联系QQ：1542367792
'**************************************************************************************************
*/
error_reporting(0);
if($classid){$class=$db->getrow('select * from ' . tname('class') . " where CD_ID='" . $classid . "'");}
?>
<script type="text/javascript" src="js/jquery.js"></script>
<link type="text/css" rel="stylesheet" href="css/list.css" /> 
<?php 
if($view==""){?>
   <div class="tag-list"> 
    <div class="tag-section">
	<a href="index.php?ac=gdmusic" class="on tag-item"><span>收藏的音乐</span></a>
	<a href="index.php?ac=gdmusic&view=down" class="tag-item"><span>下载的音乐</span></a>
	<a href="index.php?ac=gdvideo" class="tag-item"><span>收藏的视频</span></a>
	<a href="index.php?ac=gdvideo&view=down" class="tag-item"><span>下载的视频</span></a>
    </div>  	
   </div> 
  <span onclick="shareready();" class="x5-btn x5-btn-warning" style="float: right;margin: 10px;">按分类查看</span>
  <div class="x5-tc">
    <div class="x5-tc-popover"> 
     <div class="x5-tc-poptit"> 
      <b title="关闭" class="close" onclick="shareclose();">&times;</b> 
      <h3>按分类选择查看</h3> 
     </div> 
     <div class="x5-tc-popbod"> 
  <div class="popDiyTags-form form-box"> 
<?php
$classq='class';
function Get_Fclass($id,$classq) { 
global $db;
$Fsql="select CD_ID,CD_Name from " . tname($classq) . " 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="?ac=gdmusic&classid='.$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($classq) . " 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="?ac=gdmusic&classid=<?php echo $row['CD_ID']?>"><?php echo $row['CD_Name']?></a></dd>
<?php
echo get_Fclass($row['CD_ID'],$classq);
echo'</dl>';
}
}
?>
  </div> 
     </div> 
    </div> 
    </div> 
    <div class="x5-tc-popover-mask"></div>
  <div class="dance-list"> 
  <div class="head"><strong><?php if($classid){echo $class['CD_Name'];}else{ echo '我收藏的音乐';}?></strong></div> 
  <ul>
<?php
global $db;
if($classid) {
if(cd_zclass=="1"){
	if($class["CD_FatherID"]==0){$fidsql=" and CD_ClassID in (".rtrim($class["CD_ID"].','.$class['CD_TieID'], ',').")";}else{$fidsql=" and CD_ClassID='".$class["CD_ID"]."'";}
	}else{
		$fidsql=" and CD_ClassID='".$class["CD_ID"]."'";
		}
}
$djsql="select * from " . tname('fav') . " where cd_type='dj'$fidsql and cd_uid='" . $CcTvAi_com_userid . "' order by cd_addtime desc";
$Arr=getuserpage($djsql, 30); //sql,每页显示条数
$result=$db->query($Arr[2]);
$num=$db->num_rows($result);
if($num==0) {
		echo '<center>暂无收藏的音乐</center>';
} else {
	if($result) {
		while($fav=$db->fetch_array($result)) {
			$dj=$db->getrow("select CD_ID,CD_Name from " . tname('dj') . " where CD_ID='" . $fav['cd_musicid'] . "'");
	echo '<li> <a href="../play_p.php?id='.$dj['CD_ID'].'" target="songs">  <span class="songname">&middot;'.$dj['CD_Name'].'</span></a><a style="float: right;padding: 0 0px;" href="do.php?ac=delgddjfav&id='.$fav['cd_id'].'"  onClick="return confirm(\'确定要删除收藏吗?\');"><i class="delete"></i></a></li>';
}
} 
}
?>
  </ul>
  <div class="page"><?php echo $Arr[0];?></div>
  </div> 
<?php 
}elseif($view=="down"){?>
   <div class="tag-list"> 
    <div class="tag-section">
	<a href="index.php?ac=gdmusic" class="tag-item"><span>收藏的音乐</span></a>
	<a href="index.php?ac=gdmusic&view=down" class="on tag-item"><span>下载的音乐</span></a>
	<a href="index.php?ac=gdvideo" class="tag-item"><span>收藏的视频</span></a>
	<a href="index.php?ac=gdvideo&view=down" class="tag-item"><span>下载的视频</span></a>
    </div>  	
   </div> 
  <span onclick="shareready();" class="x5-btn x5-btn-warning" style="float: right;margin: 10px;">按分类查看</span>
  <div class="x5-tc">
    <div class="x5-tc-popover"> 
     <div class="x5-tc-poptit"> 
      <b title="关闭" class="close" onclick="shareclose();">&times;</b> 
      <h3>按分类选择查看</h3> 
     </div> 
     <div class="x5-tc-popbod"> 
  <div class="popDiyTags-form form-box"> 
<?php
$classq='class';
function Get_Fclass($id,$classq) { 
global $db;
$Fsql="select CD_ID,CD_Name from " . tname($classq) . " 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="?ac=gdmusic&view=down&classid='.$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($classq) . " 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="?ac=gdmusic&view=down&classid=<?php echo $row['CD_ID']?>"><?php echo $row['CD_Name']?></a></dd>
<?php
echo get_Fclass($row['CD_ID'],$classq);
echo'</dl>';
}
}
?>
  </div> 
     </div> 
    </div> 
    </div> 
    <div class="x5-tc-popover-mask"></div>
  <div class="dance-list"> 
  <div class="head"><strong><?php if($classid){echo $class['CD_Name'];}else{ echo '我下载的音乐';}?></strong></div> 
  <ul>
<?php
global $db;
if($classid) {
if(cd_zclass=="1"){
	if($class["CD_FatherID"]==0){$fidsql=" and CD_ClassID in (".rtrim($class["CD_ID"].','.$class['CD_TieID'], ',').")";}else{$fidsql=" and CD_ClassID='".$class["CD_ID"]."'";}
	}else{
		$fidsql=" and CD_ClassID='".$class["CD_ID"]."'";
		}
}
$djsql="select * from " . tname('down') . " where cd_type='dj'$fidsql and cd_uid='" . $CcTvAi_com_userid . "' order by cd_addtime desc";
$Arr=getuserpage($djsql, 30); //sql,每页显示条数
$result=$db->query($Arr[2]);
$num=$db->num_rows($result);
if($num==0) {
		echo '<center>暂无下载的音乐</center>';
} else {
	if($result) {
		while($down=$db->fetch_array($result)) {
			$dj=$db->getrow("select CD_ID,CD_Name from " . tname('dj') . " where CD_ID='" . $down['cd_musicid'] . "'");
	echo '<li> <a href="../play_p.php?id='.$dj['CD_ID'].'" target="songs">  <span class="songname">&middot;'.$dj['CD_Name'].'</span></a><a style="float: right;padding: 0 0px;" href="do.php?ac=delgddjdown&id='.$down['cd_id'].'"  onClick="return confirm(\'确定要删除下载吗?\');"><i class="delete"></i></a></li>';
}
} 
}
?>
  </ul>
  <div class="page"><?php echo $Arr[0];?></div>
  </div> 
<?php }?>