HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-31-18-78 6.17.0-1017-aws #17~24.04.1-Ubuntu SMP Tue May 26 21:09:53 UTC 2026 aarch64
User: ubuntu (1000)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //proc/thread-self/cwd/counselor/personality-test.php
<?php
	include('header.php');
	include('../wp-config.php');

    $PSY_EXAMS = $wpdb->prefix . PSY_EXAMS;
    $PSY_ABILITY = $wpdb->prefix . PSY_ABILITY;
    $PSY_SP_QUESTION = $wpdb->prefix . PSY_SP_QUESTION;
    $PSY_USERS_DETAILS = $wpdb->prefix . PSY_USERS_DETAILS;
    $PSY_ABILITY_RAW_SCORE = $wpdb->prefix . PSY_ABILITY_RAW_SCORE;
    $PSY_TEST_GEN_TEST_TAKEN = $wpdb->prefix . PSY_TEST_GEN_TEST_TAKEN;
    $PSY_INTEREST_TEST_OPTION_MEAN = $wpdb->prefix . PSY_INTEREST_TEST_OPTION_MEAN;
    $PSY_TEST_GEN_TEST_TAKEN_QUESTION_ANSWER = $wpdb->prefix . PSY_TEST_GEN_TEST_TAKEN_QUESTION_ANSWER;

	$getTestQuery = "SELECT t.test_taken_id, t.user_id, t.class_id,t.exam_category_id, t.total_questions, t.answer_selected, t.time_taken_in_seconds, t.start_date, t.test_type, u.first_name, u.mobile_number, u.email_address, e.category_name, u.date_of_birth, u.gender_id,e.parent_id FROM $PSY_TEST_GEN_TEST_TAKEN as t LEFT JOIN $PSY_USERS_DETAILS as u ON u.user_id=t.user_id LEFT JOIN $PSY_EXAMS as e ON e.exam_category_id=t.exam_category_id where t.status='Y' AND t.test_type='PER' order by t.test_taken_id desc";
	$getTestData = $wpdb->get_results($getTestQuery);
?>

<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%;
	}
	.excel{
		float: right;
    	color: #fff;
	}
</style>

<div class="page-inner">
    <div class="page-title">
		<div class="col-md-4">
			<h3>Users MIS</h3>
			<div class="page-breadcrumb">
				<ol class="breadcrumb">
					<li><a href="dashboard">Home</a></li>
					<li class="active">Users</li>
				</ol>
			</div>
		</div>
		<div class="col-md-8">
			<div class="navbar-right">
				<ul class="navul">
					<!--<li><a href="apt-class">Class List</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 List</h4>
                    <a href="student-test-excel.php?type=PER" target="_blank" class="excel">
						<i class="fa fa-file-excel-o" title="Download" style="cursor:pointer;"></i>
					</a>
                </div>
                <div class="panel-body">
                    <div class="table-responsive">
						<table class="display " id="userList" style="font-size: 13px;">
							<thead>
								<tr>
									<th>Id</th>
									<th>Name</th>
									<th>Email</th>
									<th>Mobile</th>
									<th>D O B</th>
									<th>Gender</th>
									<th>Test Date</th>
									<!-- <th>All Ability Score</th> -->
									<th>View</th>
								</tr>
							</thead>
							<tbody>
								<?php 
									$i=1;
									foreach($getTestData as $tst){
										if($tst->test_type == 'APT')
										{
											$link = 'aptitude-test-report';
										}
										else if($tst->test_type == 'PER')
										{
											$link = 'personality-test-report';
										}

										// $getsubject = $wpdb->get_results("SELECT e.category_name,e.exam_category_id from $PSY_EXAMS as e LEFT JOIN $PSY_ABILITY as ab on ab.ref_id=e.exam_category_id where e.parent_id='$tst->exam_category_id' order by e.exam_category_id");

			                            // $rawScore = '';
			                            // foreach ($getsubject as $sub) {
			                            //     $subject = $sub->exam_category_id;
			                            //     $class_id = $tst->class_id;

			                            //     $abilityData = $wpdb->get_row("SELECT ability_id,instruction FROM $PSY_ABILITY where ref_id='$subject'");
			                            //     $ability_id = $abilityData->ability_id;

			                            //     $getTestSummary = $wpdb->get_row("SELECT count(case when ttqt.correct_answer=ttqat.answer then 1 end) as correctQn, count(case when ttqt.correct_answer!=ttqat.answer and ttqat.answer!=0 then 1 end) as inCorrectQn, count(case when ttqat.answer=0 then 1 end) as unAttemptQn from $PSY_TEST_GEN_TEST_TAKEN_QUESTION_ANSWER as ttqat Inner join $PSY_SP_QUESTION as ttqt on ttqt.question_id = ttqat.test_question_id where ttqat.test_taken_id='$tst->test_taken_id' and ttqat.subject_id='$subject'");
	                            		// 	$correctQn = (int) $getTestSummary->correctQn;
	                            		// 	$inCorrectQn = $getTestSummary->inCorrectQn;
	                                	// 	$unAttemptQn = $getTestSummary->unAttemptQn;

			                            //     $rawScore += $wpdb->get_var("SELECT sten_score FROM $PSY_ABILITY_RAW_SCORE where $correctQn BETWEEN raw_score_start and raw_score_end and class_id='$class_id' and ability_id='$ability_id'");
			                            // }
                            	?>
								<tr>
									<td><?php echo $i; ?></td>
									<td><?php echo $tst->first_name; ?></td>
									<td><?php echo $tst->email_address; ?></td>
									<td><?php echo $tst->mobile_number; ?></td>
									<td><?php echo $tst->date_of_birth; ?></td>
									<td><?php echo $tst->gender_id; ?></td>
									<td><?php echo $tst->start_date; ?></td>
									<!-- <td><?php //echo $rawScore; ?></td> -->
									<td> <!-- View -->
										<a href="<?php echo $link; ?>?testId=<?php echo $tst->test_taken_id; ?>" target="_blank">
											<i class="fa fa-eye" title="View Test Report" style="cursor:pointer;"></i>
										</a>
									</td>
								</tr>
								<?php $i++; } ?>
							</tbody>
						</table>
					</div>
				</div>
			</div>
        </div>        
    </div>
    <!-- Main Wrapper -->

	<!-------------------edit ability modal---------------->
	<div class="modal fade" id="editAbilityModal" 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">&times;</span></button>
                </div>
                <div class="modal-body" id="edit_ability_modal"></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": 50,
            "lengthMenu": [[10,20, 50, 100, 500, 1000 ], [10,20, 50, 100, 500, 1000]],
			"order": [[ 1, "desc" ]]
        });

		jQuery('#editAbilityModal').on('show.bs.modal', function (event) {
			var button = $(event.relatedTarget);
			var abid = button.data('id');
			//alert(abid);
			var url = "/counselor/apt-ability-edit.php";
			jQuery.ajax({
				url: url,
				type:'POST',
				data: {abid:abid},
				success:function(data){
					document.getElementById("edit_ability_modal").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'); ?>