calender.php 9.22 KB
<?php
//*****************************************************************************
//* 
//* プログラム名:e-イベント
//* プログラムID:calender.php
//* 機能        :イベント表示画面
//* 作成者      :
//* 
//*****************************************************************************
header("Content-type: text/html; charset=shift-jis");

require('../_common/holiday_Eng.inc' );
require('./include/const.php' );
require('./include/month_Eng.php');

// ユーザー定義関数を取り込む
require('function/calender.inc' );
require('function/operatezero.inc');

//CSVファイルのパス
$ddir = "data/event/";

//カレンダー 色の配列
$clender = array("#EC534F", "#7CB60D", "#7CB60D", "#7CB60D", "#7CB60D", "#7CB60D", "#07A3DD");
$schedule = array("#EC534F", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#07A3DD");

//ランダム広告
$affiliateNo1 = rand(1, 31);
$affiliateNo2 = rand(1, 31);

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META name="GENERATOR" content="Microsoft FrontPage 4.0">
<META http-equiv="Content-Type" content="text/html; charset=shift_jis">
<META http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<TITLE><?php include("./include/title.inc"); ?>/e-event</TITLE>
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
<!--

function GmDisp(){
	document.cldr.action = "calender.php";
	document.cldr.method = "POST";
	document.cldr.submit();
	return;
}

function reload(strDate){
	document.cldr.strMainDate.value = strDate;
	document.cldr.action = "calender.php";
	document.cldr.method = "POST";
	document.cldr.submit();
	return;
}

function event_input(strDate){
	document.cldr.hiduke.value = strDate;
	document.cldr.action = "evententry.php";
	document.cldr.method = "POST";
	document.cldr.submit();
	return;
}

function group_send(strDate){
	document.cldr.strMainDate.value = strDate;
	document.cldr.action = "../group_tran/group_Tran.php";
	document.cldr.method = "POST";
	document.cldr.submit();
	return;
}

//-->
</script>

<?php 
include("./function/focus.inc");
?>

</HEAD>
<BODY>
<div align="center">
<FORM METHOD="POST" name="cldr">

<!-- カレンダー表示 -->
<?php
//基準日取得
if($main_year == "" && $main_mon=="" && $strMainDate==""){
	$main_year = date("Y");
	$main_mon = date("n");
}else{
	if ($strMainDate != ""){
		$main_year = substr($strMainDate, 0, 4);
		$main_mon = substr($strMainDate, 4, 2);
	}
}

$strDispDate[0] = date("Ymd", mktime (0, 0, 0, $main_mon-1, "01", $main_year));
$strDispDate[1] = date("Y").date("m")."01";
$strDispDate[2] = date("Ymd", mktime (0, 0, 0, $main_mon+1, "01", $main_year));
?>

<span="TinnyFont"><br /></span>
<div class="title_head">

<!--アンテナショップ名称表示-->
<div class="shop_name"><?php echo $CONST_SHOP_NAME; ?></div>

<!--社名表示-->
<div class="com_name"><?php echo $CONST_COMPANY_NAME; ?></div>

<!--div class="logout"><INPUT type="button" class="logout_btn" value="ログアウト"></div-->
</div>
     
<TABLE width=100% border="0" align="center" cellPadding=0 cellSpacing=0 class="header">
	<TBODY>
		<TR>
			<TD align="left" width="350">
			</TD>
			<TD align="center"> 
				<SELECT name="main_year" onChange="GmDisp()" class="years">

					<?php
					for ($intCnt = $main_year-1; $intCnt <= $main_year+1; $intCnt++) {
						echo "<option value = ".$intCnt;
						if ($main_year == $intCnt){
							echo " selected";
						}
						echo ">".$intCnt."</option>";
					}
					?>

				</SELECT>
				<SELECT name="main_mon" onChange="GmDisp()" class="years">

					<?php
						for ($intCnt = 1; $intCnt <= 12; $intCnt++) {
							if (strlen($intCnt) == 1){
								echo "<option value = 0".$intCnt;
							}else{
								echo "<option value = ".$intCnt;
							}
							if ($main_mon == $intCnt){
								echo " selected";
							}
							echo ">".month_Eng($intCnt)."</option>";
						}
					?>

				</SELECT>
			</TD>
			<TD align="right" width="350">
				<INPUT type="button" class="n_btn" value="<< Last Mon" onclick="return reload(<?php echo $strDispDate[0]; ?>)">
				<INPUT type="submit" class="n_btn" value=" This Mon " onclick="return reload(<?php echo $strDispDate[1]; ?>)">
				<INPUT type="submit" class="n_btn" value="Next Mon >>" onclick="return reload(<?php echo $strDispDate[2]; ?>)"> 
			</TD>
		</TR>
	</TBODY>
</TABLE>

<TABLE width="100%" class="mainTbr">
	<TR align="center">
		<TD width="15%" bgcolor="#EC534F" style="color:#FFFFFF; font-size:20px">Sun</TD>
		<TD width="14%" bgcolor="#7CB60D" style="color:#FFFFFF; font-size:20px">Mon</TD>
		<TD width="14%" bgcolor="#7CB60D" style="color:#FFFFFF; font-size:20px">Tues</TD>
		<TD width="14%" bgcolor="#7CB60D" style="color:#FFFFFF; font-size:20px">Wed</TD>
		<TD width="14%" bgcolor="#7CB60D" style="color:#FFFFFF; font-size:20px">Thurs</TD>
		<TD width="14%" bgcolor="#7CB60D" style="color:#FFFFFF; font-size:20px">Fri</TD>
		<TD width="15%" bgcolor="#07A3DD" style="color:#FFFFFF; font-size:20px">Sat</TD>
	</TR>

	<?php
	//MAX日付取得
	$main_day = "01";
	$dateMax = date("j", mktime (0, 0, 0, $main_mon+1, $main_day-1, $main_year));

	//カレンダー空白数(前)
	$intbefor = date("w", mktime (0, 0, 0, $main_mon, $main_day, $main_year));

	//カレンダー空白数(後)
	$intafter = date("w", mktime (0, 0, 0, $main_mon, $dateMax, $main_year));
	$intafter = 6-$intafter;

	//ループ基準日取得
	$strWkDate = date("Y/m/d", mktime (0, 0, 0, $main_mon, $main_day-$intbefor, $main_year));
	list($chk_year, $chk_mon, $chk_day)=split("/", $strWkDate);

	for($intCnt = 0; $intCnt < $intbefor + $dateMax + $intafter; $intCnt++) {
		$strWkDate = date("Y/m/d", mktime (0, 0, 0, $chk_mon, $chk_day+$intCnt, $chk_year));
		$strcalender[$intCnt] = $strWkDate;
	}
	$idnames = "";

	//テーブル作成
	$intKaigyo = 6;
	for($intCnt = 0; $intCnt < count($strcalender); $intCnt++) {
		list($chk_year, $chk_mon, $chk_day) = split("/", $strcalender[$intCnt]);
		$intYoubi = date("w", mktime (0, 0, 0, $chk_mon, $chk_day, $chk_year));
		//テーブル開始
		if ($intCnt % 7 == 0){
			echo "<TR>";
		}

		//日付表示
		if ($chk_mon == $main_mon){
			//日付編集
			if (substr($chk_mon, 0, 1) == 0){
				$input_mon = substr($chk_mon, 1, 1);
			}else{
				$input_mon = $chk_mon;
			}

			if (substr($chk_day, 0, 1) == 0){
				$input_day = substr($chk_day, 1, 1);
			}else{
				$input_day = $chk_day;
			}
						
			if (array_key_exists($chk_year.$chk_mon.$chk_day, $holiday)) {
				$schedule_color = $schedule["0"];
				$holiday_name = $holiday[$chk_year.$chk_mon.$chk_day];
			}else{
				$schedule_color = $schedule[$intYoubi];
				$holiday_name = "";
			}

			echo '<TD width="14%" height="50" bgColor="'.$schedule_color.'">'.$chk_day;

			if ($holiday_name != ""){
				echo '<br><div class = "holiday">'.$holiday_name.'</div>';
			}
			echo "<ul>";

			//データの取得
			$file_name = $ddir."eventmst".fun_addzero($main_mon).".csv";

			//読み込んだテーブルのレコード数を格納する変数
			$tbl_cnt = 0; 
			$month_dat = fun_csvread($month_dat, $file_name);

			//データ出力
			for ($intdataCnt = 0; $intdataCnt < count($month_dat)+1; $intdataCnt++){

				if (trim($month_dat[$intdataCnt][0]) == $chk_year.$chk_mon.$chk_day){							
					$month_dat[$intdataCnt][2] = str_replace("&lt;", "<", $month_dat[$intdataCnt][2]);
					$month_dat[$intdataCnt][2] = str_replace("&gt;", ">", $month_dat[$intdataCnt][2]);

					$idnames[] = "#open".$intdataCnt."";
					echo '<p><a href="#open'.$intdataCnt.'">'.$month_dat[$intdataCnt][2].'</a></p>';
				}
			}
			echo "</ul>\n\n";
			echo "</TD>";

		}else{
			if (array_key_exists($chk_year.$chk_mon.$chk_day, $holiday)) {
				$schedule_color = $schedule["0"];
				$holiday_name = $holiday[$chk_year.$chk_mon.$chk_day];
			}else{
				$schedule_color = $schedule[$intYoubi];
				$holiday_name = "";
			}
			echo "<TD Align=top width=115 bgColor='#DBDBDB' height=30>";
		}

		//テーブル終了
		if ($intKaigyo == $intCnt){
			echo "</tr>";
			$intKaigyo = $intKaigyo+7;
		}
	}

	?>
</TABLE>

<!--イベント詳細表示-->
<?php 
echo "\n".'<div id="modal">'."\n";
for ($i = 0; $i<count($month_dat)+1; $i++){
	if(trim($month_dat[$i][0]) != "" && substr($month_dat[$i][0], 0, 4) == $main_year){
		echo '<div id="open'.$i.'">'."\n"; 
		echo '<a href="#" class="close_overlay">×</a>'."\n"; 
		echo '<span class="modal_window">'."\n"; 
		echo '<h2>event information</h2>'."\n"; 
		echo '<p><b>Event:<br></b>'.$month_dat[$i][2].'</p>'."\n";

		if($month_dat[$i][10] != ""){
			echo '<div class="url_return"><p><b>HomePage:<br></b><a href="'.$month_dat[$i][10].'" target="_brank">'.$month_dat[$i][10].'</a></p></div>';
		}

		echo '<p><b>Contents:</b><br>'.$month_dat[$i][11].'</p>'."\n";
		echo '<a href="#">CLOSE 【×】</a>'."\n";
		echo '</span>'."\n";
		echo '</div>'."\n";
	}
}
echo '</div>'."\n";

?>
<INPUT type="hidden" name="disp_nm" value="<?php echo $stDisp_Name ?>">
<INPUT type="hidden" name="sYear" value="">
<INPUT type="hidden" name="sMonth" value="">
<INPUT type="hidden" name="strMainDate" value="">
<INPUT type="hidden" name="hiduke" value="">
<INPUT type="hidden" name="usr_name" value="guest">
<INPUT type="hidden" name="usr_pword" value="guest">
<INPUT type="hidden" name="pageName" value="<?php include("./include/title.inc"); ?>">
<INPUT type="hidden" name="file_sel" value="event">
</SCRIPT>

<style type="text/css">
<?php 
echo implode(",", $idnames); 
?>
{
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: none;
	position: absolute;
}
</style>

</FORM>
</div>
</BODY>
</HTML>