MTG012_m.php 5.86 KB
<?php 
//*****************************************************************************
//* 
//* プログラム名:電子会議室
//* プログラムID:MTG012_m.php
//* 機能        :電子会議室.発言
//* 作成者      :
//* 
//*****************************************************************************
header("Content-type: text/html; charset=Shift_JIS");

//*** 共通処理 ***//
include("include_m/CommonProcess.inc");

$strValue   = '&ctgno='.$ctgno.'&mtgNo='.$mtgNo.'&remNo='.$remNo.'&selDisp='.$selDisp;

include("../inc/mail_add.inc");

//*** URL取得処理 ***//
include("include_m/CommonUrlGet.inc");

//発言停止チェック
$strSQL = "select measure, kaigi_tbl.speak, kaigi_tbl.stop_flg, kaigi_info_tbl.notice_flg, kaigi_info_tbl.date_end, kaigi_info_tbl.date_start, kaigi_info_tbl.theme from kaigi_tbl join kaigi_info_tbl on kaigi_info_tbl.meeting_no = kaigi_tbl.meeting_no ";
$strSQL .= "where kaigi_tbl.meeting_no = ".$mtgNo." and kaigi_tbl.remark_no = ".$remNo." and kaigi_tbl.answer_no = 0 and kaigi_tbl.cp_answer_no = 0 ";
$recData=pg_exec($strSQL);
if($recData==false){
		echo("SQL実行に失敗しました(SELECT)");
		exit;
}
$ftcData = pg_fetch_object($recData,0);
/*
if($ftcData->date_start > date("YmdH")){
echo "Err/当会議は開催前となっています";
exit;
}
if($ftcData->date_end <= date("YmdH")){
echo "Err/当会議は既に終了しています";
exit;
}
if($ftcData->stop_flg == "1"){
echo "Err/現在、発言は停止されています";
exit;
}
*/

$txtTheme = ($ftcData->theme);
$intNotice = (int)$ftcData->notice_flg;

//議案取得
$txtMeasure = ($ftcData->measure);

//発言番号設定
//返信
$strSQL="select answer_no from kaigi_tbl where meeting_no = ".$mtgNo." and remark_no = ".$remNo." order by answer_no DESC";
$recRemNo=pg_exec($strSQL);
if($recRemNo==false){
		echo("SQL実行に失敗しました(SELECT)");
		exit;
}
if (pg_numrows($recRemNo) > 0){
	$objNo = pg_fetch_object($recRemNo, 0);
	$intRemNo=($objNo->answer_no) +1;
}else{
	$intRemNo=1;
}
$intCPAns=0;

//** 発言者名前取得 **//
$strSQLNm="SELECT name_kj_sei,name_kj_mei FROM syain_tbl Where syain_cd='$PHP_SYAIN_CD'";
$objNm = pg_exec($strSQLNm);
if($objNm==false){
	echo("SQL実行に失敗しました(SELECT)");
	exit;
}
$objNmData = pg_fetch_object($objNm, 0);
$strNameData=mb_convert_encoding($objNmData->name_kj_sei." ".$objNmData->name_kj_mei, "SJIS", "EUC-JP");

//**** メール本文 ****//
//** PC版 **//
$strMail[0] = "会議で議案に対する新しい発言がありました\n";
$strMail[0] .= "【会議テーマ】\n";
$strMail[0] .= mb_convert_encoding($txtTheme, "SJIS", "EUC-JP")."\n";
$strMail[0] .= "【議案】\n";
$strMail[0] .= mb_convert_encoding($txtMeasure, "SJIS", "EUC-JP")."\n";
$strMail[0] .= "【発言】\n";
$strMail[0] .= mb_convert_encoding($M, "SJIS", "EUC-JP")."\n";

//** 携帯版 **//
$strMobile  = "会議で議案に対する新しい発言がありました\n";
$strMobile .= "【会議テーマ】\n";
$strMobile .= mb_convert_encoding($txtTheme, "SJIS", "EUC-JP")."\n";
$strMobile .= "【発言】\n";
$strMobile .= mb_convert_encoding($M, "SJIS", "EUC-JP")."\n";
$strMobile  = mb_convert_encoding($strMobile, "SJIS", "EUC-JP");

