mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-27 07:09:56 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@1280 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
ad2754314c
commit
210ebdbc26
8 changed files with 151 additions and 20 deletions
|
|
@ -284,17 +284,17 @@
|
||||||
$value = preg_replace('/(^\'|\'$){1}/','',$value);
|
$value = preg_replace('/(^\'|\'$){1}/','',$value);
|
||||||
|
|
||||||
switch($operation) {
|
switch($operation) {
|
||||||
case 'like_tail' :
|
case 'like_prefix' :
|
||||||
$value = $value.'%';
|
$value = $value.'%';
|
||||||
break;
|
break;
|
||||||
case 'like_prefix' :
|
case 'like_tail' :
|
||||||
$value = '%'.$value;
|
$value = '%'.$value;
|
||||||
break;
|
break;
|
||||||
case 'like' :
|
case 'like' :
|
||||||
$value = '%'.$value.'%';
|
$value = '%'.$value.'%';
|
||||||
break;
|
break;
|
||||||
case 'in' :
|
case 'in' :
|
||||||
return "'".$value."'";
|
return "'".$value."'";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
**/
|
**/
|
||||||
function isLogged() {
|
function isLogged() {
|
||||||
$args->regdate = date("Ymd");
|
$args->regdate = date("Ymd");
|
||||||
|
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||||
$output = executeQuery('counter.getCounterLog', $args);
|
$output = executeQuery('counter.getCounterLog', $args);
|
||||||
return $output->data->count?true:false;
|
return $output->data->count?true:false;
|
||||||
}
|
}
|
||||||
|
|
@ -34,22 +35,22 @@
|
||||||
/**
|
/**
|
||||||
* @brief 특정 일의 접속 통계를 가져옴
|
* @brief 특정 일의 접속 통계를 가져옴
|
||||||
**/
|
**/
|
||||||
function getStatus($regdate) {
|
function getStatus($selected_date) {
|
||||||
// 여러개의 날자 로그를 가져올 경우
|
// 여러개의 날자 로그를 가져올 경우
|
||||||
if(is_array($regdate)) {
|
if(is_array($selected_date)) {
|
||||||
$date_count = count($regdate);
|
$date_count = count($selected_date);
|
||||||
$args->regdate = implode(',',$regdate);
|
$args->regdate = implode(',',$selected_date);
|
||||||
|
|
||||||
// 단일 날자의 로그를 가져올 경우
|
// 단일 날자의 로그를 가져올 경우
|
||||||
} else {
|
} else {
|
||||||
if(strlen($regdate)==8) $regdate = $regdate;
|
if(strlen($selected_date)==8) $selected_date = $selected_date;
|
||||||
$args->regdate = $regdate;
|
$args->regdate = $selected_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = executeQuery('counter.getCounterStatus', $args);
|
$output = executeQuery('counter.getCounterStatus', $args);
|
||||||
$status = $output->data;
|
$status = $output->data;
|
||||||
|
|
||||||
if(!is_array($regdate)) return $status;
|
if(!is_array($selected_date)) return $status;
|
||||||
|
|
||||||
if(!is_array($status)) $status = array($status);
|
if(!is_array($status)) $status = array($status);
|
||||||
unset($output);
|
unset($output);
|
||||||
|
|
@ -60,5 +61,72 @@
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 지정된 일자의 시간대별 로그 가져오기
|
||||||
|
**/
|
||||||
|
function getHourlyStatus($type='hour', $selected_date) {
|
||||||
|
$max = 0;
|
||||||
|
$sum = 0;
|
||||||
|
switch($type) {
|
||||||
|
case 'year' :
|
||||||
|
// 카운터 시작일 구함
|
||||||
|
$output = executeQuery('counter.getStartLogDate');
|
||||||
|
$start_year = substr($output->data->regdate,0,4);
|
||||||
|
if(!$start_year) $start_year = date("Y");
|
||||||
|
for($i=$start_year;$i<=date("Y");$i++) {
|
||||||
|
unset($args);
|
||||||
|
$args->regdate = sprintf('%04d', $i);
|
||||||
|
$output = executeQuery('counter.getCounterLog', $args);
|
||||||
|
$count = (int)$output->data->count;
|
||||||
|
$status->list[$i] = $count;
|
||||||
|
if($count>$max) $max = $count;
|
||||||
|
$sum += $count;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
break;
|
||||||
|
case 'month' :
|
||||||
|
$year = substr($selected_date, 0, 4);
|
||||||
|
for($i=1;$i<=12;$i++) {
|
||||||
|
unset($args);
|
||||||
|
$args->regdate = sprintf('%04d%02d', $year, $i);
|
||||||
|
$output = executeQuery('counter.getCounterLog', $args);
|
||||||
|
$count = (int)$output->data->count;
|
||||||
|
$status->list[$i] = $count;
|
||||||
|
if($count>$max) $max = $count;
|
||||||
|
$sum += $count;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'day' :
|
||||||
|
$year = substr($selected_date, 0, 4);
|
||||||
|
$month = substr($selected_date, 4, 2);
|
||||||
|
$end_day = date('t', mktime(0,0,0,$month,1,$year));
|
||||||
|
for($i=1;$i<=$end_day;$i++) {
|
||||||
|
unset($args);
|
||||||
|
$args->regdate = sprintf('%04d%02d%02d', $year, $month, $i);
|
||||||
|
$output = executeQuery('counter.getCounterLog', $args);
|
||||||
|
$count = (int)$output->data->count;
|
||||||
|
$status->list[$i] = $count;
|
||||||
|
if($count>$max) $max = $count;
|
||||||
|
$sum += $count;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
for($i=0;$i<24;$i++) {
|
||||||
|
unset($args);
|
||||||
|
$args->regdate = sprintf('%08d%02d', $selected_date, $i);
|
||||||
|
$output = executeQuery('counter.getCounterLog', $args);
|
||||||
|
$count = (int)$output->data->count;
|
||||||
|
$status->list[$i] = $count;
|
||||||
|
if($count>$max) $max = $count;
|
||||||
|
$sum += $count;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$status->max = $max;
|
||||||
|
$status->sum = $sum;
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -27,15 +27,16 @@
|
||||||
// counter model 객체 생성
|
// counter model 객체 생성
|
||||||
$oCounterModel = &getModel('counter');
|
$oCounterModel = &getModel('counter');
|
||||||
|
|
||||||
// 전체 카운터 현황 가져오기
|
// 전체 카운터 및 지정된 일자의 현황 가져오기
|
||||||
$status = $oCounterModel->getStatus(array(0,$selected_date));
|
$status = $oCounterModel->getStatus(array(0,$selected_date));
|
||||||
Context::set('total_counter', $status[0]);
|
Context::set('total_counter', $status[0]);
|
||||||
Context::set('selected_day_counter', $status[$selected_date]);
|
Context::set('selected_day_counter', $status[$selected_date]);
|
||||||
|
|
||||||
|
|
||||||
// 정해진 일자 현황 가져오기
|
|
||||||
|
|
||||||
// 시간, 일, 월, 년도별로 데이터 가져오기
|
// 시간, 일, 월, 년도별로 데이터 가져오기
|
||||||
|
$type = Context::get('type');
|
||||||
|
if(!$type) $type = 'hour';
|
||||||
|
$detail_status = $oCounterModel->getHourlyStatus($type, $selected_date);
|
||||||
|
Context::set('detail_status', $detail_status);
|
||||||
|
|
||||||
// 표시
|
// 표시
|
||||||
$this->setTemplateFile('index');
|
$this->setTemplateFile('index');
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,12 @@
|
||||||
**/
|
**/
|
||||||
|
|
||||||
$lang->cmd_select_date = '날자 선택';
|
$lang->cmd_select_date = '날자 선택';
|
||||||
|
$lang->cmd_select_counter_type = array(
|
||||||
|
'hour' => '시간대별',
|
||||||
|
'day' => '일별',
|
||||||
|
'month' => '월별',
|
||||||
|
'year' => '년도별',
|
||||||
|
);
|
||||||
|
|
||||||
$lang->total_counter = '전체현황';
|
$lang->total_counter = '전체현황';
|
||||||
$lang->selected_day_counter = '선택일 현황';
|
$lang->selected_day_counter = '선택일 현황';
|
||||||
|
|
@ -13,8 +19,4 @@
|
||||||
$lang->unique_visitor = '방문자';
|
$lang->unique_visitor = '방문자';
|
||||||
$lang->pageview = '페이지뷰';
|
$lang->pageview = '페이지뷰';
|
||||||
|
|
||||||
$lang->unit_time = '시간별';
|
|
||||||
$lang->unit_day = '시간별';
|
|
||||||
$lang->unit_month = '시간별';
|
|
||||||
$lang->unit_year = '시간별';
|
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<column name="count(*)" alias="count"/>
|
<column name="count(*)" alias="count"/>
|
||||||
</columns>
|
</columns>
|
||||||
<conditions>
|
<conditions>
|
||||||
<condition operation="equal" column="ipaddress" var="ipaddress" default="ipaddress()" notnull="notnull" />
|
<condition operation="equal" column="ipaddress" var="ipaddress" />
|
||||||
<condition operation="like_tail" column="regdate" var="regdate" notnull="notnull" pipe="and" />
|
<condition operation="like_prefix" column="regdate" var="regdate" notnull="notnull" pipe="and" />
|
||||||
</conditions>
|
</conditions>
|
||||||
</query>
|
</query>
|
||||||
|
|
|
||||||
11
modules/counter/queries/getStartLogDate.xml
Normal file
11
modules/counter/queries/getStartLogDate.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<query id="getStartLogDate" action="select">
|
||||||
|
<tables>
|
||||||
|
<table name="counter_status" />
|
||||||
|
</tables>
|
||||||
|
<columns>
|
||||||
|
<column name="min(regdate)" alias="regdate" />
|
||||||
|
</columns>
|
||||||
|
<conditions>
|
||||||
|
<condition operation="excess" column="regdate" default="1" notnull="notnull" />
|
||||||
|
</conditions>
|
||||||
|
</query>
|
||||||
BIN
modules/counter/tpl/images/blank.gif
Normal file
BIN
modules/counter/tpl/images/blank.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 B |
|
|
@ -26,3 +26,52 @@
|
||||||
<li>{$lang->pageview} : {number_format($selected_day_counter->pageview)}</li>
|
<li>{$lang->pageview} : {number_format($selected_day_counter->pageview)}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 시간대별, 일자별, 월별, 년별 로그 보기 -->
|
||||||
|
<div>
|
||||||
|
<h3>
|
||||||
|
{$lang->unique_visitor}
|
||||||
|
<!--@foreach($lang->cmd_select_counter_type as $key => $val)-->
|
||||||
|
<a href="#" onclick="location.href='{getUrl('type',$key)}';return false;">{$val}</a>
|
||||||
|
<!--@end-->
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- unique visitor 그래프 -->
|
||||||
|
<div>
|
||||||
|
<table border="1" width="100%">
|
||||||
|
<col width="80" />
|
||||||
|
<col width="*" />
|
||||||
|
<!--@foreach($detail_status->list as $key => $val)-->
|
||||||
|
<!--@if($detail_status->sum>0)-->
|
||||||
|
{@$percent = sprintf("%0.2f", $val / $detail_status->sum * 100 )}
|
||||||
|
{@$img_width = sprintf("%0.0f", $val / $detail_status->max * 100 )}
|
||||||
|
<!--@else-->
|
||||||
|
{@$percent = 0}
|
||||||
|
{@$img_width = 1}
|
||||||
|
<!--@end-->
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<!-- 시간대별 -->
|
||||||
|
<!--@if($type == 'year')-->
|
||||||
|
{$key} {$lang->unit_year}
|
||||||
|
<!--@elseif($type == 'month')-->
|
||||||
|
{$key} {$lang->unit_month}
|
||||||
|
<!--@elseif($type == 'day')-->
|
||||||
|
{$key} {$lang->unit_day}
|
||||||
|
<!--@else-->
|
||||||
|
{$key} {$lang->unit_hour}
|
||||||
|
<!--@end-->
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<div style="width:400px;float:left;padding-top:5px;">
|
||||||
|
<img src="./images/blank.gif" height="3" width="{$img_width}%" alt="{$percent}%" style="background-color:blue;border:1px solid darkblue;"/>
|
||||||
|
</div>
|
||||||
|
<div style="float:left;margin-left:20px;">
|
||||||
|
{number_format($val)} ({$percent}%)
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!--@end-->
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue