File: /var/www/content-sp/work-sp/questions_not_having_solution.php
<?php
include_once('nqb_master_section.php');
session_start();
$SP_MASTER_CATEGORY = 'csp_sp_master_category';
$SP_MASTER_STRUCTURE = 'csp_sp_master_structure';
$SP_MEDIUM = 'csp_sp_medium';
$SP_QUESTION = 'csp_sp_question';
$SP_QUESTION_MEDIUM_WISE = 'csp_sp_question_medium_wise';
$SP_EDITORS = 'csp_editors';
$SP_QUESTION_STATUS = 'csp_sp_question_status_mode';
$allMaster = $conn->query("SELECT mc.master_id, mc.master_name,mc.source from $SP_MASTER_CATEGORY as mc order by mc.master_id asc");
if (isset($_POST['submit'])) {
unset($_SESSION['masterID']);
unset($_SESSION['subjectID']);
$master = $_REQUEST['master'];
$subject = $_REQUEST['subject'];
$_SESSION['masterID'] = $master;
$_SESSION['subjectID'] = $subject;
}
if (isset($_SESSION['masterID']) && $_SESSION['masterID'] != '' && $_SESSION['subjectID'] != '') {
$mId = $_SESSION['masterID'];
$sidd = $_SESSION['subjectID'];
$getMasterDet = $conn->query("SELECT master_id, master_name,source from $SP_MASTER_CATEGORY where master_id='$mId'");
$getMaster = $getMasterDet->fetch_assoc();
$getTotalMaster = $conn->query("SELECT q.subject_id, ms.category_name, count(q.question_id) as ttlq, count(case when q.question_solution='' then 1 end) AS notSol from $SP_QUESTION as q LEFT JOIN $SP_MASTER_STRUCTURE as ms ON ms.sub_id=q.subject_id where q.master_id='$mId' and q.subject_id='$sidd'");
$ttlCount = $getTotalMaster->fetch_assoc();
$getTotSubWiseQ = "SELECT q.subject_id, q.medium_id, q.topic_id, ms.category_name, count(q.question_id) as stpq, count(case when q.question_solution='' then 1 end) AS notsolP, m.medium_name from $SP_QUESTION as q LEFT JOIN $SP_MEDIUM as m ON m.medium_id=q.medium_id LEFT JOIN $SP_MASTER_STRUCTURE as ms ON ms.sub_id=q.topic_id where q.master_id='$mId' and q.subject_id='$sidd' group by q.topic_id, q.medium_id order by q.topic_id";
$getTotSubWiseD = $conn->query($getTotSubWiseQ);
$getTotSubWiseQS = "SELECT sq.medium_id as sqmmedium, count(sq.question_id) as stsq, count(case when sq.question_solution='' then 1 end) AS notsolS, q.topic_id, ms.category_name, m.medium_name,q.medium_id from $SP_QUESTION_MEDIUM_WISE as sq INNER JOIN $SP_QUESTION as q ON q.question_id=sq.question_id LEFT JOIN $SP_MEDIUM as m ON m.medium_id=sq.medium_id LEFT JOIN $SP_MASTER_STRUCTURE as ms ON ms.sub_id=q.topic_id where q.master_id='$mId' and q.subject_id='$sidd' group by q.topic_id, sq.medium_id order by q.topic_id";
$getTotSubWiseDS = $conn->query($getTotSubWiseQS);
}
?>
<style>
.table {
font-size: 13px;
}
.hrhead {
font-weight: bold;
color: #2196F3;
text-align: center;
}
</style>
<div class="row">
<div class="col-md-12">
<div class="panel panel-white">
<div class="panel-heading clearfix">
<h4 class="panel-title">Select Master
</h4>
</div>
<div class="panel-body">
<form class="form-inline" method="post">
<div class="form-group" style="width: 40%;">
<select name="master" class="form-control" id="master" style="width: 100%;">
<option value="">--Master--</option>
<?php while ($ms = $allMaster->fetch_assoc()) { ?>
<option value="<?php echo $ms['master_id']; ?>" <?php if ($mId == $ms['master_id']) echo "selected"; ?>><?php echo $ms['master_name'] . '-' . $ms['source']; ?></option>
<?php } ?>
</select>
</div>
<div class="form-group" style="width: 40%;">
<select name="subject" class="form-control" id="subject" style="width: 100%;">
<option value="">--Subject--</option>
<?php if (isset($_SESSION['masterID'])) {
$getSubject = $conn->query("SELECT sub_id,category_name from $SP_MASTER_STRUCTURE where master_id='" . $_SESSION['masterID'] . "' and parent_id=0 order by category_name asc");
foreach ($getSubject as $sb) {
?>
<option value="<?php echo $sb['sub_id']; ?>" <?php if (@$_SESSION['subjectID'] == $sb['sub_id']) {
echo "selected";
} ?>><?php echo $sb['category_name']; ?></option>
<?php }
} ?>
</select>
</div>
<input class="btn btn-info" type="submit" value="SELECT Master" name="submit" />
</form>
</div>
</div>
</div>
<?php if (isset($_SESSION['masterID']) && $_SESSION['masterID'] != '' && $_SESSION['subjectID'] != '') { ?>
<div class="col-md-3">
<div class="panel panel-info">
<div class="panel-heading clearfix">
<h4 class="panel-title">Master Details
<i class="fa fa-info-circle" title="Informations"></i>
</h4>
</div>
<table class="table table-hover">
<tr>
<th>Master Id</th>
<td><?php echo $getMaster['master_id']; ?></td>
<th> </th>
</tr>
<tr>
<th>Master Name</th>
<td><?php echo $getMaster['master_name']; ?></td>
<th> </th>
</tr>
<tr>
<th>--</th>
<td>--</td>
<th> </th>
</tr>
<tr>
<th>Subject Id</th>
<td><?php echo $ttlCount['subject_id']; ?></td>
<th> </th>
</tr>
<tr>
<th>Subject Name</th>
<td><?php echo $ttlCount['category_name']; ?></td>
<th> </th>
</tr>
<tr>
<th>Total Questions</th>
<td><?php echo $ttlCount['ttlq']; ?></td>
<th> </th>
</tr>
<tr>
<th>Not Having Solution</th>
<td><?php echo $ttlCount['notSol']; ?></td>
<th> </th>
</tr>
</table>
</div>
</div>
<div class="col-md-5">
<div class="panel panel-info">
<div class="panel-heading clearfix">
<h4 class="panel-title">Topic Wise Details (Primary)
<i class="fa fa-info-circle" title="Informations"></i>
</h4>
</div>
<table class="table table-hover">
<tr>
<th>#N</th>
<th>Topic</th>
<th>Medium</th>
<th>Total</th>
<th>Not Sol</th>
</tr>
<?php
$i = 1;
$j = 0;
$array = array();
while ($spq = $getTotSubWiseD->fetch_assoc()) {
?>
<tr>
<th><?php echo $i; ?></th>
<th><?php echo $spq['category_name']; ?></th>
<th><?php echo $spq['medium_name']; ?></th>
<td><?php echo $spq['stpq']; ?></td>
<td><a href="questions_not_having_solution_view.php?topic=<?php echo $spq['topic_id']; ?>&medium=<?php echo $spq['medium_id']; ?>&tmedium=2&type=noSol&showType=p" target="_blank"><?php echo $spq['notsolP']; ?></a></td>
</tr>
<?php $i++;
} ?>
</table>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-info">
<div class="panel-heading clearfix">
<h4 class="panel-title">Topic Wise Details (Secondary)
<i class="fa fa-info-circle" title="Informations"></i>
</h4>
</div>
<table class="table table-hover">
<tr>
<th>#N</th>
<th>Topic</th>
<th>Medium</th>
<th>Total</th>
<th>Not Sol</th>
</tr>
<?php
$i = 1;
while ($ssq = $getTotSubWiseDS->fetch_assoc()) {
?>
<tr>
<th><?php echo $i; ?></th>
<th><?php echo $ssq['category_name']; ?></th>
<th><?php echo $ssq['medium_name']; ?></th>
<td><?php echo $ssq['stsq']; ?></td>
<td><a href="questions_not_having_solution_view.php?topic=<?php echo $ssq['topic_id']; ?>&medium=<?php echo $ssq['medium_id']; ?>&tmedium=<?php echo $ssq['sqmmedium']; ?>&type=noSol&showType=s" target="_blank"><?php echo $ssq['notsolS']; ?></a></td>
</tr>
<?php $i++;
} ?>
</table>
</div>
</div>
<?php } ?>
</div>
</div><!-- Main Wrapper -->
<script>
jQuery.noConflict();
// jQuery(document).ready(function() {
jQuery('#master').on('change', function() {
var mid = jQuery("#master").val();
var loadUrl = "ajax_call/nqb_master_topics.php?eid=" + mid + "&type=master";
var jqxhr = jQuery.get(loadUrl);
jqxhr.success(function(data) {
jQuery("#subject").html(data);
});
});
// });
</script>
<div class="page-footer">
<p class="no-s">Graposs Connect ©</p>
</div>
</div><!-- Page Inner -->
<?php
include_once('footer.php');
?>