SEND2000.php
7.95 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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<?PHP
//*****************************************************************************
//*
//* プログラム名:め〜るNiポン!V2
//* プログラムID:SEND1000.php
//* 機能 :スケ調整配信画面
//*
//*****************************************************************************
header("Content-type: text/html; charset=EUC-JP");
include('./include/smarty.conf');
include("./include/session_start.inc");
include("./include/SessionChk.inc");
include("./include/jcode.phps");
//********** ヘッダー処理 **********//
include("./include/headr_data.inc");
include("./include/dbcon.inc");
$POST_DB_PEY_FLG = $PHP_POST_DB_FLG;
//***************************
//* 初期処理
//***************************
$intIdx = 0;
$intGroup_Count = 0;
//個人
$userCNT = 0;
if($_REQUEST["Send_User"] != ""){
$user_cd = split("," , $_REQUEST["Send_User"]);
//個人情報を取得
$userCNT = count($user_cd) - 1;
if($userCNT > 0){
for($i=0;$i<$userCNT;$i++){
$strSQL = "SELECT name_kj_sei, name_kj_mei " .
"FROM syain_tbl " .
"WHERE syain_cd = " . $user_cd[$i] .
" ORDER BY syain_cd";
$objRecSet = pg_exec($strSQL);
if($objRecSet==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
$objData = pg_fetch_object($objRecSet, 0);
$strKojin_Name[$i] = JcodeConvert($objData->name_kj_sei, 1, 1);
$strKojin_Name[$i] .= JcodeConvert($objData->name_kj_mei, 1, 1);
$strSubmitName .= $strKojin_Name[$i] . ";";
}
}
}
//上位グループを取得
$strSQL = "SELECT group_id, group_name " .
"FROM mst_group " .
"ORDER BY group_id";
$objRecSet = pg_exec($strSQL);
if($objRecSet==false){
echo("SQL実行に失敗しました1(SELECT)");
exit;
}
$intGroup_Count = pg_numrows($objRecSet);
for($intIdx = 0; $intIdx < $intGroup_Count ; $intIdx++) {
$objData = pg_fetch_object($objRecSet, $intIdx);
$intGroup_id[$intIdx] = $objData->group_id;
$strGroup_Name[$intIdx] = JcodeConvert($objData->group_name, 1, 1);
}
$intGroup_Max = array();
for ($intIdx = 0; $intIdx <= count($strGroup_Name)-1; $intIdx++){
$strWhere="";
$strWhere="AND (group_info.group_id='".$intGroup_id[$intIdx]."'";
$strWhere=$strWhere.")";
$strSQL = "SELECT syain_tbl.syain_cd, syain_tbl.angou_cd, syain_tbl.mail_addr, syain_tbl.pc_mail_addr, name_kj_sei, name_kj_mei " .
"FROM group_info , syain_tbl " .
"WHERE syain_tbl.syain_cd = group_info.syain_cd " .
$strWhere." group by syain_tbl.syain_cd, syain_tbl.angou_cd, syain_tbl.mail_addr, syain_tbl.pc_mail_addr,name_kj_sei, name_kj_mei " .
"ORDER BY syain_tbl.syain_cd";
$objRecSet = pg_exec($strSQL);
if($objRecSet==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
$intGroup_Max[$intIdx] = pg_numrows($objRecSet);
}
//表示項目名を取得
$strSQL = "SELECT disp_id, disp_name " .
"FROM mst_disp " .
"ORDER BY disp_id";
$objRecSet = pg_exec($strSQL);
if($objRecSet==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
$intDisp_Count = pg_numrows($objRecSet);
for($intIdx = 0; $intIdx < $intDisp_Count ; $intIdx++) {
$objData = pg_fetch_object($objRecSet, $intIdx);
$intDisp_id[$intIdx] = $objData->disp_id;
$strDisp_Name[$intIdx] = JcodeConvert($objData->disp_name, 1, 1);
}
//***************************
//* メイン処理
//***************************
//個人orグループ
$radSend = "";
if($_REQUEST["radSendPtn"] == "2"){
$radSend[1] = "checked";
}else{
$radSend[0] = "checked";
}
//グループ
$strGP = "";
for($intCount = 0; $intCount < $intGroup_Count; $intCount++){
$strGP .= " <input type=checkbox name=group_dat value=".$intGroup_id[$intCount];
if (strchr($_REQUEST["group_id"],"/".$intGroup_id[$intCount]."/")!=false){
$strGP .= " checked";
}
$strGP .= "><FONT size=2><B>".$strGroup_Name[$intCount]."</B></FONT><BR>";
$strGP .= "<INPUT type=\"hidden\" name=\"group_count\" value=".$intGroup_Max[$intCount].">";
}
//送信先機種
$radSendType = "";
if($_REQUEST["SendType"]==0){
$radSendType[0] = "checked";
}
if($_REQUEST["SendType"]==1){
$radSendType[1] = "checked";
}
if($_REQUEST["SendType"]==2){
$radSendType[2] = "checked";
}
//定型文
if($rad_tei=="on"){
$rad_tei = "CHECKED" ;
}
//候補
$kouhoMax = 10;
$optKouho = "";
for($i=1;$i<=$kouhoMax;$i++){
if($i == $_REQUEST["kouho"]){
$optKouho .= "<option value='".($i)."' selected>".$i."</option>";
}else{
$optKouho .= "<option value='".($i)."'>".$i."</option>";
}
}
//データ
$kouhoData = "";
for($i=0;$i<$kouhoMax;$i++){
//番号
$kouhoData[$i][0] = $i + 1;
//開始年
$kouhoData[$i][1] = $_REQUEST["kouhoS_yyyy".$kouhoData[$i][0]];
}
//回答期限
$limit_yyyy = $_REQUEST["limit_yyyy"];
$limit_mm = $_REQUEST["limit_mm"];
$limit_dd = $_REQUEST["limit_dd"];
$limit_time_hh = $_REQUEST["limit_time_hh"];
$limit_time_mm = $_REQUEST["limit_time_mm"];
$opt_limit_mm = make_option_md(12, $limit_mm);
$opt_limit_dd = make_option_md(date(t,mktime(0,0,0,(int)$limit_mm,1)), $limit_dd);
$tempTimeArr = array("","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","00","01","02","03","04","05","06","07");
$opt_limit_time_hh = make_option_time($tempTimeArr, $limit_time_hh);
$tempTimeArr = array("","00","05","10","15","20","25","30","35","40","45","50","55");
$opt_limit_time_mm = make_option_time($tempTimeArr, $limit_time_mm);
//公開
$rad_view_flg = "";
if($view_flg==0){
$rad_view_flg[0] = "checked";
}
if($view_flg==1){
$rad_view_flg[1] = "checked";
}
$strPtnCode = "";
$sql = "SELECT * FROM mst_answer WHERE del_flg = 0 ORDER BY pattern_id";
$rtn = pg_exec($sql);
if($rtn == false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
$num = pg_numrows($rtn);
for ($i = 0; $i < $num; $i++){
$data = pg_fetch_object($rtn, $i);
$strPtnCode .= "<INPUT type='hidden' name='pattern_code' value='".$data->pattern_id."'>";
$strPtnCode .= "<INPUT type='hidden' name='pattern_cnt' value='".$data->select_nm."'>";
}
$o_smarty->assign('PHP_POST_DB_FLG', $PHP_POST_DB_FLG);
$o_smarty->assign('intGroup_Count', $intGroup_Count);
$o_smarty->assign('strSubmitName', $strSubmitName);
$o_smarty->assign('Send_User', $_REQUEST["Send_User"]);
$o_smarty->assign('userCNT', $userCNT);
$o_smarty->assign('radSend', $radSend);
$o_smarty->assign('strGP', $strGP);
$o_smarty->assign('group_id', $group_id);
$o_smarty->assign('radSendType', $radSendType);
$o_smarty->assign('strStartChk', $strStartChk);
$o_smarty->assign('limit_yyyy', $limit_yyyy);
$o_smarty->assign('opt_limit_mm', $opt_limit_mm);
$o_smarty->assign('opt_limit_dd', $opt_limit_dd);
$o_smarty->assign('opt_limit_time_hh', $opt_limit_time_hh);
$o_smarty->assign('opt_limit_time_mm', $opt_limit_time_mm);
$o_smarty->assign('rad_view_flg', $rad_view_flg);
$o_smarty->assign('TITLE',stripslashes($_REQUEST["TITLE"])); //件名
$o_smarty->assign('rad_tei',$rad_tei);
$o_smarty->assign('MAIL_TEXT',stripslashes($_REQUEST["MAIL_TEXT"])); //本文
$o_smarty->assign('kouhoData', $kouhoData);
$o_smarty->assign('optKouho', $optKouho);
$o_smarty->assign('strPtnCode',$strPtnCode);
$o_smarty->assign('strDisp_Name',$strDisp_Name);
$o_smarty->assign('noAnswer',$noAnswer);
$o_smarty->assign('calYMD0',$calYMD0);
$o_smarty->assign('calYMD1',$calYMD1);
$o_smarty->assign('calYMD2',$calYMD2);
$o_smarty->assign('calYMD3',$calYMD3);
$o_smarty->assign('calYMD4',$calYMD4);
$o_smarty->display('SEND2000.tpl');
function make_option_time($arr,$strCmp){
$retString = "<OPTION value=''>--</OPTION>";
for($i=1;$i<count($arr);$i++){
if($arr[$i] == $strCmp){
$retString .= "<OPTION value='".$arr[$i]."' selected>".$arr[$i]."</OPTION>";
}else{
$retString .= "<OPTION value='".$arr[$i]."'>".$arr[$i]."</OPTION>";
}
}
return $retString;
}
function make_option_md($pMax, $strCmp){
$retString = "<OPTION value=''>--</OPTION>";
for($i = 1; $i <= $pMax ; $i++){
if($i==$strCmp){
$retString .= "<OPTION value='".sprintf("%02d",$i)."' selected>".sprintf("%02d",$i)."</OPTION>";
}else{
$retString .= "<OPTION value='".sprintf("%02d",$i)."'>".sprintf("%02d",$i)."</OPTION>";
}
}
return $retString;
}
?>