테스트 사이트 - 개발 중인 베타 버전입니다

PHP 관련 도무지몰라서요 질문 드립니다. 채택완료

꿈의세계 2년 전 조회 2,827

안녕하세요

아래 이미지를 보시면 의회운영위원회  사회도시위원회 이것을 폴더 형태로 한댑스 더 늘리고 싶은데 이게 코드가 너무 어렵게 짜여져있어서 도무지 알 수가 없어서요 혹시 아시는 분 계실까요

혹시몰라서 코드도같이 올려 드립니다.

 작업 하고 있는사이트 주소는 https://yscl.homweb.co.kr/page/page05_02_02.php 입니다

page05_02_02.php 이파일은 아무래도그냥 뿌려주는 것 같습니다.   

</strong></p>

<p> <?php

if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가</p>

<p>include_once(G5_THEME_PATH.'/head.php');

?></p>

<p><!--기존 유성구의회 원본 파일 -->

<!-- 레이아웃 : 서브본문 --></p>

<p><div id="sub_simple" class="sub_default">

    <div class="assem_info Square">

        <p class="first">회의록을 <span>회기별</span>로 검색하실 수 있습니다.</p>

        <p class="last">원하시는 회의를 클릭하시면 해당 검색 내용을 보실 수 있습니다.</p>

    </div>

    <!-- ul id="late_skin"> <?  $ROOT_DIR = "../../../"; include $ROOT_DIR."CLRecords/Retrieval/listl.php"; ?> </ul -->

</div></p>

<p>

<!-- 새로 적용할 곳 -->

<link rel="stylesheet" href="<?=G5_THEME_URL?>/pages/css/ui.fancytree.css">

<h5>회기별</h5>

<div id="sub_assembly" class="sub_default">

    <div id="tree"></div>

</div></p>

<p><script type="text/javascript" src="<?=G5_THEME_URL?>/pages/js/jquery-ui.min.js"></script>

<script src="<?=G5_THEME_URL?>/pages/js/jquery.fancytree-all.js"></script>    

<script src="<?=G5_THEME_URL?>/pages/js/jquery.cookie.js"></script></p>

<p><script>    

    $(function(){

        $("#tree").fancytree({

            extensions:["persist"],

            persist:{

                expandLazy:true,

                overrideSource:true,

                store:"auto"

            },        

            clickFolderMode:2,

            source: [

                <?php

                    $qryd = "select f_daesu,f_datestr from tbl_daesu order by f_daesu desc";

                    $rsd = sql_query($qryd);

                    if(!$rsd) {

                        ?>{"title":"자료가 없습니다."},<?php

                    } else while($rowd = sql_fetch_array($rsd)) {

                        $strd = "<a href='?daesu=".$rowd[f_daesu]."&amp;tag=lth#postop'>".$rowd[f_datestr]."</a>";

                        ?>{"mode":"session","folder":"true","th":'<?=$rowd['f_th']?>',"lazy":"true","councilId":"<?=$rowd['f_daesu']?>","title":"<?=$rowd['f_datestr']?>"},<?php

                    }

                ?>

            ],

            lazyLoad:function(event,data){

                var mode = data.node.data.mode;

                if(mode == "session"){

                    var councilId = data.node.data.councilId;

                    var th = data.node.data.th;

                    data.result = {

                        url:"/page/page05_02_02-ajax.php",

                        data:{councilId:councilId}

                    }

                } else if (mode == "committee") {

                    var councilId = data.node.data.councilId;

                    var th = data.node.data.th;

                    var session = data.node.data.session;

                    data.result = {

                        url:"/page/page05_02_02-ajax.php",

                        data:{councilId:councilId,th:th}

                    }                

                } else if (mode == "order") {

                    var councilId = data.node.data.councilId;

                    var th = data.node.data.th;

                    var session = data.node.data.session;

                    var code = data.node.data.code;

                    data.result = {

                        url:"/record/orderList.do",

                        data:{councilId:councilId,th:th,session:session,code:code}

                    }                

                } else if (mode == "item") {

                    var rid =  data.node.data.rid;

                    data.result = {

                        url:"/record/itemList.do",

                        data:{rid:rid}

                    }                

                } else {

                    alert("입력값이 잘못 되었습니다.");

                    return false;

                }

            }

        });

    });

</script></p>

<p> <strong>

 

실제로 돌아가는 것은 아래 파일 인것 같은데 제가 수정을 도무지 할 수 없어서요 

page05_02_02-ajax.php

아래 소스가 실제로 돌아가는 파일 인 것 같은데 수정하기가너무 어려워서요 

</strong></p>

<p><?php

include '_common.php';</p>

<p>$daesu= $_GET['councilId'];

$th= $_GET['th'];</p>

<p>$data=array();</p>

