SEND3000.php
5.46 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
<?PHP
//*****************************************************************************
//*
//* プログラム名:め〜るNiポン!V2
//* プログラムID:SEND3000.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;
$noAnswer = $_REQUEST["noAnswer"];
if($noAnswer == ""){
$noAnswer = "参加不能";
}
//個人
$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" ;
}
$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('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->display('SEND3000.tpl');
?>