MET031.php 6.44 KB
<?php 
//*****************************************************************************
//* 
//* プログラム名:電子会議室
//* プログラムID:MET031.php
//* 機能        :電子会議室.返信取得
//* 作成者      :
//* 
//*****************************************************************************
header("Content-type: text/html; charset=EUC-JP");
include("include/session_start.inc");
include("include/SessionChk.inc");
include("include/STRING.inc");
include('./include/smarty.conf');
//include("inc/header.inc");

$strDBinc="include/dbcon.inc";
include($strDBinc);

$strSQL="";
$objRec="null";

//URL関数
function link_url($str){
		$regex = "((https?://|ftp://)([0-9A-Za-z:_?./~%;()=+#-]|&amp;)+)";
		$str = eregi_replace($regex, "<a href=\"\\1\" target=\"_blank\">\\1</a>", $str);

		$regex_mail = "((mailto:)?([0-9A-Za-z._-]+@[0-9A-Za-z.-]+))";
		$str = eregi_replace($regex_mail, "<a href=\"mailto:\\3\">\\1</a>", $str);

		return $str;
}

//議長? 発言OK? 終了?
$strSQL = "select chairperson, date_end, list_spk from kaigi_info_tbl where meeting_no = ".$mtgNo;
$recKaigi=pg_exec($strSQL);
if($recKaigi==false){
		echo("SQL実行に失敗しました(SELECT)");
		exit;
}
$ftcKaigi = pg_fetch_object($recKaigi, 0);
if(($ftcKaigi->chairperson) == $PHP_SYAIN_CD){
	$flgCP = 1;
}else{
	$flgCP = 0;
}
$CPCODE = $ftcKaigi->chairperson;
if(strpos($ftcKaigi->list_spk,"/".$PHP_SYAIN_CD."/") === false){
	$flgSPK=0;
}else{
	$flgSPK=1;
}
$flgEnd = 0;
if(($ftcKaigi->date_end) <= date("YmdH")){
	$flgEnd = 1;
}

//$strSQL = "select meeting_no, remark_no, answer_no, cp_answer_no, speak, person ,date, syain_tbl.name_kj_sei, syain_tbl.name_kj_mei ";
//$strSQL .= "from kaigi_tbl join syain_tbl on syain_tbl.syain_cd = kaigi_tbl.person where cp_answer_no = 0 and meeting_no = ".$mtgNo." and remark_no = ".$remNo." ";
//$strSQL .= "order by remark_no desc, answer_no desc, cp_answer_no desc";
$strSQL = "select kaigi_tbl.meeting_no, kaigi_tbl.remark_no, kaigi_tbl.answer_no, kaigi_tbl.cp_answer_no, speak, person ,date, syain_tbl.name_kj_sei, syain_tbl.name_kj_mei, pkaigi_tbl.read_flg, stop_flg ";
$strSQL .= "from kaigi_tbl ";
$strSQL .= "join pkaigi_tbl on pkaigi_tbl.syain_cd = '".$PHP_SYAIN_CD."' and kaigi_tbl.meeting_no = pkaigi_tbl.meeting_no and kaigi_tbl.remark_no = pkaigi_tbl.remark_no and kaigi_tbl.answer_no = pkaigi_tbl.answer_no and kaigi_tbl.cp_answer_no = pkaigi_tbl.cp_answer_no ";
$strSQL .= "join syain_tbl on syain_tbl.syain_cd = kaigi_tbl.person ";
$strSQL .= "where kaigi_tbl.cp_answer_no = 0 and kaigi_tbl.meeting_no = ".$mtgNo." and kaigi_tbl.remark_no = ".$remNo." ";
$strSQL .= "order by kaigi_tbl.remark_no desc, kaigi_tbl.answer_no desc, kaigi_tbl.cp_answer_no desc";
$recKaigi=pg_exec($strSQL);
if($recKaigi==false){
		echo("SQL実行に失敗しました(SELECT)");
		exit;
}
$ftcKaigi = pg_fetch_object($recKaigi, pg_numrows($recKaigi)-1);
//発言停止?
$flgSTOP = (int) $ftcKaigi->stop_flg;

