<?
// 기본 설정 로딩
require_once 'config.php';
require_once 'function.php';
require_once 'lib.php';

//HTML 시작

if ($_GET[page] == 'default') {$option = 'limit 0,5';} else { $option = '';}

switch ($_GET[name]) {
    #기타
    case '송충호':$option2 = "or receiver like '영업'";
        break;
    case '김효영':$option2 = "or receiver like '영업'";
        break;
    #1팀
    case '신인철':$option2 = "or receiver like '1팀' or receiver like '팀장' or receiver like '네트워크'";
        break;
    case '박요한':$option2 = "or receiver like '1팀' or receiver like '영업' or receiver like '네트워크'";
        break;
    case '이지승':$option2 = "or receiver like '1팀' or receiver like '시스템'";
        break;
    case '조준희':$option2 = "or receiver like '1팀' or receiver like '네트워크'";
        break;
    case '김대영':$option2 = "or receiver like '1팀' or receiver like '네트워크'";
        break;
    #2팀
    case '김용민':$option2 = "or receiver like '2팀' or receiver like '팀장' or receiver like '시스템'";
        break;
    case '이풍호':$option2 = "or receiver like '2팀' or receiver like '네트워크'";
        break;
    case '강부중':$option2 = "or receiver like '2팀' or receiver like '네트워크'";
        break;
    case '김은혁':$option2 = "or receiver like '2팀' or receiver like '영업' or receiver like '네트워크'";
        break;
    case '김영석':$option2 = "or receiver like '2팀' or receiver like '시스템'";
        break;
    #기타
    case '고병남':$option2 = "or receiver like '영업' or receiver like '팀장'";
        break;
    case '최진호':$option2 = "or receiver like '영업'";
        break;
    #알바
    case '류축복':$option2 = "or receiver like '알바'";
        break;
    case '박소영':$option2 = "or receiver like '알바'";
        break;
    case '이민제':$option2 = "or receiver like '알바'";
        break;
    case '류은총':$option2 = "or receiver like '알바'";
        break;

    default:$option2 = '';
        break;
}

$query = "select * from commentdb where ID like '$_GET[name]' order by num desc $option";
#$query="select * from onetimedb inner join memberdb where onetime_case like 'domain' order by onetime_request_date desc";
?>
<?
$list_no = (!$_GET[ea]) ? '200' : $_GET[ea];

$total_num = mysql_num_rows(mysql_query($query, $db_connect));

$total = $total_num;
if ($list_no > $total) {$list_no = $total;}
$total_page = ($total != '0') ? ceil($total / $list_no) : '0';

$page = $_GET[page];

if (!$page) {$page = 1;} elseif ($page >= $total_page) {$page = $total_page;} else { $page = $page;}

$next_page = ($page-'1') * $list_no;
$next_no = $next_page + $list_no;

$result = @mysql_query($query, $db_connect) or die($db_q_error);
?>
<!--수신한 전체 메모 : <?=$total?>-->
<?=$msg?>
<div class="table-responsive" id="table">
<table class="table table-bordered table-hover table-striped" border=1 text-align=center>
<thead>
<tr>
<td width="40">구분</td>
<td width="170">내용</td>
<td width="70">보낸날짜</td>
<td width="80">보낸시간</td>
<td width="90">받는사람</td>
<td width="90">확인</td>
</tr>
</thead>
<tbody>
<?

for ($i = $next_page; $i < $next_no; $i++) {
    $data = mysql_fetch_assoc($result);
    $num = ($total) - $i;
#        $reg_date=date("Y/m/d H:i", $data['reg_date']);
    # ($data[onetime_manager])
    /*
    switch($_GET[mode]){
    case "today":
    //당일
    $name="";
    break;
    case "1day":
     */
    ?>

<tr>
<?
    switch ($data[comment_case]) {
        case '1':$data[comment_case] = '<b><font color=red>긴급</font></b>';
            break;
        case '2':$data[comment_case] = '<font color=skyblue>지시</font>';
            break;
        case '3':$data[comment_case] = '<font color=green>전달';
            break;
        case '4':$data[comment_case] = '<font color=pupple>기타';
            break;
        default:$data[comment_case] = '일반';
            break;
    }
    ?>
<td><?=$data[comment_case]?></td>
<td><?=nl2br($data[content])?></td>
<td><?=$data[write_date]?></td>
<td><?=$data[write_time]?></td>
<td><?if ($data[receiver] != '전체') {echo "$data[receiver]";} else {echo "<font color=red>$data[receiver]</font>";}?></td>
<td>
<?if ($data[read_check] == 1) {
        $msg = '읽음';
    } elseif ($data[read_check] == "0") {
        $msg = '읽지않음';
    } else {
        $msg = $data[read_check];
        $msg = str_replace("0,", '', $msg);
    }?>
<?=$msg?>
</td>
</tr>
<?}?>
</tbody>
<tfoot></tfoot>
</table>
<!--
<div align='center'>
<?
$setup_dir = "http://" . $_SERVER['HTTP_HOST'] . ":6752";
$page_scale = 10;
$page3 = floor(($total_page-'1') / $page_scale);
$n_page = floor(($page-'1') / $page_scale);

if ($n_page > 0) {

    $p_start = (($n_page - 1) * $page_scale)+'1';
    $link = "<a onfocus=blur() href='" . $setup_dir . "/IdcDepositNonPaymentListMK.dep?mode=$_GET[mode]&ea=$_GET[ea]&page=" . $p_start . "'>";
    $link .= "<<";
    $link .= "</a>";
    echo $link . " ";
}
$is = ($n_page * $page_scale)+'1';
for ($i = $is; $i < $is + $page_scale; $i++) {

    if ($i < $total_page+'1') {
        if ($i == $page) {$ib = "<b>$i</b>";} else { $ib = $i;}
        $link = "<a onfocus=blur() href='" . $setup_dir . "/IdcDepositNonPaymentListMK.dep?mode=$_GET[mode]&ea=$_GET[ea]&page=" . $i . "'>";
        $link .= $ib;
        $link .= "</a>";
        echo $link . " ";
    }
}
if ($n_page < $page3) {
    $link = "<a onfocus=blur() href='" . $setup_dir . "/IdcDepositNonPaymentListMK.dep?mode=$_GET[mode]&ea=$_GET[ea]&page=" . $i . "'>";
    $link .= ">>";
    $link .= "</a>";
    echo $link;
}
?>
</div>
-->



<?
//DB닫기
mysql_close($db_connect);
?>

