12 && $j > 12){
$j = 1; $y++;
}
$img[$i] = '';
/*if($j == date("n") && $y == date("Y")){
$img[$i] = '';
}*/
$j++;
}
//
$image = '';
foreach($img as $val){
$image .= ''.$val.''."\n";
}
/*$navi = '';*/
$list_y = date("Y");
$list_m = date("n");
if($_SERVER['REQUEST_METHOD'] == "GET"){
if(isset($_GET['y']) && isset($_GET['m'])){
$image = "";
$on_y = $_GET['y'];
$on_m = $_GET['m'];
$y = date("Y");
$st = date("n");
$en = $st+12;
$j = $st;
for($i = $st;$i <= $en;$i++){
if($i > 12 && $j > 12){ $j = 1; $y++;}
$img[$i] = '';
/*if($j == $on_m && $y == $on_y){
$img[$i] = '';
}*/
$j++;
}
foreach($img as $val){
$image .= ''.$val.''."\n";
}
/*$navi = '';*/
$list_y = $on_y;
$list_m = $on_m;
}
}
$last_d = date("d",mktime(0,0,0,$list_m+1,0,$list_y));
$now = date("Y").sprintf("%02d",date("m")).sprintf("%02d",date("d"));
$data = '
日程 |
曜日 |
場所 |
時間 |
練習内容 |
';
for($d = 1;$d <= $last_d;$d++){
$plc = "";
$h = "";
$cont = "";
$gr = "";
$w = date("w",mktime(0,0,0,$list_m,$d,$list_y));
$bg = 'day';
$base_bg = "#FFFFFF";
$to_day = date($list_y).sprintf("%02d",$list_m).sprintf("%02d",$d);
if($w == 0){
$bg = 'sun';
}elseif($w == 6){
$bg = 'sut';
}
$rbg = $to_day < $now ? ' style="background-color:#f1f1f1;"':'';
$w = w_output($w);
$sql = "SELECT * FROM monthly WHERE year=$list_y AND month=$list_m AND day=$d ORDER BY ddate ASC";
$mysql -> query($sql);
if($mysql -> rows() > 0){
$row = $mysql -> fetch();
$plc = $row['place'];
$h = $row['hour'];
$cont = $row['cont'];
$gr = $row['gr'];
if(strlen($plc) == 0 || $plc == "-"){ $plc = " "; }
if(strlen($h) == 0 || $h == "-"){ $h = " "; }
if(strlen($cont) == 0 || $cont == "-"){ $cont = " "; }
if(strlen($gr) == 0 || $gr == "-"){ $gr = " "; }
}else{
$plc = " ";
$h = " ";
$cont = " ";
}
if(substr_count($gr,"
") > 0 || substr_count($h,"
") > 0 || substr_count($cont,"
") > 0 || substr_count($plc,"
") > 0){
$valign = "top";
}else{
$valign = "middle";
}
$h_row = max(substr_count($gr,"
"),substr_count($h,"
"));
//echo $h_row;
if($h_row > 0){
$h_array = explode("
",$h);
$gr_array = explode("
",$gr);
$h = array();
for($i = 0;$i <= $h_row;$i++){
if(!isset($gr_array[$i]) || strlen(str_replace(' ','',$gr_array[$i])) == 0){
$gr_array[$i] = "";
}
if(!isset($h_array[$i]) || strlen(str_replace(' ','',$h_array[$i])) == 0){
$h_array[$i] = "";
}
if(strlen($gr_array[$i]) == 0 && strlen($h_array[$i]) == 0){
continue;
}
$h[$i] = $gr_array[$i].(strlen(str_replace(' ','',$gr_array[$i])) > 0 && strlen(str_replace(' ','',$h_array[$i])) > 0 ? ' : ':'').$h_array[$i];
}
$h = join('
',$h);
}else{
$h = $h;
}
// echo $h;exit;
$data .= '
'.$d.' |
'.$w.' |
'.$plc.' |
'.$h.' |
'.$cont.' |
';
}
$data .= '
';
$h = "";
$sql = "SELECT * FROM monthly WHERE year=$list_y AND month=$list_m";
$mysql -> query($sql);
if($mysql -> rows() == 0){ $data = "スケジュールが決定次第公開いたします。
"; }
?>
月間スケジュール --- 同志社ラグビー部 公式ホームページ