<?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'); //회사소개의 공통 상단을 연결합니다.

	if(!$id) alert("error", "/");

$row = sql_fetch("select * from c_program_ws where id = '{$id}';");
$addon2 = sql_query("select * from c_program_ws_addon where idwsid = '{$row[id]}' and idproid = '{$row[idproid]}' and type = 'organizers';");
if ($row["link"] == "http://") $row["link"] = "";
if ($row["web_format"] == "Center Format" && ($row['period1'] <= "2021-08-25 00:00:00" && $row['idate'] <= "2021-08-25 00:00:00")) {
	// 혹시 빌더로 생성된 메뉴가 있는가?
	// URL ACTIVATE 가 Y 일때만 주소를 뽑음
	$sql2 = "select urlkeyword from webbuilder_set where idproid='".$row["idproid"]."' and idwsid='".$row["id"]."' and activate='Y' order by id desc limit 1";
	$Rs2 = sql_fetch($sql2);
	if ($Rs2['urlkeyword'] != "") $old_data = true;
	if ($Rs2['urlkeyword'] != "") $row["link"] = "http://45.120.69.181/plan.php/".$Rs2['urlkeyword'];
		else $row["link"] = "";
}

//신규 웹빌더 자료가 있다면 그거 우선
$new_webb = sql_fetch("select * from apctp_webbuilder where idproid = '{$row['id']}';");
$webb_addon = sql_query("select * from apctp_webbuilder_addon where idwbid = '{$new_webb[id]}' and type = 'field';");
$page = sql_fetch("select * from apctp_webbuilder_menu where idwbid = '{$new_webb[id]}' and id = '{$m_id}';");
$page_data = sql_query("select * from apctp_webbuilder_content where idwbid = '{$new_webb[id]}' and m_id = '{$m_id}';");

if(!$m_id) {
	$page = sql_fetch("select * from apctp_webbuilder_menu where idwbid = '{$new_webb[id]}' and menu_name = 'Overview';");
	$page_data = sql_query("select * from apctp_webbuilder_content where idwbid = '{$new_webb[id]}' and m_id = '{$page[id]}';");
}
?>

<link rel="stylesheet" href="<?php echo G5_THEME_URL;?>/html/css_js/_webbuilder-view.css?ver=<?php echo G5_CSS_VER ?>">


<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>


<?php
  include_once(G5_THEME_PATH.'/head-wb-view.php');
?>


	<?php
		include_once(G5_THEME_PATH.'/lnb-wb-view.php');
	?>

	<section class="scontents">

		<div class="bg_vline"></div>
		<p class="eng"><?php echo $page['menu_name']; ?></p>
		<p class="stitle"></p>


    <div class="activities-read">


        <?php
        	for($i=0; $rows=sql_fetch_array($page_data); $i++) {
        ?>
				<?php if($rows['type'] == "file") { ?>
					<div class="file">
					<strong>FILE : </strong><a href="/data/upload/wb/<?php echo $rows['idwbid']; ?>_<?php echo $rows['m_id']; ?>_<?php echo $rows['id']; ?>" download="<?php echo $rows['filename']; ?>"><?php echo $rows['filename']; ?></a> (<?php echo $rows['content']; ?>)
					</div>
				<?php } ?>
        		<?php if($rows['type'] == "editor") { ?>
        			<div class="text">
					<?php echo $rows['content']; ?>
					</div>
				<?php } ?>
       	<?php } ?>
    </div>

	</section>

	<footer class="wb-footer">
		<center class="tablize">
			<p>All information collected will be used internally only for administrative purposes and kept confidential.</p>
			<h1 class="logo_a"><a href="/" target="_blank"><img src="<?php echo G5_THEME_URL;?>/html/image/n/h1.jpg" alt="apctp"></a></h1>
		</center>
	</footer>



<?php
	include_once('tail.php'); //회사소개의 공통 하단을 연결합니다.
	include_once(G5_THEME_PATH.'/tail.php'); //그누보드의 공통 상단을 연결합니다.
?>
