<?php
include "../../../../common.php";

$tmenu_ = "연구사업"; // theme.menu.php 에서 세팅한 이 페이지의 대메뉴명을 입력합니다.
$g5['title'] = "콜로키움"; //커스텀페이지의 타이틀을 입력합니다.
$title_view = "no"; //항상 false 로 유지하십시오. 이 라인을 절대 수정,삭제 하지 마십시오.

include_once(G5_THEME_PATH . '/head.php'); //그누보드의 공통 상단을 연결합니다.
include_once('header.php'); //회사소개의 공통 상단을 연결합니다.




$sql_common = " from c_program_Colloquium a left join c_program_Colloquium_addon b on a.id=b.idproid ";

$datetime = date("Y");

$sql_search = " where flag = 1 ";


if (!$yy)
	$yy = date('Y');
if ($yy)
	$sql_search .= " and year(tdate)='{$yy}' ";

if ($word) {

	if ($part == "") {

		$sql_search .= " and (concat(b.firstname,' ',b.middlename,' ',b.lastname) like '%{$word}%' or  title like '%{$word}%') ";

		//$sql_search .= " and (title like '%{$word}%' or abstract like '%{$word}%') ";

	} else {
		if ($part == "spk") {

			$sql_search .= " and (concat(b.firstname,' ',b.middlename,' ',b.lastname) like '%{$word}%' ) ";

			//$sql_search .= " and ({$part} like '%{$word}%') ";
		} else {
			$sql_search .= " and ({$part} like '%{$word}%') ";
		}
	}
}

if (!$sst) {
	$sst = "tdate";
	$sod = "desc";
}

$sql_order = " group by b.idproid order by {$sst} {$sod} ";

$sql = " select count(a.id) as cnt {$sql_common} {$sql_search} {$sql_order} ";
$rsa = sql_query($sql);
$total_count = sql_num_rows($rsa);
;


$rows = 10;
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1)
	$page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함

$sql = " select a.* {$sql_common} {$sql_search} {$sql_order} limit {$from_record}, {$rows} ";
$result = sql_query($sql);

if ($_SERVER['REMOTE_ADDR'] == '182.215.22.194') {
	echo $sql;
}

$qstr = "&part={$part}&word=" . urlencode($word);

?>


<div id="sub_tit">
	<div class="path">
		<li><a href="/"><span class="ic-home"><i></i></span></a></li>
		<li>
			<?php echo lang($tmenu_) ?>
		</li>
		<li><?php echo lang($g5['title']) ?></li>
	</div>
	<div class="title">
		<?php echo lang($tmenu_) ?>
	</div>
	<p class="normal_txt"></p>
</div>



