Server IP : 119.59.102.212 / Your IP : 3.138.121.183 Web Server : Apache/2 System : Linux narin 2.6.32-042stab142.1 #1 SMP Tue Jan 28 23:44:17 MSK 2020 x86_64 User : yangkam ( 1022) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/yangkam/domains/yangkam.go.th/public_html/coremain/module/question/ |
Upload File : |
<?php import_request_variables('pG', 'p_'); $sel_q = "select * from cms_question where id_sub = '$p_id_sub'"; $que_q = mysql_query($sel_q); $obj_q = mysql_fetch_assoc($que_q); $qid = $obj_q['id_question']; $navig['question&id_sub='.$p_id_sub] = $obj_q['topic']; $navig['question_show'] = 'ผลสำรวจ'; navigator($navig); echo"<br>"; bar_header($obj_q['topic']); // Bar_Header fieldset_top($obj_q['topic']); # question_title $array_title = array(); $sel_title = "select * from cms_question_title where question_id = '$qid' and title_parent = '0' order by title_order"; $que_title = mysql_query($sel_title); while($obj = mysql_fetch_assoc($que_title)){ $array_title[$obj['title_order']]['title'] = $obj; # question_choice $choice = array(); $sel_choice = "select * from cms_question_choice where question_id = '$qid' and title_id = '$obj[title_id]' order by choice_order"; $que_choice = mysql_query($sel_choice); while($_choice = mysql_fetch_assoc($que_choice)){ $choice[$_choice['choice_order']] = $_choice; } $array_title[$obj['title_order']]['choice'] = $choice; } # data_title $sel_data = "select * from cms_question_title where question_id = '$qid' and title_parent > '0' order by title_order"; $que_data = mysql_query($sel_data); while($obj = mysql_fetch_assoc($que_data)){ $array_data[$obj['title_parent']][$obj['title_order']] = $obj; } $num_question = count($array_title); $array_header = array(); $sel_header = "select * from cms_question_ansheader where question_id = '$qid'"; $que_header = mysql_query($sel_header); while($obj_header = mysql_fetch_assoc($que_header)){ $array_header[$obj_header['header_id']] = $obj_header; } $array_answer = array(); $sel_answer = "select * from cms_question_answer where question_id = '$qid'"; $que_answer = mysql_query($sel_answer); while($obj_answer = mysql_fetch_assoc($que_answer)){ if($obj_answer['type_id'] == '5'){ $array_answer[$obj_answer['type_id']][$obj_answer['parent_id']][$obj_answer['header_id']] = $obj_answer; }else{ $array_answer[$obj_answer['type_id']][$obj_answer['parent_id']][$obj_answer['title_id']] = $obj_answer; } if($obj_answer['type_id'] == '2'){ $answer = $obj_answer['answer']; if(isset($count_answer[$obj_answer['type_id']][$obj_answer['parent_id']][$obj_answer['title_id']][$answer])){ $count_answer[$obj_answer['type_id']][$obj_answer['parent_id']][$obj_answer['title_id']][$answer] += 1; }else{ $count_answer[$obj_answer['type_id']][$obj_answer['parent_id']][$obj_answer['title_id']][$answer] = 1; } }else if($obj_answer['type_id'] == '3' || $obj_answer['type_id'] == '4'){ $_arr = explode('::', $obj_answer['answer']); $answer = $_arr[0]; if(isset($count_answer[$obj_answer['type_id']][$obj_answer['parent_id']][$obj_answer['title_id']][$answer])){ $count_answer[$obj_answer['type_id']][$obj_answer['parent_id']][$obj_answer['title_id']][$answer] += 1; }else{ $count_answer[$obj_answer['type_id']][$obj_answer['parent_id']][$obj_answer['title_id']][$answer] = 1; } } } $array_color = array(1=>'sky', 2=>'pink', 3=>'green', 4=>'orange', 5=>'teal', 6=>'navy', 7=>'red', 8=>'purple', 9=>'blue', 0=>'yellow'); ?> <table width="97%" border="0" cellpadding="0" cellspacing="0" align="center"> <?php foreach($array_title as $title_order => $title){ $t_id = $title['title']['title_id']; $type = $title['title']['type_id']; ?> <tr> <td> <table width="100%" border="0" cellpadding="3" cellspacing="0" style="border-collapse: collapse;"> <?php if($type == '1'){ ?> <tr bgcolor="#f0e8d0"> <td><?= $title['title']['title_name'] ?></td> </tr> <tr> <td style="text-indent: 20px;">จำนวนผู้ตอบแบบสอบถามทั้งหมด <?= count($array_header) ?> เสียง</td> </tr> <?php }else if($type == '2'){ ?> <tr> <td> <table width="100%" border="0" cellpadding="3" cellspacing="0" style="border-collapse: collapse;"> <tr bgcolor="#f0e8d0"> <td><?= $title['title']['title_name'] ?></td> <?php foreach($title['choice'] as $order_choice => $choice){ ?> <td width="10%" align="center"><?= $choice['choice_name'] ?></td> <?php } ?> </tr> <?php if(isset($array_data[$t_id])){ foreach($array_data[$t_id] as $data_order => $data){ ?> <tr> <td style="text-indent: 20px;"><?= $data_order ?>) <?= $data['title_name'] ?></td> <?php foreach($title['choice'] as $order_choice => $choice){ ?> <td align="center"><?= $count_answer[$type][$t_id][$data['title_id']][$choice['choice_id']] ?></td> <?php } ?> </tr> <?php }} ?> </table> </td> </tr> <?php }else if($type == '3' || $type == '4'){ ?> <tr> <td> <table width="100%" border="0" cellpadding="3" cellspacing="0" style="border-collapse: collapse;"> <tr bgcolor="#f0e8d0"> <td><?= $title['title']['title_name'] ?></td> </tr> <?php if(isset($array_data[$t_id])){ foreach($array_data[$t_id] as $data_order => $data){ $n = $data_order%10; ?> <tr> <td style="text-indent: 20px;">• <?= $data['title_name'] ?></td> </tr> <?php if($count_answer[$type][$t_id][$t_id][$data['title_id']] > 0){ $point = $count_answer[$type][$t_id][$t_id][$data['title_id']]; $point_pc = ($point / array_sum($count_answer[$type][$t_id][$t_id])) * 100; $point_width = $point_pc * 2; ?> <tr> <td style="padding-left: 50px;"> <?php if($point >= 1){ ?> <img src='coremain/module/question/img/<?= $array_color[$n] ?>.gif' width='<?= $point_width ?>' height='10'> <?= $point ?> เสียง <?= number_format($point_pc, 2) ?> <?php }else{ ?> 0 เสียง 0 <?php } ?> % </td> </tr> <?php } ?> <?php }} ?> </table> </td> </tr> <?php }else if($type == '5'){ ?> <tr bgcolor="#f0e8d0"> <td><?= $title['title']['title_name'] ?></td> </tr> <?php if(isset($array_answer[$type][$t_id])){ foreach($array_answer[$type][$t_id] as $text_remark){ ?> <tr> <td style="text-indent: 20px; word-wrap: break-word;">• <?= $text_remark['answer'] ?></td> </tr> <?php }} ?> <?php }else if($type == '6'){ ?> <tr bgcolor="#f0e8d0"> <td><?= $title['title']['title_name'] ?></td> </tr> <?php if(isset($array_data[$t_id])){ foreach($array_data[$t_id] as $data_order => $data){ ?> <tr> <td style="text-indent: 20px;"><?= $data['title_name'] ?></td> </tr> <?php } } ?> <?php } ?> </table> </td> </tr> <?php } ?> </table> <?php if($_SESSION['admin_web']=="admin" || $_SESSION['per']=="ok"){ ?> <center> <table width='100%' border='0' cellpadding='0' cellspacing='1' bgcolor='#eff3f7' style="padding: 15px;"> <tr> <td align="center"> <button type="button" onclick="window.location.href='index.php?mod=question_detail&path=question&id_sub=<?= $_SESSION['id_sub'] ?>&question=<?= $qid ?>'" class="ui-button ui-widget ui-corner-all ui-state-focus" style="padding: 5px 10px;">ผลสำรวจแบบละเอียด</button></td> </tr> </table> </center> <?php } ?>