<p>if( $daesu ) {

    if( $th) {

        if($th > 1990 ) { $w_c = " and f_code like 'H%'"; }else { $w_c=''; }</p>

<p>        $qryn = "select f_code,f_etc1 from tbl_main where f_daesu = '".$daesu."' and f_th = '".$th."' ".$w_c." group by f_code order by f_code asc";

        $rsn = sql_query($qryn);

        if( $rsn)  while($rown = sql_fetch_array($rsn)) {

            $fetc1 = str_replace("유성구의회", "", $rown[f_etc1]);</p>

<p>            //print("<li class='minus'>".$fetc1);

            //print("<ul>");</p>

<p>            $qrycha = "select f_th,f_cha,f_code,f_datestr,f_file,f_chastr,f_etc1,f_etc2,f_angunyn from tbl_main where f_code = '".$rown[f_code]."' and f_th = '".$th."' order by f_date asc, f_ilcha asc, f_cha asc";

            $rscha = sql_query($qrycha);

            if( $rscha) while($rowcha = sql_fetch_array($rscha)) {</p>

<p>                $strL = "";

                $strTh = $rowcha[f_chastr]."(".$rowcha[f_datestr].")";

                if($rowcha[f_angunyn] == "y") {

                    $qryan = "select * from tbl_angun where f_file = '".$rowcha[f_file]."' order by f_angunno asc";</p>

<p>                    $rsan = sql_query($qryan);

                    if(!rsan) {

                        //print("





<center><strong>회의록을 검색하는 중에 에러가 발생했습니다(4).</strong></center>");

                        exit;

                    }

                    $count = 1;

                    while($rowan = sql_fetch_array($rsan)) {

                        if($count > 13) {

                            $strL .= ".................\n";

                            break;

                        }

                        $strL .= trim($rowan[f_angun1])."\n";

                        $count++;

                    }

                }

                else {

                    $strL = $strTh;

                }

                if($strL == "") {

                    $strL = $strTh;

                }

                $strCha = "<a href=\"/CLRecords/Retrieval2/index.php?hfile=".$rowcha[f_file]."&amp;daesu=".$daesu."\" onclick=\"window.open(this.href, 'late', 'scrollbars=no,width=1024,height=768'); return false;\" title=\"".$strL."(새창)\">".$strTh."</a>";

                //print("<li class='minus'>".$strCha."</li>");

                $data[]= array("title"=>"{$fetc1} {$strCha}");

            }

        }

    } else {

        

        $qryth = "select f_th,f_date1,f_date2,f_sort from tbl_session where f_daesu = '".$daesu."' order by f_th desc";

        $rsth = sql_query($qryth);

        

        while($rowth = sql_fetch_array($rsth)) {

            $session = incSessionDis($rowth[f_date1],$rowth[f_date2]);

            if($rowth[f_th] > 1990) {

                $strTh = " ".$rowth[f_th]."년도 행정사무감사".$session;

            } else {

                $strTh = " 제".$rowth[f_th]."회".$rowth[f_sort].$session;

            }

            //$strTh = "<a href='?daesu=".$daesu."&amp;th=".$rowth[f_th]."&amp;tag=lcha#postop'>".$strTh."</a>";

            //print("<li>".$strTh."</li>");

            $data[]= array("mode"=>"committee","folder"=>"true","code"=>"J151","th"=>$rowth['f_th'],"lazy"=>"true","session"=>2018,"councilId"=>$daesu,"title"=>"{$strTh}");

        }

    }

}

if( empty( $data)) $data[]=array( 'title'=>'자료가 없습니다.');

echo json_encode( $data);

<strong>

   

댓글을 작성하려면 로그인이 필요합니다.

답변 3개

채택된 답변
+20 포인트

디비 열어서 tbl_main나 tbl_session 같은 테이블 살펴 보고 인서트하면 될 거 같긴 한데요

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

복스리
2년 전

ajax로 내용을가지고 와서 tree형식으로 attatch를 해주는 형식입니다.

이부분은 php기술보단 javascript쪽에 비중이 더 높지 않나 생각됩니다. 

일단 서버쪽에서 해당 데이터를 입력해서 json으로 잘 출력되는지를 먼저 확인해보시기 바랍니다.

해보시다 어려우시면  쪽지 주시면 도움드리겠습니다.

 

 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

꿈의세계
2년 전
친절하게 답변해주셔서 정말 감사 드립니다.
그리고 쪽지 드렸습니다.
복스리
2년 전
쪽지 온거 없는데요? ^^

댓글을 작성하려면 로그인이 필요합니다.

2년 전

트리 구조는 jquery fancytree 를 사용하는 거 같으니, 우선적으로 jquery fancytree에 대해서 알아보시는 게 첫번째인 것 같습니다.

현재의 DEPTH에서 1단계를 더 늘리고자 한다면, DB(아마도 tbl_main)의 구조변경이 이루어져, 1단계를 더 구분할 수 있도록 해야 할 것 같네요.

이후 하위 카테고리를 불러오는 mode == session, mode == committee 외에 (위 구조로 봤을때는 committee 시 하위 카테고리를 불러올 수 있는 mode 가 추가되어야 할 것 같습니다.

depth를 1단계 더 늘린다는 건 단순한 작업이 아닙니다. 그에 따른 DB 구조의 변화도 이루어져야 하고,

입력폼부터 출력폼까지 모두 변화가 이루어져야 합니다.

 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인