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: /var/www/content-sp/work-sp/nqb_question_status_popup.php
<?php
// ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);
include_once('header.php');

$SP_MEDIUM = 'csp_sp_medium';
$SP_MASTER_CATEGORY = 'csp_sp_master_category';
$SP_MASTER_STRUCTURE = 'csp_sp_master_structure';
$SP_QUESTION = 'csp_sp_question';
$SP_QUESTION_MEDIUM_WISE = 'csp_sp_question_medium_wise';

$tpcId = $_REQUEST['tpcId'];
$m = $_REQUEST['m'];
$mType = $_REQUEST['mType'];

$getMediums = $conn->query("SELECT medium_id, medium_name from $SP_MEDIUM order by medium_id");
$getMediums1 = $conn->query("SELECT medium_id, medium_name from $SP_MEDIUM order by medium_id");

$getTpcName = $conn->query("SELECT category_name from $SP_MASTER_STRUCTURE where sub_id='$tpcId'");
$getTpcres = $getTpcName->fetch_assoc();
$topicName = $getTpcres['category_name'];

$getPrimaryQuery = "SELECT m.medium_name, q.medium_id, q.`level_name`, count(q.question_id) as qcnt, count(case when q.status='4' then 1 end) as prfqcnt from $SP_QUESTION as q LEFT JOIN $SP_MEDIUM as m On m.medium_id=q.medium_id where (q.subject_id='$tpcId' or q.topic_id='$tpcId' or q.sub_topic_id='$tpcId') and q.medium_id='$m' group by q.medium_id,q.level_name ";
$getPrimaryData = $conn->query($getPrimaryQuery);

?>
<div class="page-inner">
    <div class="page-title">
        <h3>New Question Bank</h3>
        <div class="page-breadcrumb">
            <ol class="breadcrumb">
                <li><a href="dashboard">Home</a></li>
                <li class="active">Add Questions</li>
            </ol>
        </div>
    </div>
    <div id="main-wrapper">
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-white">
                    <div class="panel-heading clearfix">
                        <h4 class="panel-title" style="width:100%;">Question Status -> <?php echo $topicName; ?></h4>
                    </div>
                    <font style="font-size: 12px; color: #0050ef;">[ <i class="fa fa-arrows-h"></i> ] Indicates no of proof read questions</font>
                    <div class="panel-body">
                        <div class="form-group">
                            <h4 class="panel-title" style="width:100%;">All Question Data</h4>
                        </div>
                        <div class="form-group">
                            <table class="table table-hover">
                                <tr>
                                    <th>#</th>
                                    <th>Medium</th>
                                    <th>Level</th>
                                    <th>Count</th>
                                    <?php while ($md = $getMediums->fetch_assoc()) {
                                    ?>
                                        <th><?php echo $md['medium_name']; ?></th>
                                    <?php }
                                    ?>
                                </tr>
                                <?php
                                $i = 1;
                                $totalP = 0;
                                $totalPprf = 0;
                                $level = 0;
                                while ($gpd = $getPrimaryData->fetch_assoc()) {
                                    $totalP = $totalP + $gpd['qcnt'];
                                    $totalPprf = $totalPprf + $gpd['prfqcnt'];
                                    $level = $gpd['level_name'];

                                ?>
                                    <tr>
                                        <td><?php echo $i; ?></td>
                                        <td><?php echo $gpd['medium_name']; ?></td>
                                        <td>
                                            <a href="nqb_questions_view.php?topic_id=<?php echo $tpcId; ?>&smedium=<?php echo $gpd['medium_id']; ?>&tmedium=2&mType=<?php echo $mType; ?>" target="_blank">
                                                <?php echo $gpd['level_name']; ?>
                                            </a>
                                        </td>
                                        <td>
                                            <a href="nqb_questions_view.php?topic_id=<?php echo $tpcId; ?>&level=<?php echo $gpd['level_name']; ?>&smedium=<?php echo $gpd['medium_id']; ?>&tmedium=2&mType=<?php echo $mType; ?>" target="_blank">
                                                <?php echo $gpd['qcnt']; ?> <i class="fa fa-arrows-h"></i> <?php echo $gpd['prfqcnt']; ?>
                                            </a>
                                        </td>
                                        <?php
                                        foreach ($getMediums1 as $md_s) {
                                            //while ($md_s = $getMediums1->fetch_assoc()) {
                                            $secmedium = $md_s['medium_id'];

                                            $getSecCount = $conn->query("SELECT count(qm.question_id) as secCnt, count(case when qm.status='4' then 1 end) as prfsecCnt from $SP_QUESTION_MEDIUM_WISE as qm LEFT JOIN $SP_QUESTION as sq ON sq.question_id=qm.question_id where sq.level_name='$level' and qm.medium_id='$secmedium' and (sq.subject_id='$tpcId' or sq.topic_id='$tpcId' or sq.sub_topic_id='$tpcId') ");
                                            $fm = $getSecCount->fetch_assoc();
                                        ?>

                                            <td>
                                                <a href="nqb_questions_view.php?topic_id=<?php echo $tpcId; ?>&level=<?php echo $level; ?>&smedium=<?php echo $gpd['medium_id']; ?>&tmedium=<?php echo $md_s['medium_id']; ?>&mType=<?php echo $mType; ?>" target="_blank">
                                                    <?php
                                                    if ($gpd['medium_id'] != 2 && ($gpd['medium_id'] != $md_s['medium_id'])) {
                                                        echo $fm['secCnt'];
                                                        echo ' <i class="fa fa-arrows-h"></i> ';
                                                        echo $fm['prfsecCnt'];
                                                    } else if ($gpd['medium_id'] == 2 && $md_s['medium_id'] == 1) {
                                                        echo $fm['secCnt'];
                                                        echo ' <i class="fa fa-arrows-h"></i> ';
                                                        echo $fm['prfsecCnt'];
                                                    } else {
                                                        echo '0';
                                                    } ?></a>
                                            </td>
                                        <?php } ?>
                                    </tr>
                                <?php $i++;
                                } ?>
                                <tr>
                                    <th colspan="3">Total</th>
                                    <th colspan="2"><?php echo $totalP; ?> <i class="fa fa-arrows-h"></i> <?php echo $totalPprf; ?> </th>
                                </tr>
                            </table>
                        </div>
                    </div>

                </div>
            </div>
        </div>
        <div class="page-footer">
            <p class="no-s">Graposs Connect &#169;</p>
        </div>
    </div>
</div>

<?php
include_once('footer.php');
?>