소스 파일 : /view/view_word.php (2021-06-24)     소스 설명 : (용어 보기) ... 작성중
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
<?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." &nbsp; ".$m_2." &nbsp; ".$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) : &nbsp; </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 "&nbsp; [".$leaf_name."] &nbsp;&nbsp; ";

/*
        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 " &nbsp; ";
            $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 " &nbsp; ";
            $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  "&nbsp;&nbsp;&nbsp;&nbsp; : &nbsp;&nbsp;&nbsp;&nbsp;".
                                        number_format(word_statistics($dbi)['gubun_num'])."개 분류";
        	    	echo  "&nbsp;&nbsp;&nbsp;&nbsp;". number_format(word_statistics($dbi)['word_num']). "건 해설";
                echo "</span>" ."\n";;

                // 편집이력
//                echo "&nbsp;&nbsp;&nbsp; <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";
}

?>


"본 웹사이트 내 모든 저작물은 원출처를 밝히는 한 자유롭게 사용(상업화포함) 가능합니다"