enquete_moto.php 3.38 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/administrator/templates/isis/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
<title>鹿屋体育大学</title>
<style type="text/css">
body {
	margin: 0;
}
#contents {
	padding: 0 15px;
}
h1 {
	background: #1a3867;
	color: #fff;
	font-weight: normal;
	padding: 10px 30px;
	margin: 0 0 50px;
	font-size: 1.8em;
}
h2 {
	color: #1a3867;
	font-weight: normal;
	border-bottom: 1px solid #1a3867;
	margin: 0 0 15px;
}
table {
	width: 100%;
	border-right: 1px solid #ccc;
	border-bottom: 1px solid #ccc;
	margin-bottom: 50px;
}
table th,
table td {
	padding: 10px;
	border-left: 1px solid #ccc;
	border-top: 1px solid #ccc;
}
table th {
	background: #1a3867;
	color: #fff;
	font-weight: normal;
}
table td {
	text-align: center;
	width: 25%;
}
</style>
</head>

<body>


<?php

$html_hyo = "";
$q1_ask = array("","良いね!","もう少し!");
$q2_ask = array("","見つけやすかった","見つけにくかった");
$q1_count_g = $q1_count_b = 0;
$q2_count_g = $q2_count_b = 0;
$total_count = 0;

//東京サテライトキャンパスのヘッダー表示

$db = new mysqli($app->get('db_hostname'),$app->get('user'),$app->get('password'),"ad1216tnc7_kanoya",$app->get('db_port'));
$db->set_charset('utf8');

$sql = 'SELECT * FROM d_feedback WHERE id > 9 ORDER BY id DESC';
$row = $db->query($sql);
//mysqli_query($db, $sql);
while( $data = $row->fetch_object()){
	$q1_ans = $data->q1;
	$q2_ans = $data->q2;
	$page_id = $data-> page_id;


if($total_count < 100){
	
	$html_hyo .= '<tr><td>';

	if($page_id){
		$sql_p = 'SELECT * FROM v4vfh_menu WHERE id = '.$page_id.' LIMIT 1';
		$row_p = $db->query($sql_p);
		$data_p = $row_p->fetch_object();
		$html_hyo .= $data_p->title;
	}

	$html_hyo .= '</td><td>'.$q1_ask[$q1_ans].'</td><td>'.$q2_ask[$q2_ans].'</td><td>'.$data->input_date.'</td>';
	$total_count ++;
	if($q1_ans == 1) { $q1_count_g++; }elseif($q1_ans == 2) { $q1_count_b++; }
	if($q2_ans == 1) { $q2_count_g++; }elseif($q2_ans == 2) { $q2_count_b++; }
	
	$html_hyo .= '</tr>';
}
	
}

$db->close();

$q1_good_par = round($q1_count_g / $total_count * 100, 0);
$q1_bad_par = round($q1_count_b / $total_count * 100, 0);
$q2_good_par = round($q2_count_g / $total_count * 100, 0);
$q2_bad_par = round($q2_count_b / $total_count * 100, 0);

?>

<h1>フィードバック集計</h1>

<div id="contents">
<h2>割合</h2>
<table cellspacing="0" cellpadding="0" class="table1">
<tr>
	<th colspan="2">情報について</th>
  <th colspan="2">情報の見つけやすさ</th></tr>
<tr>
	<th>良いね!</th><th>もう少し!</th>
  <th>見つけやすかった</th><th>見つけにくかった</th></tr>
<tr>
	<td><?php echo $q1_count_g; ?><?php echo $q1_good_par; ?> %)</td>
  <td><?php echo $q1_count_b; ?><?php echo $q1_bad_par; ?> %)</td>
  <td><?php echo $q2_count_g; ?><?php echo $q2_good_par; ?> %)</td>
  <td><?php echo $q2_count_b; ?><?php echo $q2_bad_par; ?> %)</td>
</tr>
</table>

<h2>アンケート一覧</h2>
<table cellspacing="0" cellpadding="0" class="table2">
<tr><th>ページ</th><th>ページの情報について</th><th>情報の見つけやすさ</th><th>登録日</th></tr>
<?php echo $html_hyo; ?>
</table>
</div>

</body>
</html>