<?php // (2025.3.16, 차재복, Cha Jae Bok, http://www.ktword.co.kr)
// 용어 해설 편집 ------------------------------------
if ( false ) {
// ...
// 용어 해설 보이기 ----------------------------------
} else if (!empty($m_temp1)) {
// 용어해설 보이기 div
echo "<div id='body' style='margin-left:10px; margin-bottom:5px;'>";
// content (용어 타이틀,본문 등) 보이기 위한 db record 쿼리 ==========
$query="SELECT yako,full_name,korean,extra_keyword,date_format(sujung,'%Y-%m-%d') as f_date,a.no,imgfilename,b.abbr FROM cjb_dict a left join dict_anchor b on a.no=b.no WHERE a.no=$m_temp1";
$result=mysqli_query($dbi,$query);
if (mysqli_errno($dbi)) { echo mysqli_errno($dbi)." : ".mysqli_error($dbi)."\n";}
$matched=mysqli_fetch_assoc($result);
// 컨텐츠 타이틀부 (title) =====================================
// 컨텐츠 내용 헤더부
echo "<div id='body_title'>";
// (약어,영문,국문) 타이틀 스트링 추출하기
$m_1=str_replace(',',', ',$matched['yako']);
$m_2=str_replace(',',', ',$matched['full_name']);
$m_3=str_replace(',',', ',$matched['korean']);
$m_str = $m_1." ".$m_2." ".$m_3;
// 타이틀 중에 pair_delimiter : extra_keyword 내용 중에 `[ ... ]` 없애기
include_once "../base_utils/common_utils.php"; // pair_delimiter() 함수
$m_str_1 = ($m_edit_level != $editor ? pair_delimiter($m_str,'[',']') : $m_str );
$m_str_2 = ($m_edit_level != $editor ? pair_delimiter($matched['extra_keyword'],'[',']') : $matched['extra_keyword'] );
$m_str_1 = str_replace(" , ",", ",$m_str_1);
// 주 타이틀, 최종수정일, 부 타이틀 => 배열화
$m_arr = array($m_str_1,$matched['f_date'],$m_str_2);
// 주 타이틀,수정일,부 타이틀 등
echo "<table width='95%' style='margin-bottom:5px'>";
// 주 타이틀
echo "<tr><td><h1>";
echo pair_delimiter($m_arr[0],'[',']');
// echo $m_arr[0];
echo "</h1></td>";
// 수정일
echo "<td width=15% align='right' style='font-size:13px;'>";
// 최종수정일
echo "(".$m_arr[1].")";
echo "</td>";
// 편집 버튼 (new)
if ($_SESSION['user_type'] == '종합관리자') {
echo "<td>";
// 신 편집
echo "<form action='../edit/edit.php' method=post style='display:inline; margin:0; padding:0;'>";
echo "<input type=submit name=m_submit_edit value='편집' style='padding:0'>";
echo "<input type=hidden name=no value={$m_temp1}>";
echo "<input type=hidden name=win value='new'>";
echo "</form>";
// 구 편집
echo "<form action='/word/abbr_view.php' method=post style='display:inline; margin:0; padding:0;'>";
echo "<input type=submit name=m_submit_edit value='(구)편집' style='padding:0'>";
echo "<input type=hidden name=m_super_edit value='수정화면'>";
echo "<input type=hidden name=m_temp1 value={$m_temp1}>";
echo "<input type=hidden name=win value='new'>";
echo "</form>";
echo "</td>";
}
echo "</tr>";
// 부 타이틀
if ( !empty($m_arr[2])) {
echo "<tr><td colspan=2 style='font-size:13px;'>";
echo "<h2 style='font-size:11pt; font-weight:normal; margin:0px;'>";
$sub_title = pair_delimiter($m_arr[2],'[',']');
echo str_replace(",",", ",$sub_title);
// echo str_replace(",",", ",$m_arr[2]);
echo "</h2></td></tr>";
}
echo "</table>";
echo "</div>";
// 해당 no 관련 id들에 대한 path 보여주기
echo "<div id='dropdownDiv'>";
echo "<link rel='stylesheet' href='../navigation/short_navi.css' type='text/css'>";
echo "<div class='treeDiv' data-menutype='clickMenu' style='display:inline-block;'>";
include_once "../navigation/naviFetch.php";
if(empty($no) and !empty($m_temp1)) $no = $m_temp1;
$path_arr = phpFetchPath($no, $dbi);
echo $path_arr['output'];
echo "</div>";
echo "</div>";
/*
echo "<div id='body_path' class='tree_path'>";
include_once "view_path.php";
echo "</div>";
*/
echo "<hr style='margin-top:15px; border-bottom:1px gray dotted;'>";
// ------------------ 컨텐츠 헤더부 끝
// 컨텐츠 본문부 (content body) 출력 ==============================
echo "<div id='body_text' style='margin-left:10px;'>";
// 용어해설 컨텐츠 본문에 대한 사용자정의 함수 루틴 포함
include_once "view_body_text.php";
echo "<pre>"."\n";
// 본문(boy text) 내용 출력 ------------------------------------------------------
if ( !empty($m_temp1) ) {
body_text($m_temp1,$matched['abbr'],$matched['imgfilename'],$dbi);
// 본문 비었을 경우, 16개 빈 줄 출력
} else {
echo str_repeat(' <br>',16);
}
echo "</pre>";
echo "</div>";
/*
// 컨텐츠 하단부 (하부 용어 리스트 보여주기) ====================================
// (필요 변수 : $choiced_id, $choiced_row, $choiced_sub, $choiced_per_parent_rows)
echo "<br><hr>";
echo "<table id='body_foot'><tr>";
echo "<td class='tree_path'>";
echo "[<a href='abbr_view.php?nav=2&id=".$choiced_id."'>".$choiced_row[name]."</a>]";
echo "</td>";
echo "<td class='tree_path'>";
foreach ($choiced_sub as $key => $value) {
echo " ".($key+1).". ";
if ($value[no] == $m_temp1) echo "<b>";
echo "<a href='view.php?nav=2&m_temp1=".$value[no]."'>".$value[titlename]."</a> ";
if ($value[no] == $m_temp1) echo "</b>";
}
echo "<br>";
if(count($choiced_per_parent_rows[$choiced_id])>0) {
foreach ($choiced_per_parent_rows[$choiced_id] as $key => $value) {
echo "[<a href='view.php?nav=2&id=".$value[id]."'>".$value[name]."</a>] ";
}
}
echo "</td>";
echo "</tr></table>";
*/
# 하단 해당 용어 분류 항목들 보이기 (multipage 형태)
echo "<hr style='margin-top:40px;margin-bottom:10px;'>";
echo "<div>";
foreach($path_arr['src_arr'] as $key => $value) {
leaf_names_display_multipage($value['upper_id'],$value['upper_name'],$value['sub_path'],$no,$dbi);
echo "<br>";
}
// 용어별 검색 Form
echo "<form action='/test/search/srch.php' name='srch_form' method='post' style='margin-top:10px;margin-bottom:20px;'>";
echo "<input type='text' name='m_search' size=15>";
echo "<button type='submit'>검색</button>";
if($_SESSION['user_type'] == '종합관리자') echo "<input type=submit value='새창' formtarget='_blank'>";
echo "<input type='hidden' name='opt' value='search'>";
echo "<input type='hidden' name='m_text'>";
echo "</form>";
echo "<a href='/test/navigation/yoyak_v2.php?no=$m_temp1'>용어해설 종합 (단일 페이지 형태)</a>";
echo "</div>";
# 저작권
echo "<hr style='clear:both; margin-top:15px;'>";
include_once "../base_utils/copyright.php";
# 편집 알림
$file_name = "../../cjb/private_cjb.php";
if (file_exists($file_name)) {
include_once $file_name;
copyright4index($dbi);
echo "<br><br>";
}
# 수평선 (용어해설 분류 펼침 및 검색)
if ($_SESSION['user_type']=='종합관리자') {
/*
// 앞 문자열 뒤 수평선
echo "<div id='line-with-text' style='margin-left:25px;'>";
echo "<span>< 단일 페이지 종합 ></span>";
echo "</div>";
*/
echo "<hr style='margin:20px 0 10px 20px; border:1px dashed gray;'>";
/*
echo "<pre>";
var_dump($path_arr['src_arr']);
echo "</pre>";
*/
echo "<div style='margin-left:20px;'>";
# 하단 해당 용어 분류 항목들 보이기 (onepage 형태)
foreach($path_arr['src_arr'] as $key => $value) {
leaf_names_display($value['upper_id'],$value['upper_name'],$value['sub_path'],$no,$dbi);
echo "<br>";
}
// navigation click history div
echo "<div id='history_div'>"; // style='margin:0 0 0 30px;padding:0;display:flex;'
// echo "<span style='opacity:0;margin:0;padding:0;font-size:12px;'>(history) : </span>";
// echo "<div style='display:inline-block; width:80%; white-space: nowrap; overflow:hidden;text-overflow: ellipsis;margin:0;padding:0;font-size:12px;'></div>";
echo "</div>";
# 용어해설 분류 펼침 및 검색
view_navi($dbi);
echo "</div>";
}
echo "</div>"; // div id='body'의 끝 (용어해설 보이기 div 끝)
} // ------------------------------- 용어 해설 보이기 끝
function leaf_names_display($leaf_id,$leaf_name,$sub_path,$cur_no,$dbi){
// echo " [".$leaf_name."] ";
/*
echo "<div class='treeDiv' data-menutype='clickMenu' style='display:inline-block;'>
<span class='subMenu' data-id='$leaf_id' data-direction='v' style='position:relative;'>
<span class='bullet'>▷</span><span class='title'>$leaf_name</span>
</span>
</div>";
*/
// echo "<div style='display: inline-flex; margin-left:15px;'>";
$name = addslashes($leaf_name);
echo "<div style='display:inline-flex; align-items: center; margin-left:20px;margin-bottom:0;'>";
echo "<span style='white-space: nowrap;'>";
echo "[<a href=\"javascript:idPathFocusDirect('$sub_path','','{$name}')\" style='text-decoration:none;color:crimson;'>{$name}</a>]"; // => navi_search.js
echo "</span>";
$query="select titlename,no,list_ord,tree_id as id from book_idx where tree_id=$leaf_id order by list_ord, titlename";
$query="
(select 'no' as item_type, titlename as name, no as id, 1 as rank, list_ord as ord, '0' as child, yoyak,
'0' as id_list
from book_idx where tree_id={$leaf_id})
union all
(select 'id' as item_type, name, id, 2 as rank, sub_seq as ord, child, yoyak,
path2node_v2 as id_list
from gubun_tree_v2 where parent={$leaf_id})
order by rank,ord,name
";
$result = mysqli_query($dbi,$query);
$cnt = mysqli_num_rows($result);
$n=1;
echo "<span style='margin-left:15px;'>";
while ( $matched=mysqli_fetch_assoc($result) ) {
$name = htmlspecialchars($matched['name']);
$id = $matched['item_type'] == 'no' ? $matched['id'] : '';
$path = $matched['item_type'] == 'no' ? $sub_path : $matched['id_list'] ;
$bold = ($matched[no] == $cur_no ? 'font-weight:bold;' : '');
$color = $matched['item_type'] == 'id' ? 'color:lightcoral;' : ''; // lightcoral;salmon;indianred;
echo ($n).". ";
if ($matched['item_type'] == 'id') echo " [";
echo "<a href=\"javascript:idPathFocusDirect('{$path}','{$id}','{$name}')\" style='text-decoration:none;line-height:200%; $bold $color'>";
echo $name;
echo "</a>";
if ($matched['item_type'] == 'id') echo "]";
echo " ";
$n=$n+1;
}
echo "</span>";
echo "</div>";
}
function leaf_names_display_multipage($leaf_id,$leaf_name,$sub_path,$cur_no,$dbi){
// 현재 id
echo "<div class='treeDiv' data-menutype='clickMenu' style='display:inline-block;'>
<span class='subMenu' data-id='{$leaf_id}' data-direction='v' style='position:relative;'>
<span class='bullet'>▷</span><span class='title'>{$leaf_name}</span>
</span>
</div>";
$query="select titlename,no,list_ord,tree_id as id from book_idx where tree_id=$leaf_id order by list_ord, titlename";
$query="
(select 'no' as item_type, titlename as name, no as id, 1 as rank, list_ord as ord, '0' as child, yoyak,
'0' as id_list
from book_idx where tree_id={$leaf_id})
union all
(select 'id' as item_type, name, id, 2 as rank, sub_seq as ord, child, yoyak,
path2node_v2 as id_list
from gubun_tree_v2 where parent={$leaf_id})
order by rank,ord,name
";
$result = mysqli_query($dbi,$query);
$cnt = mysqli_num_rows($result);
$n=1;
echo "<span style='margin-left:15px;'>";
while ( $matched=mysqli_fetch_assoc($result) ) {
$name = htmlspecialchars($matched['name']);
$id = $matched['item_type'] == 'no' ? $matched['id'] : '';
$path = $matched['item_type'] == 'no' ? $sub_path : $matched['id_list'] ;
$bold = ($matched[no] == $cur_no ? 'font-weight:bold;' : '');
$color = $matched['item_type'] == 'id' ? 'color:lightcoral;' : ''; // lightcoral;salmon;indianred;
echo ($n).". ";
if ($matched['item_type'] != 'id') {
echo "<a href='view.php?no={$matched['id']}' style='text-decoration:none;line-height:200%; $bold $color'>";
echo $name;
echo "</a>";
} else {
echo "<div class='treeDiv' data-menutype='clickMenu' style='display:inline-block;'>
<span class='subMenu' data-id='{$matched['id']}' data-direction='v' style='position:relative;'>
<span class='bullet'>▷</span><span class='title'>{$name}</span>
</span>
</div>";
}
echo " ";
$n=$n+1;
}
echo "</span>";
}
?>
<?php
# 용어해설 분류 펼침 및 검색
function view_navi($dbi) {
echo "<div style='margin-top:0;padding-top:0;'>" ."\n"; // border:1px red solid;
echo "<ol class='tree' data-id='0' style='padding-left : 20px;'>" ."\n"; // id='bunryuStart'
echo "<li id='bunryuStart' data-type='word' data-id='0' style='list-style-type:none;'>" ."\n";
echo "<span class='collapse' id='wordBunryuTarget' data-id='0'>" ."\n";
// bullet
echo "<a data-id='0' class='bullet' style='color:red; cursor:pointer; padding-bottom:10px'>▷</a>" ."\n";
// title
echo "<span style='padding-bottom:10px'> Top (분류 펼침) </span>" ."\n";
// echo "<sup style='font-size:0.7em;font-style:italic;background-color:yellow;color:red;'>New</sup>";
// 현재 건수 출력
echo " : ".
number_format(word_statistics($dbi)['gubun_num'])."개 분류";
echo " ". number_format(word_statistics($dbi)['word_num']). "건 해설";
echo "</span>" ."\n";;
// 편집이력
// echo " <a href='/test/history/history.php'>편집이력</a>";
/*
// spinner 이미지
echo "<img src='/test/image/spinner1.gif' alt='spinner' class='spinner'
style='margin-left:10px; opacity:0; width:15px;height:15px;'>";
*/
// 검색 펼침
echo "<input id='bunryuSrchInput' type='text' size='5' style='margin-left:30px'>" ."\n";;
echo "<button id='bunryuSrchBtn' style='font-size:13px;padding:0px 1px;margin:0px 2px;'>분류 검색";
// echo " <sup style='color:red;background-color:yellow;font-style:italic;font-size:0.6em;'>New</sup>";
echo "</button>" ."\n";
// 검색 펼침용 div
echo "<div id='resultTest' data-type='bunryu' class='srchResultDiv' style='border:1px dotted gray; padding:10px; display:none;
line-height:180%;'></div>" ."\n";
echo "</li>" ."\n";;
echo "</ol>" ."\n";
/*
// 다중 선택 이동 편집 (작성중...)
if($_SESSION['user_type']=='종합관리자') { // id='multiChoiceMove' data-type='multi' data-id='0'
echo "<span id='multis' style='margin-left:20px;'>다중 선택 이동/복사 (관리자용)</span>";
// index.js의 window.addEventListener('load' (2) 에서, id='multis' 찾아서 처리
}
*/
echo "</div>" ."\n";
}
?>