"err", "caption" => "データベースエラー", "icon" => $erroricon, "body" => "データベースの接続に失敗しました。
指定のデータベース「 $dbname 」を作成しますか?", "buttons" => "戻る|history.back();,閉じる|window.close();" ); } if (count($Samplings) == 1) { $_REQUEST['group'] = "all"; } if ($_REQUEST['cmd'] == "limit_edit" && $_REQUEST['pw'] && ($_REQUEST['pw'] == $root || $_REQUEST['pw'] == $admin)) { $init = file_get_contents($inifile); $init = str_replace("\n", " ", $init); $limit = $_REQUEST['limit']; $init = preg_replace("/(sampling.*\"$_REQUEST[key]\".*$_REQUEST[name]:)($_REQUEST[old])([\"\,\s]+)/", "$1!$limit$3", $init); $init = str_replace(":!", ":", $init); $init = str_replace(" ", "\n", $init); file_put_contents($inifile, $init); header("Location:integra.php?pw=$_REQUEST[pw]&group=$_REQUEST[group]&id=$_REQUEST[id]"); exit; } !$template && $template = $saucefile; $html = ""; $Html = file($template); $cgimode = false; foreach ($Html as $line) { if (preg_match("//", $line, $m)) { $cgimode = false; list($left, $right) = split($m[0], $line); $line = " $right"; } elseif (preg_match("//", $line, $m)) { $cgimode = true; list($left, $right) = split($m[0], $line); $html .= "$left
"; if (isset($Msg['caption'])) { /* * 全てのメッセージの生成と表示 * */ $html .= "
". $Msg['caption']. "
". $Msg['body']. "

"; $Buttons = split(",", $Msg['buttons']); foreach ($Buttons as $val) { list($name, $action) = split("\|", $val); $html .= " "; } $html .= "
"; } elseif ($anslistview && $_REQUEST['cmd'] == "list" && $_REQUEST['pw'] && ($_REQUEST['pw'] == $root || $_REQUEST['pw'] == $admin)) { $pageview = 50; !isset($_REQUEST['start']) && $_REQUEST['start'] = 0; $sql = "SELECT * FROM `$tablename`"; $rs = mysql_query($sql); $max = mysql_num_rows($rs); $sql .= " ORDER BY `Date` DESC LIMIT ". $_REQUEST['start']. ", $pageview"; $rs = mysql_query($sql); $view = mysql_num_rows($rs); $no = $_REQUEST['start'] + 1; $html .= "
"; foreach ($listfields as $line) { list($key, $title, $align) = split(",", $line); $html .= " "; } $text .= ""; while($Data = mysql_fetch_assoc($rs)) { $data = dbfields($Data['Data']); $html .= " "; foreach ($listfields as $line) { list($key, $title, $align) = split(",", $line); $val = $data[$key]; if (preg_match("/^(\d+\/\d+\/\d+) ([\d\:]+)$/", $val, $m)) { $val = $m[1]; } $html .= " "; } $html .= ""; $no++; } $html .= "
No.$title
$no$val
"; if ($max) { if ($_REQUEST[start]) { $firstbutton = ""; $prevbutton = ""; } if ($_REQUEST[start] + $view < $max) { $p = ceil($max / $pageview); $ls = ($p - 1) * $pageview; $nextbutton = "\" onclick=\" this.form.start.value=". ($_REQUEST[start] + $pageview)."; this.form.submit();\" />"; $lastbutton = ""; } $html .=<<<_
$firstbutton $prevbutton $nextbutton $lastbutton
_; } $html .= "
"; } else { if ($anslistview && $_REQUEST['pw'] && ($_REQUEST['pw'] == $root || $_REQUEST['pw'] == $admin)) { $html .= "
回答一覧
"; } if ($_REQUEST['group'] && $totalization) { $text = file_get_contents($saucefile); $limit_edit = 0; if ($_REQUEST['group'] != "all") { $dummy = array_values(preg_grep("/,". $_REQUEST['group']. ",/", $Samples)); list($name, $group, $denomi) = split(",", $dummy[0]); $rs = mysql_query("SELECT * FROM `$tablename` WHERE `Group`='". $_REQUEST['group']. "';"); } else { $name = "すべての回答"; $rs = mysql_query("SELECT * FROM `$tablename`;"); } $Totalizations = split(",", $totalization); if (!isset($_REQUEST['id']) || !$_REQUEST['id']) $_REQUEST['id'] = 0; $totalizate = $Totalizations[$_REQUEST['id']]; preg_match("/\"$totalizate:(.+?)\"/", $text, $m); $question = $m[1]; $lastdate = ""; while($Data = mysql_fetch_assoc($rs)) { $data = dbfields($Data[Data]); $key = $data[$totalizate]; $Count[$key]++; list($d, $t) = split(" ", $data['Date']); if ($obj[$key]['Date'] < $d) { $obj[$key]['Date'] = $d; } $d > $lastdate && $lastdate = $d; $total++; } $Datas = array(); foreach ($Count as $key => $val){ $value = join("\t", array( "name=$key", "cnt=".$Count[$key], "date=".$obj[$key]['Date'] )); $Datas[] = $value; } $html .= "
$name
"; $i = 0; foreach ($Totalizations as $line) { $class = "ui-state-default"; $i == $_REQUEST['id'] && $class = "ui-state-hover"; $html .= " "; $i++; } $html .= "
$line
 $question
