<?php error_reporting(0);?>
  <div class="spaceMain"> 
   <div class="mainTop"></div> 
   <div class="mainCenter"> 
    <div class="publicLeft"> 
     <div class="stageBox"> 
      <div class="stageBoxTop"> 
       <span></span> 
      </div> 
      <div class="stageBoxCenter min_space_height"> 
       <div class="x5_title"> 
         <li><a href="<?php echo rewrite_url('index.php?ac=fav&id=' . $cctvai_web_userid . '');?>" class="current">音乐</a></li>
         <li><a href="<?php echo rewrite_url('index.php?ac=vfav&id=' . $cctvai_web_userid . '');?>">视频</a></li>
<?php if($cctvai_web_userid == $CcTvAi_com_userid){ ?>
       <a href="<?php echo cd_webpath.'user/'.rewrite_url('space.php?do=music&view=favorites');?>"><span>管理</span></a>
<?php } ?>
        </div>
		<div class="space_big">
<li><a href="<?php echo rewrite_url('index.php?ac=fav&id='.$cctvai_web_userid.'');?>"<?php if($day == ""){echo " class=\"current\"";} ?>><h1>全部类型</h1></a></li>
<?php
if($day){$class=$db->getrow('select * from ' . tname('class') . " where CD_ID='" . $day . "'");}
$classsql1="select CD_ID,CD_Name from " . tname('class') . " where CD_FatherID=0 and CD_IsHide=0";
$results=$db->query($classsql1);
if($results) {
		while($class1=$db->fetch_array($results)) {
			if($class["CD_FatherID"]=="0"){$FatherID=$class["CD_ID"];}else{$FatherID=$class["CD_FatherID"];}
				if($class1['CD_ID']==$FatherID){
						echo "<li><a href='" . rewrite_url('index.php?ac=fav&id=' . $cctvai_web_userid . '&day='.$class1['CD_ID'].'')."' class=\"current\"><h1>" . $class1['CD_Name'] . "</h1></a></li>";
				} else {
						echo "<li><a href='" . rewrite_url('index.php?ac=fav&id=' . $cctvai_web_userid . '&day='.$class1['CD_ID'].'')."'><h1>" . $class1['CD_Name'] . "</h1></a></li>";
				}
		}
}
?></div>		
<?php
if($day){
if($class["CD_TieID"]!=999999){
echo'<div class="space_small">';
$classsql2="select CD_ID,CD_Name from " . tname('class') . " where CD_ID in (".$class["CD_TieID"].") and CD_IsHide=0";
$results=$db->query($classsql2);
if($results) {
	while($class2=$db->fetch_array($results)) {
		if($class2['CD_ID']==$day){
			echo "<li><a href='" . rewrite_url('index.php?ac=fav&id=' . $cctvai_web_userid . '&day='.$class2['CD_ID'].'')."' class=\"current\">" . $class2['CD_Name'] . "</a></li>";
		}else{
			echo "<li><a href='" . rewrite_url('index.php?ac=fav&id=' . $cctvai_web_userid . '&day='.$class2['CD_ID'].'')."'>" . $class2['CD_Name'] . "</a></li>";
		}
	}
}
echo'</div>';
}
}
?> 
       <div class="danceFavoritesList"> 
        <form id="list"> 
<?php
global $db;
$i=0;
if($day) {
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"]."'";
		}
		$day="&day=" . $day . "";
}

