MAIN0000.php
6.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<?PHP
//*****************************************************************************
//*
//* プログラム名:め〜るNiポン!V2
//* プログラムID:MAIN0000.php
//* 機能 :メイン
//*
//*****************************************************************************
header("Content-type: text/html; charset=EUC-JP");
include("./include/smarty.conf");
include("./include/session_start.inc");
include("./include/SessionChk.inc");
session_unregister("ADD_SYAIN_CD");
//表示名称を取得
//$strSQL = "SELECT disp_name FROM mst_disp WHERE disp_id = 1";
//$objRecSet = pg_exec($strSQL);
//if($objRecSet==false){
// echo("SQL実行に失敗しました(SELECT)");
// exit;
//}
//$objData = pg_fetch_object($objRecSet, 0);
//$stDisp_Name = mb_convert_encoding($objData->disp_name, "EUC-JP", "ASCII,JIS,UTF-8,EUC-JP,SJIS");
//********** ヘッダー処理 **********//
include("./include/headr_data.inc");
//********** カレンダー処理 **********//
include("./include/dbcon.inc");
$date = getdate();
$year = $date["year"];
$month = $date["mon"];
if ($month < 10){
$month = "0".$month;
}
$day = $date["mday"];
if ($day < 10){
$day = "0".$day;
}
$clender=array("#FDDFFD","#ccffcc","#ccffcc","#ccffcc","#ccffcc","#ccffcc","#CCF8FB","#FFFF66");
$schedule=array("#FDDFFD","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#CCF8FB","#FFFF66");
//基準日取得
if(trim($main_year) == "" && trim($main_mon)=="" && trim($strMainDate)==""){
$main_year=date("Y");
$main_mon=date("n");
}else{
if ($strMainDate!=""){
$main_year=substr($strMainDate, 0, 4);
$main_mon=substr($strMainDate, 4, 2);
}
}
//*** 表示年 ***//
$Year_Data = "";
for ($intI = $main_year-1 ; $intI <= $main_year+1 ; $intI++) {
$Year_Data .= "<option value=".$intI;
if ($main_year==$intI){
$Year_Data .= " selected";
}
$Year_Data .= ">".$intI."年</option>";
}
$o_smarty->assign('Year_Data',$Year_Data);
//*** 表示月 ***//
$Month_Data = "";
for ($intI = 1 ; $intI <= 12 ; $intI++) {
$Month_Data .= "<option value=".sprintf('%02d', $intI);
if ($main_mon == $intI){
$Month_Data .= " selected";
}
$Month_Data .= ">".$intI."月</option>";
}
$o_smarty->assign('Month_Data',$Month_Data);
$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));
$o_smarty->assign('Before_Month',$strDispDate[0]);
$o_smarty->assign('Now_Month' ,$strDispDate[1]);
$o_smarty->assign('Next_Month' ,$strDispDate[2]);
//*** カレンダー作成 ***/
//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;
}
//テーブル作成
$strCalData = array();
$intRow = 0;
$intCol = 0;
$intKaigyo=6;
for($intI = 0; $intI < count($strcalender) ; $intI++) {
list($chk_year,$chk_mon,$chk_day)=split("/", $strcalender[$intI]);
$intYoubi=date("w", mktime (0,0,0,$chk_mon,$chk_day,$chk_year));
//テーブル開始
if (($intI % 7 == 0) && ($intI!=0)){
$intRow = $intRow + 1;
$intCol = 0;
}
//日付表示
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;
}
$strCalData[$intRow][$intCol] = $chk_day;
//$strCalData[$intRow][$intCol] .= ' <a href="#" onclick="return kojin_send('.$chk_year.$chk_mon.$chk_day.')"><img src="./img/icon_kojin.gif" alt="個人配信" border=0></a>';
//$strCalData[$intRow][$intCol] .= ' <a href="#" onclick="return group_send('.$chk_year.$chk_mon.$chk_day.')"><img src="./img/icon_ikkatu.gif" alt="一括配信" border=0></a>';
$strCalData[$intRow][$intCol] .= ' <a href="#" onclick="return mail_send('.$chk_year.$chk_mon.$chk_day.')"><img src="./img/icon_ikkatu.gif" alt="メール配信" border=0></a>';
$strCalData[$intRow][$intCol] .= '<ul>';
//*** め〜るNiポン!データ取得 ***
$strSQL = "SELECT ";
$strSQL .= " mail_data.mail_id , ";
$strSQL .= " message_time, ";
$strSQL .= " send_date , ";
$strSQL .= " subject_name, ";
$strSQL .= " reserva_flg, ";
$strSQL .= " name50_nm ";
$strSQL .= "FROM ";
$strSQL .= " mail_data ";
$strSQL .= "LEFT JOIN ";
$strSQL .= " answer_data ";
$strSQL .= "ON ";
$strSQL .= " mail_data.mail_id = answer_data.mail_id ";
$strSQL .= "WHERE ";
$strSQL .= " message_date = '".$chk_year.$chk_mon.$chk_day."' OR";
$strSQL .= " (";
$strSQL .= " (send_date >='".$chk_year.$chk_mon.$chk_day."0000' and send_date <='".$chk_year.$chk_mon.$chk_day."9999') AND ";
$strSQL .= " message_date = '' AND ";
$strSQL .= " reserva_flg = 0 ";
$strSQL .= " ) OR ";
$strSQL .= "(";
$strSQL .= " reserva_date = '".$chk_year.$chk_mon.$chk_day."' AND ";
$strSQL .= " message_date = '' AND ";
$strSQL .= " reserva_flg = 1";
$strSQL .= ")";
$strSQL .= "ORDER BY ";
$strSQL .= " Mail_id DESC";
$objRecSet = pg_exec($strSQL);
if($objRecSet==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
$intData = pg_numrows($objRecSet);
for ($intDtCnt = 0; $intDtCnt < $intData; $intDtCnt++) {
$objRecData = pg_fetch_object($objRecSet, $intDtCnt);
//表示内容編集
if($objRecData->reserva_flg==1){
$Reserva="(未送)";
}else{
$Reserva="";
}
$strDisp="";
if (trim($objRecData->message_time)!=""){
$strDisp=substr($objRecData->message_time, 0, 2).":".substr($objRecData->message_time, 2, 2)." ";
}
$strDisp=$strDisp.str_replace("(〒)","",$objRecData->subject_name);
$strCalData[$intRow][$intCol] .= '<li><a href="#" onclick="return Detail_Disp('."'".$objRecData->mail_id."','".$objRecData->name50_nm."');".'">'.$strDisp;
switch ($objRecData->name50_nm) {
case "SC":
$strCalData[$intRow][$intCol] .= '<br>(スケジュール調整)';
break;
case "QU":
$strCalData[$intRow][$intCol] .= '<br>(アンケート)';
break;
case "DM":
$strCalData[$intRow][$intCol] .= '<br>(お知らせ配信)';
break;
default:
break;
}
$strCalData[$intRow][$intCol] .= '</a>'.$Reserva.'</li>';
}
$strCalData[$intRow][$intCol] .= '</ul>';
}else{
$strCalData[$intRow][$intCol] = "";
}
$intCol = $intCol+1;
}
$o_smarty->assign('strCalData',$strCalData);
$o_smarty->display('MAIN0000.tpl');
?>