<div class="scontents">

	<?php
	include_once(G5_THEME_PATH . '/lnb.php');
	?>

	<div class="bg_vline"></div>
	<p class="eng"><?php echo lang("콜로키움"); ?></p>
	<p class="stitle">Greetings</p>

	<div class="research__coll__list center-intro">

		<?php // echo lang("준비중"); 
		?>
		<?php

		$sql = "select (left(tdate,4)) as yy {$sql_common} where flag = 1 group by left(tdate,4) desc";
		$rsy = sql_query($sql);


		?>
		<div class="coll_tabBox">
			<ul>
				<?php
				while ($roy = sql_fetch_array($rsy)) {
					?>
					<li><a class="<?= $yy == $roy[yy] ? "on" : ""; ?>"
							href="<?= $_SERVER['PHP_SELF']; ?>?yy=<?= $roy[yy] . $qstr ?>">
							<?= $roy[yy] ?>
						</a></li>
					<?php
				}
				?>
			</ul>
		</div>
		<!-- //Year Select Tab -->

		<div class="coll_top">
			<?php
			if($yy==2023){
			?>
			<div class="top_cont">
				<div class="txt_box">
					<h3>2023 APCTP Spring Colloquium</h3>
					<p>Through this colloquium, not only recent trends but also long-standing problems in theoretical
						physics will be discussed based on unique and fundamental perspectives, providing young
						scientists motivation and inspiration on theoretical physics.</p>
					<div>
						<div class="info">
							<dl>
								<dt>Time</dt>
								<dd>March ~ June, 2023</dd>
							</dl>
							<dl>
								<dt>Place</dt>
								<dd>Online via Zoom</dd>
							</dl>
							<dl>
								<dt>Organizer</dt>
								<dd>Ki-Seok Kim (POSTECH/APCTP(SAG))</dd>
							</dl>
						</div>
						<img class="img_qr" src="/theme/d/html/image/n/research/qrcode.jpg" alt="">
					</div>

				</div>
				<div class="img_box">
					<img src="/theme/d/html/image/n/research/colloquium_poster_2023.jpg" alt="">
					<a href="/theme/d/html/image/n/research/colloquium_poster_2023.jpg" target="_blank"><img
							src="/theme/d/html/image/n/research/btn_oriPoster.png" alt=""></a>
				</div>
			</div>
			<?}else if($yy == 2022){ ?>


			<div class="top_cont">
				<div class="txt_box">
					<h3>2022 APCTP Spring Colloquium</h3>
					<p>Through this colloquium, not only recent trends but also long-standing problems in theoretical
						physics will be discussed based on unique and fundamental perspectives, providing young
						scientists motivation and inspiration on theoretical physics.</p>
					<div>
						<div class="info">
							<dl>
								<dt>Time</dt>
								<dd>March ~ June, 2023</dd>
							</dl>
							<dl>
								<dt>Place</dt>
								<dd>Online via Zoom</dd>
							</dl>
							<dl>
								<dt>Organizer</dt>
								<dd>Ki-Seok Kim (POSTECH/APCTP(SAG))</dd>
							</dl>
						</div>
						<img class="img_qr" src="/theme/d/html/image/n/research/qrcode.jpg" alt="">
					</div>

				</div>
				<div class="img_box">
					<img src="/theme/d/html/image/n/research/poster_01.jpg" alt="">
					<a href="/theme/d/html/image/n/research/poster_01.jpg" target="_blank"><img
							src="/theme/d/html/image/n/research/btn_oriPoster.png" alt=""></a>
				</div>
			</div>
			<? }?>
		</div>
		<!-- //Colloquium Top(Fixed) -->

		<div class="coll_list">
			<div class="search__box">
				<p class="total">Total: <span>
						<?= number_format($total_count); ?>
					</span></p>

				<form action="<?= $_SERVER['PHP_SELF']; ?>" id="fw1" method="get">
					<fieldset class="search_wrap">
						<div class="search">
							<select name="part" id="" class="search_select">
								<option value="">All</option>
								<option value="title" <?= $_GET[part] == "title" ? "selected" : ""; ?>>Title</option>
								<option value="spk" <?= $_GET[part] == "spk" ? "selected" : ""; ?>>Speaker</option>
							</select>														
						</div>
						<div class="search_box">
							<input type="text" placeholder="Search" name="word" value="<?= $word ?>" class="sch_input inputText ss2">
							<button type="submit" class="sch_btn btn_search"><i class="icon-search" aria-hidden="true"></i><span class="sound_only"></button>
						</div>
					</fieldset>
				</form>
			</div>

			<ul>
				<?php
				for ($i = 0; $row = sql_fetch_array($result); $i++) {
					$addon2 = sql_fetch("select * from c_program_Colloquium_addon where idproid = '{$row[id]}' and type = 'applicant' limit 1;");
					$addon = sql_fetch("select * from c_program_Colloquium_addon where idproid = '{$row[id]}' and type = 'speakers' limit 1;");

					if ($_SERVER['REMOTE_ADDR'] == '182.215.22.194') {
						//print_r($row);
					}
					?>
					<li>
						<span class="date"><?= $row[tdate] ?></span>
						<div class="tit_area">
							<div class="tit col__tit">
								<p><a href="colloquium-read.php?id=<?php echo $row['id']; ?>&page=<?php echo $page; ?>">
										<?php if ($row['by_apctp'] == "Y") { ?>[JRG] <?php } ?>
										<?php echo $row['title']; ?>
									</A></p>
								<ul>
									<li><span>Speaker:</span>
										<?php echo $addon['firstname']; ?> <?php echo $addon['middlename']; ?>
										<?php echo $addon['lastname']; ?>
									</li>
									<li><span>Affiliation:</span>
										<?= $addon[affiliation] ?>
									</li>
									<? if ($row['link']) { ?>
									<li><a class="link" href="<?= $row['link'] ?>" target="_blank">Zoom</a></li>
									<? } ?>

									<? if ($row[watch_again]) { ?>
									<li><a class="link" href="<?= $row[watch_again] ?>" target="_blank">Watch again</a></li>
									<? } ?>
								</ul>
							</div>
							<a class="btn_more"
								href="colloquium-read.php?id=<?php echo $row['id']; ?>&page=<?php echo $page; ?>"><img
									src="../image/sub/coll_more_btn.png" alt="More"></a>
						</div>
					</li>
					<?php } ?>
				<?php if ($i == 0) { ?>
					<li>
						<p class="title">
							<?php echo lang("자료가 없습니다."); ?>
						</p>
					</li>
					<?php } ?>

				<!--
					<li>
						<span class="date">2022-09-02</span>
						<div class="tit_area">
							<div class="tit">
								<p><a href="08.php"> Partial transpose for quantum matter, spacetime and information</a></p>
								<ul>
									<li><span>Speaker:</span> Edward Witten</li>
									<li><span>Affiliation:</span> MIT</li>
									<li><a href="#" target="_blank">Watch again</a></li>
								</ul>
							</div>
							<a class="btn_more" href="08.php"><img src="../image/sub/coll_more_btn.png" alt="More"></a>
						</div>
					</li>
					<li>
						<span class="date">2022-09-02</span>
						<div class="tit_area">
							<div class="tit">
								<p><a href="08.php"> Partial transpose for quantum matter, spacetime and information</a></p>
								<ul>
									<li><span>Speaker:</span> Edward Witten</li>
									<li><span>Affiliation:</span> MIT</li>
									<li><a href="#" target="_blank">Watch again</a></li>
								</ul>
							</div>
							<a class="btn_more" href="08.php"><img src="../image/sub/coll_more_btn.png" alt="More"></a>
						</div>
					</li>

		-->

			</ul>

			<!-- 여기아래 주석 사이에 페이징 넣어주시면 돼용 -->

			<!-- //Pagination(페이징) -->
			<center>
				<br><br><br>
				<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, '?' . $qstr . '&amp;page='); ?>
			</center>
		</div>
		<!--//Colloquium List  -->
	</div>

</div>



<?php
include_once('tail.php'); //회사소개의 공통 하단을 연결합니다.
include_once(G5_THEME_PATH . '/tail.php'); //그누보드의 공통 상단을 연결합니다.
?>