File: //proc/thread-self/cwd/counselor/question-per-a.php
<?php
include_once('header.php');
$getQuesAdultQuery = "SELECT el.id, el.question_id, el.display_order, el.topic_id, q.question_statement, q.option_1, q.option_2, q.option_3, e.category_name, op.option_1 as op1, op.option_2 as op2, op.option_3 as op3 FROM `wp_psy_sp_exam_question_linkage` as el LEFT JOIN `wp_psy_sp_question` as q ON q.question_id=el.question_id LEFT JOIN `wp_psy_exams` as e ON e.exam_category_id=el.topic_id LEFT JOIN `wp_psy_sp_option_value` as op ON op.question_id=el.question_id where el.exam_type_id='48305' order by el.display_order";
$getQuesAdultData = $wpdb->get_results($getQuesAdultQuery);
if(isset($_REQUEST["editOrder"])){
$qlid = $_POST['qlid'];
$ques_order = $_POST['ques_order'];
if($qlid!='' && $ques_order!=''){
$updateQuery = $wpdb->query("update `wp_psy_sp_exam_question_linkage` set display_order='$ques_order' where id='$qlid'");
echo '<meta http-equiv="refresh" content="0">';
}
}
?>
<style>
.modal-backdrop {
z-index: 999!important;
}
table.dataTable.nowrap th, table.dataTable.nowrap td {
white-space: nowrap !important;
}
.page-title{
float: left;
width: 100%;
}
</style>
<div class="page-inner">
<div class="page-title">
<div class="col-md-4">
<h3>Psychometric Test</h3>
<div class="page-breadcrumb">
<ol class="breadcrumb">
<li><a href="dashboard">Home</a></li>
<li class="active">Personality Test Questions (Adult) </li>
</ol>
</div>
</div>
<div class="col-md-8">
<div class="navbar-right">
<ul class="navul">
<li><a href="question-apt">Aptitude</a></li>
<li><a href="question-per-a" style="color:#000;">Personality (Adult)</a></li>
<li><a href="question-per-t">Personality (Teenagers)</a></li>
<li><a href="question-sa">Self-Assessment</a></li>
<li><a href="question-sotal">SOTAL</a></li>
</ul>
</div>
</div>
</div>
<div id="main-wrapper">
<div class="col-md-12" style="padding:0;">
<div class="panel panel-info">
<div class="panel-heading clearfix">
<h4 class="panel-title">Personality Test Questions (Adult)</h4>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="display " id="userList" style="font-size: 13px;">
<thead>
<tr>
<th>Id</th>
<th>Question Id</th>
<th>Order</th>
<th>Question</th>
<th>Option1</th>
<th>Option2</th>
<th>Option3</th>
<th>Ability</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
foreach($getQuesAdultData as $qdt){
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $qdt->question_id; ?></td>
<td><?php echo $qdt->display_order; ?><span class="glyphicon glyphicon-sort-by-attributes" aria-hidden="true" title="Update display order" style="cursor:pointer;font-size:20px;" data-toggle="modal" data-id="<?php echo $qdt->id; ?>" data-target="#updateQuesOrder"></span></td>
<td><?php echo $qdt->question_statement; ?></td>
<td><?php echo $qdt->option_1; ?> ( <?php echo $qdt->op1; ?> )</td>
<td><?php echo $qdt->option_2; ?> ( <?php echo $qdt->op2; ?> )</td>
<td><?php echo $qdt->option_3; ?> ( <?php echo $qdt->op3; ?> )</td>
<td><?php echo $qdt->category_name; ?></td>
<td><a href="edit-question?quesId=<?php echo $qdt->question_id; ?>" target="_blank"><span class="glyphicon glyphicon-edit" aria-hidden="true" style="cursor:pointer;font-size:20px;"></span></a></td>
</tr>
<?php $i++; } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div><!-- Main Wrapper -->
<!-------------------edit ability modal---------------->
<div class="modal fade" id="updateQuesOrder" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content" style="border: 3px solid #ccc;">
<div class="modal-header" style="padding: 5px 10px 0px 0px; height: 20px;">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
</div>
<div class="modal-body" id="update_ques_order"></div>
</div>
</div>
</div>
<div class="page-footer">
<p class="no-s">shinemetrics.com</p>
</div>
</div><!-- Page Inner -->
<script type="text/javascript" charset="utf-8">
jQuery.noConflict();
jQuery(function($) {
$('#userList').dataTable({
"bPaginate": true,
"iDisplayLength": 200,
"lengthMenu": [[200, 300, 400, 500, 1000 ], [200,300, 400, 500, 1000]]
});
jQuery('#updateQuesOrder').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);
var qlid = button.data('id');
//alert(qlid);
var url = "/counselor/question-per-a-edit.php";
jQuery.ajax({
url: url,
type:'POST',
data: {qlid:qlid},
success:function(data){
document.getElementById("update_ques_order").innerHTML = data;
}
});
});
});
function submitAprForm(){
if(document.getElementById("descr").value==''){
alert("Description can not empty");
document.getElementById("descr").focus();
event.preventDefault();
return false;
}
}
</script>
<link href="assets/css/jquery.dataTables.min.css" rel="stylesheet">
<link href="assets/css/responsive.dataTables.min.css" rel="stylesheet">
<script src="assets/js/jquery.dataTables.min.js"></script>
<script src="assets/js/dataTables.responsive.min.js"></script>
<?php
include_once('footer.php');
?>