$M = (mb_convert_encoding($M, "EUC-JP", "SJIS"));
$M = str_replace(chr(92), '',$M);



//発言登録
$strSQL = "insert into kaigi_tbl (meeting_no, remark_no, answer_no, cp_answer_no, speak, person, date) ";
$strSQL .= "values(".$mtgNo.", ".$remNo.", ".$intRemNo.", ".$intCPAns.", '".addslashes($M)."', '".$PHP_SYAIN_CD."', '".date("YmdHi")."')";
$execIns =pg_exec($strSQL);
if($execIns==false){
		echo("SQL実行に失敗しました(INSERT)");
		exit;
}

//個人用テーブル設定
//対象検索 発言者
$strSQL="select category_no, list_spk, list_obs from kaigi_info_tbl where meeting_no = ".$mtgNo;
$recList=pg_exec($strSQL);
if($recList==false){
		echo("SQL実行に失敗しました(SELECT)");
		exit;
}
$objList = pg_fetch_object($recList, 0);
$intCtgNo=($objList->category_no);	//カテゴリ番号
$strList=($objList->list_spk);
$arrSPK = split("/",$strList);
for($i=1;$i<count($arrSPK)-1;$i++){
		//本人?
		if($arrSPK[$i] == $PHP_SYAIN_CD){
				$read_flg=1;
		}else{
				$read_flg=0;
				//開設メール配信
				if($intNotice == 1){
						$strMail[1]  = $strMobile;
						if ($PHP_MOBILE_NAME==0){
								$strMail[1] .= "\n".$UrlHead_MB."MTG004_m.php?P_SYAIN_CD=".$arrSPK[$i]."&P_FOLDER=".$PHP_FOLDER;
								$strMail[1] .= "&ctgno=".$ctgno."&mtgNo=".$mtgNo."&remNo=".$remNo;
						}
						if(subMailIns($mtgNo,3,3,$arrSPK[$i],"000000000000",$strMail) == false){
								echo ("SQL実行に失敗しました(INSERT)");
								exit;
						}
				}
		}
		$strSQL = "insert into pkaigi_tbl (syain_cd, meeting_no, remark_no, answer_no, cp_answer_no, category_no, speak_flg, read_flg) ";
		$strSQL .= "values('".$arrSPK[$i]."', ".$mtgNo.", ".$remNo.", ".$intRemNo.", ".$intCPAns.", ".$intCtgNo.", 1, ".$read_flg.")";
		$execIns =pg_exec($strSQL);
		if($execIns==false){
				echo("SQL実行に失敗しました(INSERT)");
				exit;
		}
}
//対象検索 オブザーバ
$strList=($objList->list_obs);
$arrOBS = split("/",$strList);
if(count($arrOBS)>0){
		for($i=1;$i<count($arrOBS)-1;$i++){
				//本人?
				if($arrOBS[$i] == $PHP_SYAIN_CD){
						$read_flg=1;
				}else{
						$read_flg=0;
						//開設メール配信
						if($intNotice == 1){
								$strMail[1]  = $strMobile;
								if ($PHP_MOBILE_NAME==0){
										$strMail[1] .= "\n".$UrlHead_MB."MTG004_m.php?P_SYAIN_CD=".$arrOBS[$i]."&P_FOLDER=".$PHP_FOLDER;
										$strMail[1] .= "&ctgno=".$ctgno."&mtgNo=".$mtgNo."&remNo=".$remNo;
								}
								if(subMailIns($mtgNo,3,3,$arrOBS[$i],"000000000000",$strMail) == false){
										echo ("SQL実行に失敗しました(INSERT)");
										exit;
								}
						}
				}
				$strSQL = "insert into pkaigi_tbl (syain_cd, meeting_no, remark_no, answer_no, cp_answer_no, category_no, speak_flg, read_flg) ";
				$strSQL .= "values('".$arrOBS[$i]."', ".$mtgNo.", ".$remNo.", ".$intRemNo.", ".$intCPAns.", ".$intCtgNo.", 0, ".$read_flg.")";
				$execIns =pg_exec($strSQL);
				if($execIns==false){
						echo("SQL実行に失敗しました(INSERT)");
						exit;
				}
		}
}

header("Location: ./MTG004_m.php?".$PHP_Argument.$strValue);
?>