<%--
  Class Name : EgovConectStats.jsp
  Description : 접근로그 통계화면
  Modification Information
 
      수정일         수정자                   수정내용
    -------    --------    ---------------------------
     2009.03.23    박지욱             최초 생성
     2011.08.31   JJY       경량환경 버전 생성
 
    author   : 공통서비스 개발팀 박지욱
    since    : 2009.03.23 
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Language" content="ko" >
<title>접속통계 조회</title>
<script type="text/javascript" src="<c:url value='/js/EgovCalPopup.js' />"></script>
<script src="<c:url value='/js/jquery.js' />"></script>
<script type="text/javaScript" language="javascript">
$(document).ready(function() {
	fnInitAll();
});

/*********************************************************
 * 조회 처리 
 *********************************************************/
function fnSearch(){
    var fromDate = document.listForm.fromDate.value;
    var toDate = document.listForm.toDate.value;
    if (fromDate == "") {
        alert("기간 시작일자를 입력하세요");
        return;
    } else if (toDate == "") {
        alert("기간 종료일자를 입력하세요");
        return;
    } 
	
    var searchForm =document.searchForm ;
    searchForm.fromDate.value = fromDate ;
    searchForm.toDate.value = toDate ;
    searchForm.searchKeyword.value = document.listForm.searchKeyword.value ;
    searchForm.userAt.value = document.searchForm.userAt.value ;
    searchForm.submit();
    //document.listForm.action = "<c:url value='/sts/cst/selectConectStats.do'/>";
    //document.listForm.submit();
}

function linkPage(pageNo){
	var searchForm =document.searchForm ;
	searchForm.pageIndex.value = pageNo;
    searchForm.fromDate.value = $('#fromDate').val() ;
    searchForm.toDate.value = $('#toDate').val() ;
    searchForm.searchKeyword.value = document.listForm.searchKeyword.value ;
    searchForm.submit();
}


/* ********************************************************
 * 초기화
 ******************************************************** */
function fnInitAll(){
    // 시작일자, 종료일자
    if (document.listForm.fromDate.value == "" && document.listForm.toDate.value == "") {
        var now = new Date();
        var year= now.getFullYear();
        var mon = (now.getMonth()+1)>9 ? ''+(now.getMonth()+1) : '0'+(now.getMonth()+1);
        var day = now.getDate()>9 ? ''+now.getDate() : '0'+now.getDate();
        var toDay = year + mon + day;
        document.listForm.fromDate.value = toDay;
        document.listForm.toDate.value = toDay;
        toDay = year + "-" + mon + "-" + day;
        document.listForm.fDate.value = toDay;
        document.listForm.tDate.value = toDay;
    } else if (document.listForm.fromDate.value != "" && document.listForm.toDate.value != "") {
        var fromDate = document.listForm.fromDate.value;
        var toDate = document.listForm.toDate.value;
        document.listForm.fDate.value = fromDate.substring(0, 4) + "-" + fromDate.substring(4, 6) + "-" + fromDate.substring(6, 8);
        document.listForm.tDate.value = toDate.substring(0, 4) + "-" + toDate.substring(4, 6) + "-" + toDate.substring(6, 8);
    }
    
}

function getNextWeek(v,t){ 
    var str=new Array(); 
    var b=v.split("-");
    var c=new Date(b[0],b[1]-1,b[2]); 
    var d=c.valueOf()+1000*60*60*24*t;
    var e=new Date(d); 
    
    str[str.length]=e.getYear(); 
    str[str.length]=e.getMonth()+1; 
    str[str.length]=e.getDate(); 
    return str.join(""); 
}
</script>
<style>
.board1_div1 input{width: 106px;}
.searchSpanBox {margin-left: 20px;}