$sql="select * from " . tname('fav') . " where cd_type='dj' and cd_uid='$cctvai_web_userid'$fidsql order by cd_addtime desc";
$Arr=getwebfavpage($sql, 1, "index.php?ac=fav&id=" . $cctvai_web_userid . $day . ""); //sql,每页显示条数
$result=$db->query($Arr[2]);
$num=$db->num_rows($result);
if($num == 0) {
    if($day) {
        echo '<div class="nothing_dance">本类别没有任何音乐</div>';
    } else {
        echo '<div class="nothing_recommend">还没有收藏任何音乐。</div>';
    }
} else {
    if($result) {
        echo '<ul class="post_list">';
        echo '<li class="title">';
        echo '<div class="song">音乐/分享人</div>';
        echo '<div class="class">类别</div>';
        echo '<div class="time">收藏时间</div>';
        echo '<div class="points">扣分</div>';
        echo '<div class="impression">印象</div>';
        echo '<div class="add">播放</div>';
        echo '<div class="down">下载</div>';
        echo '</li>';
        while($row=$db->fetch_array($result)) {
            $i=$i+1;
            $music=$db->getrow("select * from " . tname('dj') . " where CD_ID='" . $row['cd_musicid'] . "'");
            if($music) {
                echo '<li';
                if($i%2 == 0) {
                    echo ' class="c2"';
                }
                echo '>';
                echo '<div class="song">';
                echo '<span class="cbox"><input id="' . $row['cd_musicid'] . '" type="checkbox" value="' . $row['cd_musicid'] . '" name="did"></span>';
                echo '<div class="aleft">';
                echo '<a href="' . LinkUrl("dj", $row['cd_classid'], 1, $row['cd_musicid']) . '" target="p" class="mname">' . getlen('len', 20, $music["CD_Name"]) . '</a>';
                echo '&nbsp;-';
                echo '<a href="' . linkweburl(GetAlias("cctvai_user", "cd_id", "cd_name", $music['CD_User']), $music['CD_User']) . '" class="nickname" target="_blank">' . GetAlias("cctvai_user", "cd_nicheng", "cd_name", $music['CD_User']) . '</a>';
                echo '</div>';
                echo '</div>';
                echo '<div class="class">' . GetAlias("cctvai_class", "CD_Name", "CD_ID", $music['CD_ClassID']) . '</div>';
                echo '<div class="time" title="' . date('Y-m-d H:i:s', $row['cd_addtime']) . '">' . datetime(date('Y-m-d H:i:s', $row['cd_addtime'])) . '</div>';
                echo '<div class="points">';
                if($music['CD_Points']) {
                    echo $music['CD_Points'];
                } else {
                    echo '免费';
                }
                echo '</div>';
                echo '<div class="impression">';
                echo '<span id="d' . $row['cd_musicid'] . '" class="icon">';
                echo '<b class="default"> </b>';
                echo '</span>';
                echo '</div>';
                echo '<div class="action">';
                echo '<a class="add" title="试听" href="' . LinkUrl("dj", $row['cd_classid'], 1, $row['cd_musicid']) . '"></a>';
                echo '</div>';
                echo '<div class="down">';
                echo '<a class="download" title="下载歌曲" href="'.DownLinkUrl(cd_webmlplay,$row['cd_musicid']).'" target="down"></a>';
                echo '</div>';
                echo '</li>';
            }
        }
        echo "</ul>\n";
        echo "<div class=\"page\">\n";
        echo "<div class=\"play_button\">\n";
        echo "<a id=\"selectAll\" class=\"select_all\" onclick=\"dancePlayer.selectAllDance('list', '');\" href=\"javascript:;\">全选</a>\n";
        echo "<a class=\"select_play\" onclick=\"dancePlayer.playDance('list');\" href=\"javascript:;\">播放</a>\n";
        echo "</div>";
        echo '<div class="page_sort"><div class="goto"><a class="go" href="javascript:void(0);" onclick="dancePlayer.getPage(' . $Arr[3] . ',\''.cd_webpath.cd_webmlsinger.'/index.php?ac=fav&id=' . $cctvai_web_userid . '&day='.$day.'&pages=!!PageNum!!\');return false;"><span>确定</span></a><span class="other">转到<input name="pageNum" id="pageNum" type="text" size="4" class="pageNum" maxlength="4" value="' . $Arr[3] . '" onClick="this.value=\'\';" />页</span></div><ul class="page_link">' . $Arr[0] . '</ul></div>';
        echo "<div id=\"currPage\">" . $Arr[4] . "</div>";
        echo "</div>";
    }
}
?>
        </form> 
       </div> 
      </div> 
      <div class="stageBoxBottom"> 
       <span></span> 
      </div> 
     </div> 
    </div> 
    <div class="publicRight"> 
<?php include "source/cctvai_right.php"; ?> 
    </div> 
   </div> 
   <div class="mainBottom"></div> 
  </div> 
<?php include "source/cctvai_footer.php"; ?>  
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/jquery/jquery.min.js"></script>
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/core.js"></script>
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/card.js"></script>
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/dialog.js"></script>
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/jquery/jquery.plugins.js"></script>
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/space/js/common.js"></script>
  <script type="text/javascript">listenMsg.start();nav.init();nav.userMenu();</script>
  </body>
</html>