"; $denomi_view && $html .= " "; $html .= " "; $lastdateview && $html .= " "; $html .= ""; if ($sampling[$totalizate]) { $denomi_view == 2 && $_REQUEST['pw'] && $limit_edit = 1; $sampling[$totalizate] = preg_replace("/[\r\n\t]/", "", $sampling[$totalizate]); $Samplings = split(",", $sampling[$totalizate]); $m_total = 0; $row = 1; foreach ($Samplings as $smp) { list($que, $m) = split(":", $smp); $m_total += $m; $name = $que; $cnt = "0"; $class = ""; $v = " "; $date = ""; $match = 0; foreach ($Datas as $line) { $data = dbfields($line); if ($data['name'] == $que) { $w = "0px;"; $class = "graph"; $cnt = $data['cnt']; $date = $data['date']; if ($m) { $bar = $cnt / $m * 100; $bar > 100 && ($class = "graph_over"); $w = 1000 - $cnt / $m * 240 - 4; $denomi_point && $v = "". sprintf("%3.2f", $bar). "%"; $denomi_view == 2 && $cnt .= "/$m"; } elseif ($total) { $w = 1000 - $cnt / $total * 240 - 4; $denomi_point && $v = "". sprintf("%3.2f", $cnt / $total * 100). "%"; } $w .= "px"; if (preg_match("/^\d+$/", $name)) { $name = $Legend[$name]; } $match = 1; break; } } if (!$match && $denomi_view == 2) $cnt .= "/$m"; $cnt == '' && $cnt = " "; $limit_edit && $name = "$name"; $html .= " "; $denomi_view && $html .= " "; $html .= " "; $lastdateview && $html .= " "; $html .= ""; $row++; } } else { foreach ($Datas as $line) { $data = dbfields($line); $v = " "; $w = "0px;"; $class = "graph"; $w = 1000 - $data['cnt'] / $total * 240 - 4; $denomi_point && $v = "". sprintf("%3.2f", $data['cnt'] / $total * 100). "%"; $w .= "px"; $name = $data['name']; if (preg_match("/^\d+$/", $name)) { $name = $Legend[$name]; } $html .= " "; $denomi_view && $html .= " "; $html .= " "; $lastdateview && $html .= " "; $html .= ""; } } $w = "0px;"; $v = " "; $class = ""; if ($m_total) { $denomi_view == 2 && $total .= "/$m_total"; $class = "graph"; $bar = $total / $m_total * 100; $bar > 100 && ($class = "graph_over"); $w = 1000 - $total / $m_total * 240 - 4; $denomi_point && $v = "". sprintf("%3.2f", $bar). "%"; $w .= "px"; } $total == "" && $total = " "; if ($denomi_view) { $html .= " "; $denomi_view && $html .= " "; $html .= " "; $lastdateview && $html .= " "; $html .= ""; } $html .= "
摘要CntPointDate
 $name$cnt$v $date
 $name". $data['cnt']. " $v ". $data['date']. "
Total$total$v $d
"; if ($limit_edit && ($_REQUEST['pw'] == $root || $_REQUEST['pw'] == $admin)) { $html .=<<<_
※[$question]をクリックして、対象人数(分母)を変更できます。
_; } } else { $Data = mysql_fetch_assoc(mysql_query( "SELECT COUNT(*) as 'Cnt' FROM `$tablename`;" )); $total = $Data['Cnt']; $html .= " "; $denomi_view && $html .= " "; $html .= " "; $lastdateview && $html .= " "; $html .= ""; $denomitotal = 0; foreach ($Samples as $line) { list($name, $group, $denomi) = split(",", $line); $Data = mysql_fetch_assoc(mysql_query( "SELECT COUNT(*) as 'Cnt', DATE_FORMAT(MAX(`Date`), '%Y/%m/%d') as 'Lastdate' FROM `$tablename` WHERE `Group`='$group';" )); $cnt = $Data['Cnt']; $w = "0px;"; $v = " "; $class = "graph"; if ($denomi) { $denomi_view == 2 && $cnt .= "/$denomi"; $denomitotal += $denomi; if ($Data['Cnt']) { $bar = $Data['Cnt'] / $denomi * 100; $bar > 100 && ($class = "graph_over"); $w = 1000 - $Data['Cnt'] / $denomi * 240 - 4; $denomi_point && $v = "". sprintf("%3.2f", $bar). "%"; $w .= "px"; } else { $class = ""; } } elseif ($total) { if ($Data['Cnt']) { $w = 1000 - $Data['Cnt'] / $total * 240 - 4; $denomi_point && $v = "". sprintf("%3.2f", $Data['Cnt'] / $total * 100). "%"; $w .= "px"; } else { $class = ""; } } $html .= " "; $denomi_view && $html .= " "; $html .= " "; $lastdateview && $html .= " "; $html .= ""; } $v = " "; if ($denomitotal) { $denomi_view == 2 && $total .= "/$denomitotal"; $class = "graph"; $bar = $total / $denomitotal * 100; $bar > 100 && ($class = "graph_over"); $w = 1000 - $total / $denomitotal * 240 - 4; $denomi_point && $v = "". sprintf("%3.2f", $bar). "%"; $w .= "px"; } $html .= " "; $denomi_view && $html .= " "; $html .= " "; $lastdateview && $html .= " "; $html .= "
GroupCntPointDate
 $name$cnt $v ". $Data['Lastdate']. "
Total$total $v $d
"; } } } if (!$cgimode) $html .= $line; } header("Content-type:text/html; charset=utf-8;"); echo $html; exit; ?>