<?php
$cate_id = "mnu_board_contents"; //현재 메뉴 ID 필수!!!
include_once "{$_SERVER['DOCUMENT_ROOT']}/common.inc.php";
include_once _ADM_INC_PATH_ ."/auth_check.php";
include_once _HOME_INC_PATH_ ."/ajax_init.php";

if( !$brdObj ){
  $brdObj = new Board("");
}

switch( $_REQUEST['mode'] ){

  //게시물 리스트
  case "getContentsList" :
    $lists = $brdObj->getAllContentsPage($_REQUEST);
    $retval['code'] = 1;
    $retval['data'] = $lists;
    $retval['mesg'] = cUtil\Mlang::getText("리스트를 불러오는 도중 오류가 발생하였습니다.");
  break;

  //게시물 삭제
  case "delContents" :

    if( _notAuth("D") ) break; /************ 권한체크*/

    $retval['code'] = 1;
    for( $a=0 ; $a<@count($_REQUEST['del_chk']) ; $a++ ){
      $binfo = explode("|", $_REQUEST['del_chk'][$a]);
      $_brd = new Board( $binfo[0] );
      $retval['code'] = $retval['code'] && $_brd->delContents($binfo[1]);
    }
    $retval['mesg'] = "삭제중 오류가 발생하였습니다.";
  break;

}

if( !$_REQUEST['no_echo'] ){
  echo json_encode($retval);
}