File: /var/www/selfanalyse/counselor/aptitude-print.php
<?php
/**
*
* Title : Test Report
* Developer : Rohit Kashyap
* Date : 18 Mar,2020
* Description : User test report and their sten score in print format with highchart.
*/
include_once('../wp-config.php');
global $wpdb;
$PSY_SP_QUESTION = $wpdb->prefix . PSY_SP_QUESTION;
$PSY_EXAMS = $wpdb->prefix . PSY_EXAMS;
$PSY_ABILITY = $wpdb->prefix . PSY_ABILITY;
$PSY_ABILITY_CLASS = $wpdb->prefix . PSY_ABILITY_CLASS;
$PSY_USERS_DETAILS = $wpdb->prefix . PSY_USERS_DETAILS;
$PSY_ABILITY_RAW_SCORE = $wpdb->prefix . PSY_ABILITY_RAW_SCORE;
$PSY_ABILITY_STEN_DESC = $wpdb->prefix . PSY_ABILITY_STEN_DESC;
$PSY_TEST_GEN_TEST_TAKEN = $wpdb->prefix . PSY_TEST_GEN_TEST_TAKEN;
$PSY_TEST_GEN_TEST_TAKEN_QUESTION_ANSWER = $wpdb->prefix . PSY_TEST_GEN_TEST_TAKEN_QUESTION_ANSWER;
$testID = $_REQUEST['testId'];
$user_id = $wpdb->get_var("select user_id from $PSY_TEST_GEN_TEST_TAKEN where test_taken_id='$testID'");
$curDate = date('Y-m-d H:i:s');
if (is_numeric($testID) && strlen($eng_exam_id) <= 5) {
$checkTest = $wpdb->get_var("SELECT count(test_taken_id) FROM $PSY_TEST_GEN_TEST_TAKEN where test_taken_id='$testID' and user_id='$user_id' and test_type='APT' and status='Y'");
if ($checkTest != '0') {
$userData = $wpdb->get_row("SELECT ud.first_name,ud.last_name,ud.date_of_birth,ud.gender_id,ud.email_address,ud.mobile_number FROM $PSY_USERS_DETAILS as ud where user_id='$user_id'");
$studentName = $userData->first_name . ' ' . $userData->last_name;
$dob = date('d F, Y', strtotime($userData->date_of_birth));
$gender = $userData->gender_id;
$email = $userData->email_address;
$mobile = $userData->mobile_number;
$getTestDetails = $wpdb->get_row("SELECT tt.total_questions,tt.class_id,tt.time_taken_in_seconds,tt.start_date,e.category_name,cl.class_name FROM $PSY_TEST_GEN_TEST_TAKEN as tt LEFT JOIN $PSY_EXAMS as e on e.exam_category_id=tt.exam_category_id LEFT JOIN $PSY_ABILITY_CLASS as cl on cl.class_id=tt.class_id where tt.test_taken_id='$testID' and tt.status='Y'");
$class_id = $getTestDetails->class_id != '0' ? $getTestDetails->class_id : '9';
$class = $getTestDetails->class_name;
$dateAttempt = date('d F, Y', strtotime($getTestDetails->start_date));
$seconds = $getTestDetails->time_taken_in_seconds;
$testDate = date('Y-m-d h:i:s', strtotime($getTestDetails->start_date));
$date1 = str_replace('-', '/', $testDate);
$tomorrow = date('Y-m-d H:i:s', strtotime($date1 . '+1 days'));
$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='48282' order by e.exam_category_id");
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<title>Aptitude Test Report - Selfanalyse</title>
<link rel="stylesheet" href="/aptitude-test/css/bootstrap.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css">
<script src="/aptitude-test/js/jquery.min.js"></script>
<script src="/aptitude-test/js/bootstrap.min.js"></script>
<script src="/aptitude-test/js/highcharts.js"></script>
<script src="/aptitude-test/js/highcharts-3d.js"></script>
</head>
<style>
@import url(https://fonts.googleapis.com/css?family=Lato);
body {
font-family: 'Lato', sans-serif;
}
.bold-txt {
font-weight: bold;
color: #000;
}
.col-md-2 {
width: 13.666667% !important;
}
/* MARGIN CSS */
.mt-20 {
margin-top: 20px
}
.mb-20 {
margin-bottom: 20px
}
table {
border-collapse: collapse;
border-spacing: 0;
width: 100%;
border: 1px solid #ddd;
}
th,
td {
text-align: left;
padding: 8px;
}
.header-logo {
width: 40%;
float: right;
}
.chart-header-box {
float: left;
width: 100%;
border-radius: 4px;
background: #fff;
padding: 10px;
border-bottom: 1px solid #cecece;
}
.chart-header-box h4 {
font-size: 16px;
}
.intro-box {
margin: 0;
padding-left: 14px;
background: #fff;
padding: 10px;
float: left;
width: 100%;
}
.intro-box h2 {
margin: 0;
color: #464646;
font-weight: 600;
font-size: 24px;
padding: 0 0 20px;
}
.one-circle-box {
border-radius: 50%;
text-align: center;
padding: 24px 0;
width: 140px;
margin: 0 auto;
}
.one-circle-box i {
font-size: 28px;
}
.chart-box {
border: 1px solid #cccccc;
box-shadow: 0 2px 4px 2px #c7c7c7;
margin: 2em 0;
}
#container {
/* height: 550px; */
}
.highcharts-data-table table {
font-family: Verdana, sans-serif;
border-collapse: collapse;
border: 1px solid #EBEBEB;
margin: 10px auto;
text-align: center;
width: 100%;
max-width: 500px;
}
.highcharts-data-table caption {
padding: 1em 0;
font-size: 1.2em;
color: #555;
}
.highcharts-data-table th {
font-weight: 600;
padding: 0.5em;
}
.highcharts-data-table td,
.highcharts-data-table th,
.highcharts-data-table caption {
padding: 0.5em;
}
.highcharts-data-table thead tr,
.highcharts-data-table tr:nth-child(even) {
background: #f8f8f8;
}
.highcharts-data-table tr:hover {
background: #f1f7ff;
}
svg:not(:root) {
overflow: visible !important;
}
.highcharts-container {
overflow: visible !important;
}
.intro-box h5 {
margin: 0;
color: #fff;
font-size: 18px;
padding: 10px;
text-align: center;
background: #f1802b;
}
.ability-desc-box h2 {
margin: 0;
color: #464646;
font-weight: 600;
font-size: 20px;
padding: 30px 0 10px;
}
.intro-box p {
margin: 0;
font-size: 16px;
}
.ability-desc-box {
border-bottom: 1px solid #434348;
padding-bottom: 20px;
}
.sten-score {
border: 1px solid #b1b1b1;
box-shadow: 0 2px 4px 2px #9a9a9a;
padding: 10px;
margin-top: 1em;
/* background: #90ed7d; */
}
.sten-score h3 {
font-size: 18px;
margin: 0;
padding-bottom: 10px;
}
.description-ul {
padding: 20px;
}
.description-ul li {
list-style: decimal;
color: #000;
margin-bottom: 20px;
font-size: 15px;
}
.test-head {
font-size: 26px !important;
padding-bottom: 10px;
}
.chart-header-box h6 {
margin: 0;
font-size: 17px;
padding: 10px 0 30px;
line-height: 24px;
font-weight: 600;
}
.back-home-btn {
font-size: 14px;
background: #0085f7;
padding: 10px;
display: table;
margin: 0 auto;
color: #fff;
cursor: pointer;
border-radius: 4px;
font-weight: bold;
}
.print-view-box ul {
margin: 8px auto;
}
.print-view-box ul li {
font-size: 15px;
padding: 4px 0;
color: #000;
font-weight: 700;
}
.print-view-box h2 {
padding: 0 0 10px;
font-size: 18px;
color: #333;
}
.print-view-box p {
margin-bottom: 10px;
}
.disc-print {
font-style: italic;
font-size: 14px !important;
color: #000;
font-weight: 700;
}
#btnPrint {
float: right;
margin-bottom: 12px;
background: #154479;
border: none;
color: #fff;
padding: 4px 10px;
font-weight: 600;
border-radius: 4px;
}
.loading_image {
display: block;
position: fixed;
z-index: 1000;
top: 0;
left: 0;
height: 100%;
width: 100%;
background: rgba(255, 255, 255, .8) url('/wp-content/themes/psychometrics/images/loading_image.gif') 50% 50% no-repeat;
}
</style>
<body>
<!-- TOP TABLE SECTION -->
<section style="background: #f1f1f1;padding: 2em 0;" id="main">
<div id="loading"></div>
<div class="container">
<!----User details--->
<div class="row">
<div class="chart-header-box" style="margin-bottom: 2em;">
<div class="col-md-8">
<h4 class="test-head"><?php echo $getTestDetails->category_name; ?></h4>
<h4>Name : <span style="font-weight: bold;"> <?php echo $studentName; ?> </span>, <span> Class :</span> <span style="font-weight: bold;"><?php echo $class ?></span></h4>
<h4>Date : <span style="font-weight: bold;"><?php echo $dateAttempt; ?></span></h4>
</div>
<div class="col-md-4">
<img class="header-logo" src="http://staging.shinemetrics.com/wp-content/themes/psychometrics/images/shine-logo.png" alt="">
</div>
</div>
</div>
<!----First Page Content--->
<div class="row">
<div class="intro-box print-view-box">
<form action="/aptitude-test/pdf.php" method="post">
<input type="hidden" name="test" value="<?php echo $testID; ?>">
<button id="btnPrint" type="submit">Save as PDF</button>
</form>
<div class="col-md-12">
<p>Psychometric tests are designed to assess the cognitive abilities and personality traits of an individual. Knowing one’s own abilities, helps in knowing our own strengths and weaknesses which in turn help us in choosing the career/course most suited for us.</p>
<p>Psychometric tests are of two types:<ul>
<li>Test for abilities or aptitude</li>
<li>Test for personality</li>
</ul>
</p>
<p>The result of psychometric tests tells us a lot about our own selves. It is important specifically when we are at a stage where we have to choose a career, a course or a stream. These results help us to be 100% sure that the course or stream that we are choosing is something that we can do well.</p>
<p>Abilities or aptitude are some innate qualities that we are born with. For example, some people sing very well even without any particular training in music. We would say that their ‘ability’ to sing is high. Now that person can become a professional singer much more easily than a person who does not have that ability. Similarly, all of us have different levels of ability for numbers, for language, for reasoning and logic, for mechanics etc. These different abilities have a scope in different fields of career.</p>
<p>Personality is the combination of characteristics or qualities that form an individual's distinctive character. It also plays a major role in the shaping of our career. For example, a person who is an extrovert, who loves to interact with people will not do well in a job where he has to sit alone all day in a cabin and work. He would do well if he was a part of a team.</p>
<p>Interest also plays a major role in our career. As we all know, we are willing to work hard at a job that we find interesting. We do not want to do anything that we feel is boring.</p>
<p>These tests measure and quantify an individual’s abilities, interest and personality traits to figure out the best options in terms of field of study and career.</p>
</div>
</div>
</div>
<!-----Disclaimer-------->
<div class="row">
<div class="intro-box">
<div class="col-md-12">
<p class="disc-print">Disclaimer: It is to be noted that these test scores do not provide any kind of diagnosis. The cognitive functioning is a result of “Nature and Nurture”. This means how an individual thinks is a result of his innate nature as well as his environment. The scores should be taken in the right perspective. These scores indicate an individual’s ability to perform a particular task right now (at the moment of taking the test). Adding extra skill or training in that area may improve the scores.</p>
</div>
</div>
</div>
</div>
</section>
<script>
jQuery(document).on('click', '#btnPrint', function() {
jQuery("#loading").addClass("loading_image");
});
</script>
<!-- END TOP TABLE SECTION -->
<div style="display: none;">
<?php
$path = '/var/www/selfanalyse/aptitude-test/pdf-html/pdf-' . $testID . '.html';
// if (file_exists($path)) {
echo "";
// } else {
ob_start();
include_once('../aptitude-test/pdf_content.php');
$html = ob_get_contents();
file_put_contents('/var/www/selfanalyse/aptitude-test/pdf-html/pdf-' . $testID . '.html', $html);
ob_flush();
// }
?>
</div>
</body>
</html>
<?php
} else {
echo "Error : No test id found.";
}
} else {
echo "Error : Invalid Test Id.";
}
?>