<?
$this->load->helper('cookie');
$comment_sns_id 		= get_cookie('crossmap_comment_sns_id');

$ci=& get_instance();
$ci->load->model('web/m_member');

if($result_code == '0000') {
    echo '0000|||||';
    $row_count = count($arr_comment);
    if($row_count > 0) {
        foreach($arr_comment as $val) {
            $content_type       =  $val['content_type'];
            $comment_reg_date   =  $val['reg_date'];
            $comment_reg_date   =  substr($comment_reg_date, 0, 10);
            $comment_status 	=  $val['comment_status'];
            $comment 	        =  $val['comment'];
            $comment_del_date 	=  $val['del_date'];
            $is_best 	        =  $val['is_best'];
            $c_sns_name 	    =  $val['sns_name'];
            $write_id 	        =  $val['write_id'];

            $comment_txt = $comment;
            if($comment_status!='1') {
                $comment_txt = '<div style="color:#bcbcbc;"><img src="/img/web/icon_info.gif"> '.$comment.'</div><div class="r_date" style="margin-top:5px;color:#bcbcbc;">'.$comment_del_date.'</div>';
            }
            if($is_best=='Y')   $comment_txt = '<label>BEST</label>'.$comment_txt;

            $arr_member = $ci->m_member->member_where_member_id_select($write_id);
            $member_img = '/img/web/img_profile_l.png';
            if(isset($arr_member['member_img'])==true) 	$member_img = $arr_member['member_img'];

            $name_header = '<img src="'.(empty($member_img)? '/files/img/web/img_photo.png': $member_img).'" width="16" height="16">&nbsp;&nbsp;';
            if($c_sns_name !='cm') {
                $name_header = '<img src="/img/web/img_'.$c_sns_name.'_on.gif">&nbsp;&nbsp;';
            }

            //$write_name = $val['write_name'];
			$write_name = !empty($val['member_nickname']) ? $val['member_nickname'] : iconv_substr($val['member_id'], 0, 4, "utf-8") . "***";
            
?>
            <ul class="box_wrap">
                <li class="img_reply"><img src="/img/web/img_reply1.gif"></li>
                <li>
                    <div class="r_info">
                        <span class="beachblue">
                            <?=$name_header?>
                        <?
                            if($comment_sns_id=='') {
                                echo $write_name;
                            } else {
                                if($content_type == '1' || $content_type == '2') {
                        ?>
                                    <a href="javascript:user_comment('<?=$val['write_id']?>', '<?=$val['write_name']?>');" style="color: #2bbec6 !important;"><?=$write_name?></a>

                        <?      } else {
                                    if($comment_sns_id!=$val['write_id']) {
                                        echo $write_name;
                                    } else {
                        ?>
                                        <a href="javascript:user_comment('<?=$val['write_id']?>', '<?=$val['write_name']?>');" style="color: #2bbec6 !important;"><?=$write_name?></a>
                        <?
                                    }
                                }

                            }
                            ?>
                        </span>
                        <span class="r_date"><?=$comment_reg_date?>
                        <? if($comment_status==1) {?>
                            <? if($comment_sns_id!=$val['write_id']){?><span style="color:#e1e2e2;padding-left:10px;"> |</span> <a href="javascript:comment_spam('<?=$val['idx']?>', '<?=$val['write_name']?>')">신고</a><?}?>
                            <? if($comment_sns_id==$val['write_id']){?><span style="color:#e1e2e2;padding-left:10px;"> |</span> <a href="javascript:reply_comment_del('<?=$val['idx']?>','<?=$val['p_idx']?>');">삭제</a> <?}?>
                        <?  }?>
                        </span>
                    </div>
                    <div class="r_base">
                        <span><?=$comment_txt?></span>
                    </div>
                </li>
                <li class="icons2">
                    <span class="thumbup2"><a href="javascript:comment_like_select(1, '<?=$val['idx']?>')"><img src="/img/web/img_thumbup.jpg"></a><span id="comment_like1_<?=$val['idx']?>"><?=number_format($val['like_count'])?></span></span>
                    <span class="thumbdown2"><a href="javascript:comment_like_select(2, '<?=$val['idx']?>')"><img src="/img/web/img_thumbdown.jpg"></a><span id="comment_like2_<?=$val['idx']?>"><?=number_format($val['bad_count'])?></span></span>
                </li>
            </ul>

<?

        }
    }

    echo '|||||'.$total_count.'|||||'.$more_list;

} else {
    echo $result_code.'|||||댓글가져오기를 실패했습니다.';

}
?>