관리자 글현황 추가 및 기타 오류 수정

This commit is contained in:
chicpro
2015-08-28 11:42:25 +09:00
parent 82c12f6d98
commit 84009dc16c
84 changed files with 29584 additions and 16 deletions

View File

@ -8,5 +8,6 @@ $menu['menu300'] = array (
array('300500', '1:1문의설정', ''.G5_ADMIN_URL.'/qa_config.php', 'qa'),
array('300600', '내용관리', G5_ADMIN_URL.'/contentlist.php', 'scf_contents', 1),
array('300700', 'FAQ관리', G5_ADMIN_URL.'/faqmasterlist.php', 'scf_faq', 1),
array('300820', '글,댓글 현황', G5_ADMIN_URL.'/write_count.php', 'scf_write_count'),
);
?>

View File

@ -209,7 +209,7 @@ $frm_submit = '<div class="btn_confirm01 btn_confirm">
if (!$config['cf_icode_server_ip']) $config['cf_icode_server_ip'] = '211.172.232.124';
if (!$config['cf_icode_server_port']) $config['cf_icode_server_port'] = '7295';
if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
if ($config['cf_sms_use'] && $config['cf_icode_id'] && $config['cf_icode_pw']) {
$userinfo = get_icode_userinfo($config['cf_icode_id'], $config['cf_icode_pw']);
}
?>

View File

