<style type=text/css>
A:link{color:#FFFFFF;font-size:13px;}
A:visited{color:#FFFFFF;text-decoration:none;}
A:hover{text-decoration:underline;}
TD{text-align:center;font-size:12px;background-color:#E6E6E6;border:#FFFFFF solid 1px;color:#198281;height:20px;}
TD.title{background-color:#9a9a9a;color:#FFFFFF;font-weight:bold;}
TABLE{border-collapse:collapse;border-color:white;border:#198281 solid 1px;}
</style>
<?php
include("require.php");
submitfilter(1,$_GET['id']);
date_default_timezone_set("Asia/Shanghai");
$today = time();
$year =@ $_GET["year"];
$month = @$_GET["month"];
if($year=='') $year = date("Y",$today);
if($month=='') $month = date("m",$today);
$phpcolor->table=$core_mysql_prefix."qiandao";
$phpcolor->field="*";
$phpcolor->where="belong = '".$_GET['id']."' and year(published)=".$year." and month(published)=".$month." order by id";
$qiandao=$phpcolor->assignment();
if((int)$month==0){$year-=1;$month=12;}
$time = mktime(0,0,0,$month,1,$year);
$year = date('Y',$time);
$month = date('m',$time);
echo "<table width=250 cellspacing=0 cellpadding=0 height='280'>";
echo "<tr><td colspan=7 class=title>";
$str   = "<a href=?year=".($year-1)."&month=".$month."&id=".$_GET['id'].">";
$str .= "<<</a> ".$year."年 ";
$str .= "<a href=?year=".($year+1)."&month=".$month."&id=".$_GET['id'].">";
$str .= ">></a>   ";
$str .= "<a href=?year=".$year."&month=".($month-1)."&id=".$_GET['id'].">";
$str .= "<<</a> ".$month."月 ";
$str .= "<a href=?year=".$year."&month=".($month+1)."&id=".$_GET['id'].">";
$str .= ">> </a>";
echo $str;
echo "</td></tr>";
echo     "<tr>";
$str   = "<td>一</td>";
$str .= "<td>二</td>";
$str .= "<td>三</td>";
$str .= "<td>四</td>";
$str .= "<td>五</td>";
$str .= "<td>六</td>";
$str .= "<td>日</td>";
echo $str;
echo "</td>";
//这个月有多少天
$days = date('t',$time);
$x=0;
for($i=1;$i<=$days;$i++)
{
  $j=$i;
  if(strlen($j)==1)
    $j="0".$i;
  $riqi=$year."-".$month."-".$j;
  if(eregi($riqi,$qiandao[$x]['published']))
  {
    $qd[$i]=$qiandao[$x];
	$x++;
  }
}
//第一天是星期几
$fstdw = date('N',$time);
//要输出多少行
$rows = ceil(($days + $fstdw-1)/7);
$cd = 1;
for($i=0;$i<$rows;$i++)
{
  echo "<tr>";
  for($j=0;$j<7;$j++)
  {
    echo "<td>";
    if($cd >= $fstdw && $cd<$days+$fstdw)
    {
      $oday = $cd-$fstdw+1;
	  if($qd[$oday]["biaoqing"]!="")
	    echo '<img src="images/qiandao/'.$qd[$oday]["biaoqing"].'.gif"  width="25" height="25" title="'.$qd[$oday]["content"].'"><br>';
	  else
	    echo '<img src="images/phpcolor/rili.jpg"  width="25" height="25"><br>';
      if($oday==date('d',time()))
        echo "<b><u>";
      echo $oday;
    }
    else
    {
      echo " ";
    }
    $cd++;
    echo "</td>";
  }
  echo "</tr>";
}
echo "</table>";
?>