/* 막대 그래프 이미지 테이블 넘어가는 오류 수정 */
.ad_mem_list table img{max-width:calc(100% - 100px);}
</style>
</head>
<body>
<noscript class="noScriptTitle">자바스크립트를 지원하지 않는 브라우저에서는 일부 기능을 사용하실 수 없습니다.</noscript>
<form name="listForm" action="<c:url value='/sts/selectConectMenuStats.do'/>" method="post">
	<input type="hidden" name="cal_url" id="cal_url" value="<c:url value='/sym/cmm/EgovNormalCalPopup.do'/>" />
	<input type="hidden" name="fromDate" id="fromDate" value="${statsInfo.fromDate}" size="10"/>
	<input type="hidden" name="toDate" id="toDate" value="${statsInfo.toDate}" size="10"/>
				                    
	<div class="ad_content">
	<div class="ad_con_head">
		<div class="ad_head_text">
			<p class="today_txt">접속통계 리스트</p>
			<div class="ad_head_ment">
				<p class="today_last_txt"><span id="cnt_cate_list"></span></p>
			</div>
		</div>
	</div>
	<div class="ad_subcon">
		<div class="ad_con_body">
			<div class="ad_bo_h3">
				<div class="board1_div1">
					기간 :
					<input type="text" name="fDate" value="" size="10"  title="시작일자(새창)" id="fDate"/>
                    <a href="#noscript" onclick="fn_egov_NormalCalendar(document.listForm, document.listForm.fromDate, document.listForm.fDate,'','<c:url value='/sym/cmm/EgovselectNormalCalendar.do'/>'); return false;" style="selector-dummy:expression(this.hideFocus=false);"><img src="<c:url value='/images/calendar.gif' />" alt="달력(새창)"></a>
                    &nbsp;~&nbsp;<input type="text" name="tDate" value="" size="10"  title="종료일자(새창)" id="tDate" />
                    <a href="#noscript" onclick="fn_egov_NormalCalendar(document.listForm, document.listForm.toDate, document.listForm.tDate,'','<c:url value='/sym/cmm/EgovselectNormalCalendar.do'/>'); return false;" style="selector-dummy:expression(this.hideFocus=false);"><img src="<c:url value='/images/calendar.gif' />" alt="달력(새창)"></a>
				    <span class="searchSpanBox">매뉴검색:</span>
			  		<input title="검색어" id="searchKeyword" name="searchKeyword" type="text" value="<c:out value='${statsVO.searchKeyword}' />" maxlength="35" style="width:200px;margin-left: 8px;">
					<ul class="board1_div2_ul" style="margin-right: -140px;">
						<li><button class="board1_list_btn" onclick="fnSearch(); return false;">검 색</button></li>
					</ul>
				</div>
			</div>
		</div>
		<p class="mem_count">조회건수 : <c:out value="${paginationInfo.totalRecordCount}"/></p>
		<div class="ad_mem_list">
                  <c:if test="${!empty conectStats}">
                  	<div class="">
	                   <!-- 막대그래프 시작 -->
	                   <span style="float:unset;" ></span>
	                       <table width="660" cellpadding="8"  border="0" style="margin-top: 7px;">
	                       <c:forEach items="${conectStats}" var="resultInfo" varStatus="status">
	                       <tr>
	                           <td style="width:150px; line-height: unset;">${resultInfo.menuNm}</td>
	                           <td style="line-height: unset; align:left; position: relative;">
	                              <img src="<c:url value='/images/left_bg.gif'/>" 
	                                  width="<c:out value='${resultInfo.statsCo * statsInfo.maxUnit}'/>" 
	                                  height="10" align="left" alt=""/><span style="top: 60%; right: 10px; position: absolute;">(${resultInfo.statsCo}&nbsp;회)</span>
	                     </td>
	                 </tr>
	                       </c:forEach>
	                 </table>
	             	 <!-- 막대그래프 끝 -->
	            	</div>
			 		<div class="board1_btn">
			    		<ul>
			    			<ui:pagination paginationInfo = "${paginationInfo}"  type="image" jsFunction="linkPage" />
			    		</ul>	
			    	</div>  
		  		</c:if> 
		  		<c:if test="${empty conectStats}">
		  			<div class="">
	                   <table width="660" cellpadding="8"  border="0" style="margin-top: 7px;">
	                       <tr>
	                           <td colspan="2">조회된 결과가 없습니다.</td>
		                 </tr>
	                 </table>
	             	 <!-- 막대그래프 끝 -->
	            	</div>
		  		</c:if>        
		</div>
	</div>
	</div>
</form>
<form name="searchForm" method="get" action="<c:url value='/sts/cst/selectConectMenuStats.do'/>">
	<input name="pageIndex" type="hidden" value="1" />
	<input name="fromDate" type="hidden"  />
	<input name="toDate" type="hidden"  />
	<input name="userAt" type="hidden" value="${statsVO.userAt}" />
	<input name="searchKeyword" type="hidden"  />
</form>	

</body>
</html>