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_olympiad_exam_questions_data.php
<?php
include_once('header.php');

// ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);

$SP_MEDIUM = 'csp_sp_medium';
$SP_EXAM_QUESTION_LINKAGE = 'shineoly_2022.wp_shine_sp_exam_question_linkage';
$SP_QUESTION = 'csp_sp_question';
$SP_QUESTION_MEDIUM_WISE = 'csp_sp_question_medium_wise';
$TT_EXAM_CATEGORIES_TABLE = 'shineoly_2022.wp_shine_tt_exam_categories';


$topic = $_REQUEST['t'];

if ($topic != '' && $topic != '0') {
    /**live config */
    include_once '../cron/config.php';
    $topicName = $live->query("SELECT e.exam_category_id, e.category_name from $TT_EXAM_CATEGORIES_TABLE as e where e.exam_category_id='$topic'");
    $tName = $topicName->fetch_assoc();

    $getMediums = $live->query("SELECT medium_id,medium_name FROM $SP_MEDIUM order by medium_id");

    /****delete question */
    // if(isset($_REQUEST['e_ques_del'])) {

    //     $e_ques_id = $_REQUEST['e_ques_id'];

    //     if($e_ques_id !='' && $topic != '') {
    //         $deleteQues = $wpdb->query("DELETE FROM $SP_EXAM_QUESTION_LINKAGE where question_id='$e_ques_id' and topic_id='$topic'");
    //     }
    // }

    //get questions
    $getQuestionIds = $live->query("SELECT question_id FROM $SP_EXAM_QUESTION_LINKAGE where topic_id='$topic' order by question_id");

?>

    <style>
        .table-hover th,
        td {
            font-size: 13px;
        }
    </style>
    <div class="page-inner">
        <div id="main-wrapper">
            <div class="row">
                <div class="col-md-12">
                    <div class="panel panel-info">

                        <div class="panel-heading clearfix">
                            <h4 class="panel-title" style="width: 100%;">Question Structure [ <?php echo $tName['category_name']; ?> ]</h4>
                        </div>
                        <div class="spacer"></div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-md-12">
                                    <table class="table table-hover tableFixHead">
                                        <thead>
                                            <tr>
                                                <th>#</th>
                                                <th>Ques.id</th>
                                                <?php foreach ($getMediums as $m) { ?>
                                                    <th><?php echo $m['medium_name']; ?></th>
                                                <?php } ?>
                                                <!-- <th>Delete.Q</th> -->
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php $i = 1;
                                            foreach ($getQuestionIds as $q) {
                                                $qId = $q['question_id'];
                                            ?>
                                                <tr>
                                                    <th><?php echo $i; ?></th>
                                                    <th title="<?php echo $q['question_id']; ?>"><i class="fa fa-circle-o"></i> <?php echo $q['question_id']; ?></th>
                                                    <?php foreach ($getMediums as $mm) {
                                                        $medium_id = $mm['medium_id'];
                                                        $quesCount = $live->query("SELECT (
                                                        SELECT count(sq.question_id) as c FROM $SP_QUESTION as sq WHERE sq.question_id='$qId' and sq.medium_id='$medium_id')+
                                                    (
                                                    SELECT count(sqm.question_id) as c FROM $SP_QUESTION_MEDIUM_WISE as sqm INNER JOIN $SP_QUESTION as sq on sq.question_id=sqm.question_id WHERE sq.question_id='$qId' and sqm.medium_id='$medium_id'
                                                    ) as total
                                                    ");
                                                        $sh_ques = $quesCount->fetch_assoc();
                                                        $ifQues = $sh_ques['total'];
                                                        if ($ifQues > 0) {
                                                            $showText = '<span class="badge badge-success"> <i class="fa fa-check"></i> Yes</span>';
                                                        } else {
                                                            $showText = '<span class="badge badge-danger"> <i class="fa fa-close"></i> No</span>';
                                                        }
                                                    ?>
                                                        <th><?php echo $showText; ?></th>
                                                    <?php } ?>
                                                    <!-- <th>
                                                        <form method="post" onsubmit="return confirm('Are you sure to delete this question')">
                                                            <input type="hidden" name="e_ques_id" value="<?php echo $q['question_id']; ?>">
                                                            <button type="submit" name="e_ques_del" class="btn btn-info btn-rounded">
                                                                <span class="glyphicon glyphicon-trash"></span>
                                                            </button>
                                                        </form>
                                                    </th> -->
                                                </tr>
                                            <?php $i++;
                                            } ?>
                                        </tbody>

                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php
}
include_once('footer.php');
?>