$max = pg_numrows($recKaigi)-1;
for($i=0;$i<$max;$i++){
	$ftcKaigi = pg_fetch_object($recKaigi, $i);
	
	if($CPCODE == trim($ftcKaigi->person)){
		$FLG_CP_SPK[$i] = 1;
	}else{
		$FLG_CP_SPK[$i] = 0;
	}
	
	$strSpeak[$i] = link_url(str_replace ("\r\n","<br>",htmlspecialchars($ftcKaigi->speak)));
	$strPerson[$i] = ($ftcKaigi->name_kj_sei).($ftcKaigi->name_kj_mei);
	$strTemp = $ftcKaigi->date;
	$strTemp = ((int) substr($strTemp,4,2))."/".((int) substr($strTemp,6,2))." ".substr($strTemp,8,2).":".substr($strTemp,10,2)."";
	if ($FLG_CP_SPK[$i] == 1){
			$strPerson[$i] = "( 議長:".$strPerson[$i]." ".$strTemp." )";
	}else{
			$strPerson[$i] = "( ".$strPerson[$i]." ".$strTemp." )";
	}
	$flgRaed[$i] = $ftcKaigi->read_flg;
	$ansNo[$i] = $ftcKaigi->answer_no;
//	$strMeetNo[$i] = $ftcKaigi->meeting_no;
	$Count[$i] = $i;
	if(($ftcKaigi->person) == $PHP_SYAIN_CD){
		$flgModi[$i]=1;
	}

//	$strSQL = "select cp_answer_no, speak, person ,date, syain_tbl.name_kj_sei, syain_tbl.name_kj_mei ";
//	$strSQL .= "from kaigi_tbl join syain_tbl on syain_tbl.syain_cd = kaigi_tbl.person where cp_answer_no > 0 and meeting_no = ".$mtgNo." and remark_no = ".$remNo." and answer_no = ".($ftcKaigi->answer_no)." ";
//	$strSQL .= "order by cp_answer_no desc";
	$strSQL = "select kaigi_tbl.cp_answer_no, speak, person, date, syain_tbl.name_kj_sei, syain_tbl.name_kj_mei, pkaigi_tbl.read_flg, stop_flg ";
	$strSQL .= "from kaigi_tbl ";
	$strSQL .= "join pkaigi_tbl on pkaigi_tbl.syain_cd = '".$PHP_SYAIN_CD."' and kaigi_tbl.meeting_no = pkaigi_tbl.meeting_no and kaigi_tbl.remark_no = pkaigi_tbl.remark_no and kaigi_tbl.answer_no = pkaigi_tbl.answer_no and kaigi_tbl.cp_answer_no = pkaigi_tbl.cp_answer_no ";
	$strSQL .= "join syain_tbl on syain_tbl.syain_cd = kaigi_tbl.person ";
	$strSQL .= "where kaigi_tbl.cp_answer_no > 0 and kaigi_tbl.meeting_no = ".$mtgNo." and kaigi_tbl.remark_no = ".$remNo." and kaigi_tbl.answer_no = ".($ftcKaigi->answer_no)." ";
	$strSQL .= "order by cp_answer_no desc";
	$recCP=pg_exec($strSQL);
	if($recCP==false){
			echo("SQL実行に失敗しました(SELECT)");
			exit;
	}
	if(pg_numrows($recCP) > 0){
		for($j=0;$j<pg_numrows($recCP);$j++){
			$ftcCP = pg_fetch_object($recCP, $j);
			$strSpeakCP[$i][$j] = link_url(str_replace ("\r\n","<br>",htmlspecialchars($ftcCP->speak)));
			$strPersonCP[$i][$j] = ($ftcCP->name_kj_sei).($ftcCP->name_kj_mei);
			$strTemp = $ftcCP->date;
			$strTemp = ((int) substr($strTemp,4,2))."/".((int) substr($strTemp,6,2))." ".substr($strTemp,8,2).":".substr($strTemp,10,2)."";
			$strPersonCP[$i][$j] = "( 議長:".$strPersonCP[$i][$j]." ".$strTemp." )";
			$flgRaedCP[$i][$j] = $ftcCP->read_flg;
			$cpansNo[$i][$j] = $ftcCP->cp_answer_no;
			//$Count[$i] = $i;
			if(($ftcCP->person) == $PHP_SYAIN_CD){
				$flgModiCP[$i][$j]=1;
			}
		}
	}
	
}
/*
$o_smarty->assign('strTheme',$strTheme);
$o_smarty->assign('ctgno',$ctgno);

*/

$o_smarty->assign('max',$max);
$o_smarty->assign('Count',$Count);
$o_smarty->assign('strSpeak',$strSpeak);
$o_smarty->assign('strSpeakCP',$strSpeakCP);
//$o_smarty->assign('remNo',$remNo-1);
$o_smarty->assign('mtgNo',$mtgNo);
$o_smarty->assign('remNo',$remNo);
$o_smarty->assign('strPerson',$strPerson);
$o_smarty->assign('strPersonCP',$strPersonCP);
$o_smarty->assign('flgCP',$flgCP);
$o_smarty->assign('flgSPK',$flgSPK);
$o_smarty->assign('ansNo',$ansNo);
$o_smarty->assign('cpansNo',$cpansNo);
$o_smarty->assign('flgEnd',$flgEnd);
$o_smarty->assign('flgRaed',$flgRaed);
$o_smarty->assign('flgRaedCP',$flgRaedCP);
$o_smarty->assign('flgModi',$flgModi);
$o_smarty->assign('flgModiCP',$flgModiCP);
$o_smarty->assign('flgSTOP',$flgSTOP);
$o_smarty->assign('FLG_CP_SPK',$FLG_CP_SPK);

$o_smarty->display('MET031.tpl');
exit;
?>