@ -747,4 +747,15 @@ strong.sodr_nonpay {display:block;padding:5px 0;text-align:right}
#theme_detail table{border-collapse:collapse;margin:5px 0 10px}
#theme_detail table th{padding: 5px 0; border: 1px solid #d1dee2; background: #e5ecef;width:50px;padding:10px;text-align:left}
#theme_detail table td{ border: 1px solid #ececec;padding:10px}
.no_theme{text-align:center;padding:100px 0;color:#555}
.no_theme{text-align:center;padding:100px 0;color:#555}
/*글,댓글현황*/
#wr_cont{position:relative;margin:10px 20px}
#wr_cont input[type="submit"]{background:#ff3061;border:none;color:#fff;padding: 0 5px;height: 24px;}
#wr_cont select{height: 24px;}
#grp_color{border:2px solid #ddd;position:absolute;top:0;right:0;list-style:none;padding: 5px 5px; margin:0;}
#grp_color li{padding:5px 10px;}
#grp_color li span{width:10px;height:10px; display:inline-block;background:rgb(75, 178, 197);margin-right:5px;}
#grp_color li.color2 span{background:rgb(234, 162, 40);}
#chart_wr h5{text-align:center;border:1px solid #eee;padding:30px 0}
#chart_wr{margin:20px }

View File

@ -9,7 +9,7 @@ $g5['title'] = "SMS 기본설정";
if (!$config['cf_icode_server_ip']) $config['cf_icode_server_ip'] = '211.172.232.124';
if (!$config['cf_icode_server_port']) $config['cf_icode_server_port'] = '7295';
if ($config['cf_icode_id'] && $config['cf_icode_pw'])
if ($config['cf_sms_use'] && $config['cf_icode_id'] && $config['cf_icode_pw'])
{
$userinfo = get_icode_userinfo($config['cf_icode_id'], $config['cf_icode_pw']);
}

210
adm/write_count.php Normal file
View File

@ -0,0 +1,210 @@
<?php
$sub_menu = '300820';
include_once('./_common.php');
check_demo();
auth_check($auth[$sub_menu], 'r');
// http://www.jqplot.com/
add_stylesheet('<link rel="stylesheet" href="'.G5_PLUGIN_URL.'/jqplot/jquery.jqplot.css">', 0);
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/jquery.jqplot.js"></script>', 0);
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/plugins/jqplot.canvasTextRenderer.min.js"></script>', 0);
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/plugins/jqplot.categoryAxisRenderer.min.js"></script>', 0);
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/plugins/jqplot.pointLabels.min.js"></script>', 0);
add_javascript('<!--[if lt IE 9]><script src="'.G5_PLUGIN_URL.'/jqplot/excanvas.js"></script><![endif]-->', 0);
if (!($graph == 'line' || $graph == 'bar'))
$graph = 'line';
if ($graph == 'bar') {
// 바 타입으로 사용하는 코드입니다.
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/jqplot.barRenderer.min.js"></script>', 0);
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/jqplot.categoryAxisRenderer.min.js"></script>', 0);
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/jqplot.pointLabels.min.js"></script>', 0);
}
$g5['title'] = '글,댓글 현황';
include_once ('./admin.head.php');
$period_array = array(
'오늘'=>array('시간', 0),
'어제'=>array('시간', 0),
'7일전'=>array('일', 7),
'14일전'=>array('일', 14),
'30일전'=>array('일', 30),
'3개월전'=>array('주', 90),
'6개월전'=>array('주', 180),
'1년전'=>array('월', 365),
'2년전'=>array('월', 365*2),
'3년전'=>array('월', 365*3),
'5년전'=>array('년', 365*5),
'10년전'=>array('년', 365*10),
);
$is_period = false;
foreach($period_array as $key=>$value) {
if ($key == $period) {
$is_period = true;
break;
}
}
if (!$is_period)
$period = '오늘';
$day = $period_array[$period][0];
$today = date('Y-m-d', G5_SERVER_TIME);
$yesterday = date('Y-m-d', G5_SERVER_TIME - 86400);
if ($period == '오늘') {
$from = $today;
$to = $from;
} else if ($period == '어제') {
$from = $yesterday;
$to = $from;
} else if ($period == '내일') {
$from = date('Y-m-d', G5_SERVER_TIME + (86400 * 2));
$to = $from;
} else {
$from = date('Y-m-d', G5_SERVER_TIME - (86400 * $period_array[$period][1]));
$to = $yesterday;
}
$sql_bo_table = '';
if ($bo_table)
$sql_bo_table = "and bo_table = '$bo_table'";
switch ($day) {
case '시간' :
$sql = " select substr(bn_datetime,6,8) as hours, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by hours order by bn_datetime ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
// 월-일 시간
$line1[] = "['".substr($row['hours'],0,8)."',".$row['wcount'].']';
$line2[] = "['".substr($row['hours'],0,8)."',".$row['ccount'].']';
}
break;
case '일' :
$sql = " select substr(bn_datetime,1,10) as days, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by days order by bn_datetime ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
// 월-일
$line1[] = "['".substr($row['days'],5,5)."',".$row['wcount'].']';
$line2[] = "['".substr($row['days'],5,5)."',".$row['ccount'].']';
}
break;
case '주' :
$sql = " select concat(substr(bn_datetime,1,4), '-', weekofyear(bn_datetime)) as weeks, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by weeks order by bn_datetime ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
// 올해의 몇주로 보여주면 바로 확인이 안되므로 주를 날짜로 바꾼다.
// 년-월-일
list($lyear, $lweek) = explode('-', $row['weeks']);
$date = date('y-m-d', strtotime($lyear.'W'.str_pad($lweek, 2, '0', STR_PAD_LEFT)));
$line1[] = "['".$date."',".$row['wcount'].']';
$line2[] = "['".$date."',".$row['ccount'].']';
}
break;
case '월' :
$sql = " select substr(bn_datetime,1,7) as months, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by months order by bn_datetime ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
// 년-월
$line1[] = "['".substr($row['months'],2,5)."',".$row['wcount'].']';
$line2[] = "['".substr($row['months'],2,5)."',".$row['ccount'].']';
}
break;
case '년' :
$sql = " select substr(bn_datetime,1,4) as years, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by years order by bn_datetime ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
// 년(4자리)
$line1[] = "['".substr($row['years'],0,4)."',".$row['wcount'].']';
$line2[] = "['".substr($row['years'],0,4)."',".$row['ccount'].']';
}
break;
}
?>
<div id="wr_cont">
<form>
<select name="bo_table">
<option value="">전체게시판</a>
<?php
$sql = " select bo_table, bo_subject from {$g5['board_table']} order by bo_count_write desc ";
$result = sql_query($sql);
for($i=0; $row=sql_fetch_array($result); $i++) {
echo "<option value=\"{$row['bo_table']}\"";
if ($bo_table == $row['bo_table'])
echo ' selected="selected"';
echo ">{$row['bo_subject']}</option>\n";
}
?>
</select>
<select name="period">
<?php
foreach($period_array as $key=>$value) {
echo "<option value=\"{$key}\"";
if ($key == $period)
echo " selected=\"selected\"";
echo ">{$key}</option>\n";
}
?>
</select>
<select name="graph">
<option value="line" <?php echo ($graph == 'line' ? 'selected="selected"' : ''); ?>>선그래프</option>
<option value="bar" <?php echo ($graph == 'bar' ? 'selected="selected"' : ''); ?>>막대그래프</option>
</select>
<input type="submit" class="btn_submit" value="확인">
</form>
<ul id="grp_color">
<li><span></span>글 수</li>
<li class="color2"><span></span>댓글 수</li>
</ul>
</div>
<br>
<div id="chart_wr">
<?php
if (empty($line1) || empty($line2)) {
echo "<h5>그래프를 만들 데이터가 없습니다.</h5>\n";
} else {
?>
<div id="chart1" style="height:500px; width:100%;"></div>
<div>
<script>
$(document).ready(function(){
var line1 = [<?php echo implode($line1, ','); ?>];
var line2 = [<?php echo implode($line2, ','); ?>];
var plot1 = $.jqplot ('chart1', [line1, line2], {
seriesDefaults: {
<?php if ($graph == 'bar') { ?>
renderer:$.jqplot.BarRenderer,
<?php } ?>
pointLabels: { show: true }
},
axes:{
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
label: '<?php echo $day; ?>',
pad:0,
max:23
},
yaxis: {
label: '글수',
min: 0
}
}
});
});
</script>
<?php
}
?>
<?
include_once ('./admin.tail.php');
?>