MET011.php 4.21 KB
<?php 

//*****************************************************************************

//* 

//* プログラム名:電子会議室

//* プログラムID:MET011.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);

//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;
}

$strSQLIns="";
$objRecIns="null";
$strSQLseq="";
$objRecseq="null";
$strSQLup="";
$objRecup="null";
$strSQL="";
$objRec="null";

$strDate = date("Y").date("m").date("d").date("H");
if($selDisp == 1){
	$strWere = "date_end > '".$strDate."' and ";
	$srtOn = "and kaigi_info_tbl.date_end > '".$strDate."' ";
}elseif($selDisp == 2){
	$strWere = "date_end <= '".$strDate."' and ";
	$srtOn = "and kaigi_info_tbl.date_end <= '".$strDate."' ";
}elseif($selDisp == 3){
	$strWere = "date_end < '".$strDate."' and minutes_maker='".$PHP_SYAIN_CD."' and minutes IS NULL and ";
	$srtOn = "and kaigi_info_tbl.date_end <= '".$strDate."' and kaigi_info_tbl. minutes_maker='".$PHP_SYAIN_CD."' and kaigi_info_tbl.minutes IS NULL ";
}else{
	$strWere="";
	$srtOn ="";
}

$strSQL = "select kaigi_info_tbl.meeting_no, kaigi_info_tbl.theme, count(pkaigi_tbl.read_flg) as readCnt from kaigi_info_tbl ";
$strSQL .= "left join pkaigi_tbl on pkaigi_tbl.meeting_no = kaigi_info_tbl.meeting_no and syain_cd = '".$PHP_SYAIN_CD."' and pkaigi_tbl.read_flg = 0 ";
$strSQL .= "where ".$strWere."kaigi_info_tbl.category_no='".$ctgno."' and (list_spk like '%/".$PHP_SYAIN_CD."/%' or list_obs like '%".$PHP_SYAIN_CD."/%') ";
$strSQL .= "group by kaigi_info_tbl.meeting_no, kaigi_info_tbl.theme, kaigi_info_tbl.open_date ";
$strSQL .= "order by readCnt desc, open_date desc";
//$strSQL="select meeting_no,theme from kaigi_info_tbl where ".$strWere."category_no='".$ctgno."' and (list_spk like '%/".$PHP_SYAIN_CD."/%' or list_obs like '%".$PHP_SYAIN_CD."/%') order by open_date desc";
$recKaigi=pg_exec($strSQL);
if($recKaigi==false){
		echo("SQL実行に失敗しました(SELECT)");
		exit;
}

$max = pg_numrows($recKaigi);
for($i=0;$i<$max;$i++){
	$ftcKaigi = pg_fetch_object($recKaigi, $i);
	$strTheme[$i] = link_url(str_replace ("\r\n","<br>",htmlspecialchars($ftcKaigi->theme)));
	$strMeetNo[$i] = $ftcKaigi->meeting_no;
	$Count[$i] = $i;
	$strSQL="select remark_no from kaigi_tbl where meeting_no = ".($ftcKaigi->meeting_no)." and answer_no = 0 and cp_answer_no = 0";
	//$strSQL="select remark_no from kaigi_tbl where meeting_no = ".($ftcKaigi->meeting_no);
	$recRem=pg_exec($strSQL);
	if($recRem==false){
			echo("SQL実行に失敗しました(SELECT)");
			exit;
	}
	$remNum[$i] = pg_numrows($recRem)-1;

	$strSQL="select remark_no from kaigi_tbl where meeting_no = ".($ftcKaigi->meeting_no)." and (answer_no > 0 or cp_answer_no > 0)";
	//$strSQL="select remark_no from kaigi_tbl where meeting_no = ".($ftcKaigi->meeting_no);
	$recRem=pg_exec($strSQL);
	if($recRem==false){
			echo("SQL実行に失敗しました(SELECT)");
			exit;
	}
	$remNum2[$i] = pg_numrows($recRem);

	$strSQL = "select read_flg from pkaigi_tbl ";
	$strSQL .= "join kaigi_info_tbl on kaigi_info_tbl.meeting_no = pkaigi_tbl.meeting_no ".$srtOn." ";
	$strSQL .= "where pkaigi_tbl.read_flg = 0 and pkaigi_tbl.syain_cd = '".$PHP_SYAIN_CD."' and pkaigi_tbl.meeting_no= ".$strMeetNo[$i];
	$recCnt=pg_exec($strSQL);
	if($recCnt==false){
		echo("SQL実行に失敗しました(SELECT)");
		exit;
	}
	$noRead[$i] = pg_numrows($recCnt);

}

$o_smarty->assign('strTheme',$strTheme);
$o_smarty->assign('strMeetNo',$strMeetNo);
$o_smarty->assign('Count',$Count);
$o_smarty->assign('max',$max-1);
$o_smarty->assign('ctgno',$ctgno);
$o_smarty->assign('remNum',$remNum);
$o_smarty->assign('remNum2',$remNum2);
$o_smarty->assign('noRead',$noRead);

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