='$todayMySQL' order by sq is NULL DESC, sq"; } $result = $db->query($sql); if (!$result){ print ("SQLの実行に失敗しました:イベント情報一覧読出
"); print('$sql='.$sql.'
'); exit; } else { $news_data = $result->fetchAll(PDO::FETCH_ASSOC); } $page_html = str_replace('###NEWSLIST###', listNews($news_data), $page_html); $page_html = str_replace('###TAB0###', $tab[0], $page_html); $page_html = str_replace('###TAB1###', $tab[1], $page_html); $page_html = str_replace('###TAB2###', $tab[2], $page_html); //イベントカレンダー //最終週 $sql = "select endday from news where shop_code='event' and exp=1 and startday<='$todayMySQL' and lastday>='$todayMySQL' order by endday DESC limit 1"; $result = $db->query($sql); if (!$result){ print ("SQLの実行に失敗しました:イベントカレンダー最終週読出
"); print('$sql='.$sql.'
'); exit; } else { $data = $result->fetch(PDO::FETCH_ASSOC); } $last_endday = $data['endday']; $last_endday_week = date('w', strtotime($last_endday)); if($last_endday_week == 0) $last_endday_week = 7; //最終週月曜日 $last_monday = date('Y-m-d', strtotime('-'.($last_endday_week-1).' day '.$last_endday)); //今週の月曜日 $this_monday = date('Y-m-d', strtotime('Monday this week')); if($this_monday > date("Y-m-d")) $this_monday = date('Y-m-d', strtotime('Monday last week')); //最終週まで何週(何画面) $cal_pages = (strtotime($last_monday) - strtotime($this_monday)) / (7*60*60*24) + 1; /* print('$this_monday='.$this_monday.' / '); print('$last_monday='.$last_monday.' / '); print('$cal_pages='.$cal_pages.'
'); */ $cal_html = ''; $slot = array(); $num_max = 1; $pre_row = 0; for($i=0;$i<$cal_pages;$i++){ $cal_html .= '
'.chr(10); $now_mon = date('Y-m-d', strtotime($this_monday) + 7*60*60*24*$i); $now_sun = date('Y-m-d', strtotime('+6 days '.$now_mon)); $cal_html .= '

'.mysqlDateKikan($now_mon, $now_sun).'

'.chr(10); $cal_html .= '
'.chr(10); $cal_html .= ''.chr(10); $cal_html .= ''.chr(10); for($p=0;$p<7;$p++){ if($p == 5){ $th_class = ' class="w6"'; } elseif($p == 6){ $th_class = ' class="w0"'; } else { $th_class = ''; } $p_day = '+'.$p.' day '.$now_mon; $cal_html .= ''.date('n/j', strtotime($p_day)).'
('.$week_arry[$p].')'.chr(10); } $cal_html .= '
'.chr(10); for($p=0;$p<7;$p++){ $cal_html .= ''.chr(10); } $cal_html .= ''.chr(10); $cal_html .= '
 
'.chr(10); $cal_html .= ''.chr(10); $cal_html .= '
'.chr(10); $cal_html .= '
'.chr(10).chr(10); } $cal_html = str_replace('###HEIGHT###', 32*$num_max+16, $cal_html); $page_html = str_replace('###CALENDER###', $cal_html, $page_html); /* print('
');
print_r($slot);
print('
'); */ print(Qde($page_html)); ?>