설문기능에서 글출력이 안됩니다. + 설문참가인원 지우는 방법
본문
include_once("_common.php");
$mw_is_view = true;
include_once("$board_skin_path/mw.lib/mw.skin.basic.lib.php");
header("Content-Type: text/html; charset=$g4[charset]");
$gmnow = gmdate("D, d M Y H:i:s") . " GMT";
header("Expires: 0"); // rfc2616 - Section 14.21
header("Last-Modified: " . $gmnow);
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: pre-check=0, post-check=0, max-age=0"); // HTTP/1.1
header("Pragma: no-cache"); // HTTP/1.0
$width = $_GET['width'];
if (!$width) {
if ($board['bo_table_width'] > 100)
$width = @intval($board['bo_table_width']*.5);
else
$width = 200;
}
if ($mw_basic[cf_vote]) {
$vote = sql_fetch("select * from $mw[vote_table] where bo_table = '$bo_table' and wr_id = '$wr_id'");
$vote_list = array();
$max = 0;
$sql = "select * from $mw[vote_item_table] where vt_id = '$vote[vt_id]'";
$qry = sql_query($sql);
for ($i=0; $row=sql_fetch_array($qry); $i++) {
//$row[vt_rate] = @round($row[vt_hit] / $vote[vt_total], 4) * 100;
if ($max < $row['vt_hit'])
$max = $row['vt_hit'];
$row[vt_rate] = @round($row[vt_hit] / $vote[vt_total], 2) * 100;
if ($row[vt_rate])
$row[vt_rate] = "$row[vt_rate]% <span class='count'> (".number_format($row[vt_hit]).") </span>";
else
$row[vt_rate] = "<span class='zero'>0</span>";
$row[vt_width] = @intval($width * ($row[vt_rate] / 100));
$row[vt_item] = cut_str(get_text(strip_tags($row[vt_item])), 50);
$vote_list[$i] = $row;
}
// 출력 비율 변경 (100% -> $max%)
foreach ((array)$vote_list as $i=>$row) {
$vote_list[$i]['vt_width'] = @round($width*$row['vt_hit']/$max);
}
if ($vote[vt_multi]) {
$qry = sql_query("select count(*) as cnt from $mw[vote_log_table] where vt_id = '$vote[vt_id]' group by mb_id");
$vt_total = sql_num_rows($qry);
}
else {
$vt_total = $vote[vt_total];
}
if ($write[mb_id] == $member[mb_id]) { // 자신의 글은 그냥 출력
$is_vote = true;
} else {
$is_vote = false;
if ($vote[vt_sdate] != "0000-00-00 00:00:00" && $g4[time_ymdhis] < $vote[vt_sdate]) {
$is_vote = true;
} else if ($vote[vt_edate] != "0000-00-00 00:00:00" && $g4[time_ymdhis] > $vote[vt_edate]) {
$is_vote = true;
} else {
if ($is_member) $row = sql_fetch("select * from $mw[vote_log_table] where vt_id = '$vote[vt_id]' and mb_id = '$member[mb_id]'");
else $row = sql_fetch("select * from $mw[vote_log_table] where vt_id = '$vote[vt_id]' and vt_ip = '$_SERVER[REMOTE_ADDR]'");
if ($row)
$is_vote = true;
}
}
}
$gr = array();
for ($i=1; $i<=10; $i++) $gr[] = $i;
shuffle($gr);
$img_path = "$g4[url]/skin/board/$board[bo_skin]/img/";
if ($mw_basic[cf_vote] && $vote && sizeof($vote_list)) {
?>
<h3><img src="<?=$img_path?>/vote.png" align="absmiddle"> 설문조사
<span class="info">(<?
if ($vote[vt_sdate] != "0000-00-00 00:00:00") echo substr($vote[vt_sdate], 0, 13)."시 시작, ";
if ($vote[vt_edate] != "0000-00-00 00:00:00") echo substr($vote[vt_edate], 0, 13)."시 종료, ";
if ($vote[vt_multi]) echo $vote[vt_multi]."개까지 복수선택 가능, ";
?>)
<? if ($is_admin) { ?>
[<a href="#;" onclick="window.open('<?=$board_skin_path?>/mw.proc/mw.vote.list.php?bo_table=<?=$bo_table?>&wr_id=<?=$wr_id?>', 'vote_list', 'width=600,height=500,scrollbars=1');">참여목록</a>]
<? } ?>
<? if ($is_admin or ($write[mb_id] && $member[mb_id] && $write[mb_id] == $member[mb_id])) { ?>
[<a href="#;" onclick="mw_vote_init()">초기화</a>]
<? } ?>
</span>
</h3>
<?if (!$is_vote && !$result_view) { ?>
<div class="mw_vote_list">
<? for ($i=0; $i<sizeof($vote_list); $i++) { ?>
<div class="item">
<? if (!$vote[vt_multi]) { ?>
<input type="radio" id="vt_num_<?=$i?>" name="vt_num" value="<?=$i?>">
<? } else { ?>
<input type="checkbox" id="vt_num_<?=$i?>" name="vt_num" value="<?=$i?>">
<? } ?>
<label for="vt_num_<?=$i?>"><?=$vote_list[$i][vt_item]?></label>
</div>
<? } ?>
<div class="btns">
<input type="button" value="설문참여" class="btn" onclick="mw_vote_join()">
<input type="button" value="결과보기" class="btn" onclick="mw_vote_result()">
</div>
</div>
<? } else {
?>
<!-- 구글차트 라이브러리 20191223 yeop-->
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Task', 'vote hit'],
<? for ($i=0, $m=sizeof($vote_list); $i<$m; $i++) { ?>
['<?=htmlspecialchars($vote_list[$i][vt_item], ENT_QUOTES, 'UTF-8')?>', <?=$vote_list[$i][vt_hit]?>],
<? } ?>
]);
var options = {
title: '',
sliceVisibilityThreshold:0
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
</script>
<div id="piechart" style="wix`dth: 800px; height: 400px;"></div>
<div class="mw_vote_list">
<div class="mw_vote_result">
<? for ($i=0, $m=sizeof($vote_list); $i<$m; $i++) { ?>
<div>
<span class="item"><?=$vote_list[$i][vt_item]?> </span>
<span class="graph">
<img src="<?=$img_path?>/vote_<?=$gr[abs($i%9)]?>.gif"
width="<?=$vote_list[$i][vt_width]?>" height="5" align="absmiddle"/>
<span class="rate"> <nobr><?=$vote_list[$i][vt_rate]?></nobr> </span>
</span>
</div>
<? } ?>
</div>
<? if ($result_view) { ?>
<div class="btns">
<input type="button" value="설문참여" class="btn" onclick="mw_vote_load()">
</div>
<? } ?>
</div>
<?
} ?>
<?
}
1. 어디서 오류가 나서 본문글 출력이 안되는걸까요? ㅠㅠ
2. 설문 참가인원 (n)이라고 뜨는 표시를 지울려면 어떻게 해야될까요?? ㅠㅠ
!-->
답변을 작성하시기 전에 로그인 해주세요.