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/wiris_editor.php
<?php
include_once('nqb_proofread_section.php');
error_reporting(0);
error_reporting(E_ALL);
ini_set('display_errors', 'On');

//check edit permissions
$fileName = 'nqb_proofread_exam_wise_oly';
if (in_array($fileName, $pageArray)) {

    $adminId = $editor_id;
    $curDate = date('Y-m-d H:i:s');

    $TT_EXAM_CATEGORIES_TABLE = 'cscolydb.wp_aat93akkcv_tt_exam_categories';
    $SP_MEDIUM = 'contentserver_202130.csp_sp_medium';
    $SP_EDITORS = 'contentserver_202130.csp_editors';
    $SP_MASTER_PROOF_READ_ACCESS = 'contentserver_202130.csp_proofread_access';
    $SP_QUESTION_MEDIUM_WISE = 'contentserver_202130.csp_sp_question_medium_wise';

    $pagination_link = $_SERVER['REQUEST_URI'];
    /**live query */
    include_once '../cron/config.php';
    $limit = 20;
    $pageNo = isset($_GET['pageN']) ? $_GET['pageN'] : 1;
    $indexN = ($pageNo - 1) * $limit;
    $countQuery = $live->query("SELECT count(ac.id) as total from $SP_MASTER_PROOF_READ_ACCESS as ac LEFT JOIN $TT_EXAM_CATEGORIES_TABLE as mc ON mc.exam_category_id=ac.master_id LEFT JOIN $TT_EXAM_CATEGORIES_TABLE as s ON s.exam_category_id=ac.subject_id LEFT JOIN $TT_EXAM_CATEGORIES_TABLE as t ON t.exam_category_id=ac.topic_id LEFT JOIN $SP_EDITORS as ta ON ta.editor_id=ac.assign_to LEFT JOIN $SP_EDITORS as tb ON tb.editor_id=ac.assign_by LEFT JOIN $SP_MEDIUM as md ON md.medium_id=ac.medium_id LEFT JOIN $SP_MEDIUM as tmd ON tmd.medium_id=ac.target_medium where ac.status IN('0','1') and ac.assign_type='exam' order by ac.id desc");
    $cQuery = $countQuery->fetch_assoc();
    $count = $cQuery['total'];
    $noOfPages = ceil($count / $limit);

    
    $getWorkQuery = "SELECT ac.id,ac.master_id, mc.category_name, ac.subject_id, ac.topic_id, s.category_name as subject, t.category_name as topic, ta.contact_name as tto, tb.contact_name as tby, ac.assign_date, ac.status, ac.medium_id,md.medium_name as source_med,tmd.medium_name as tar_med,ac.target_medium,tmd.medium_code,ac.assign_to,ac.questions,ac.level_status from $SP_MASTER_PROOF_READ_ACCESS as ac LEFT JOIN $TT_EXAM_CATEGORIES_TABLE as mc ON mc.exam_category_id=ac.master_id LEFT JOIN $TT_EXAM_CATEGORIES_TABLE as s ON s.exam_category_id=ac.subject_id LEFT JOIN $TT_EXAM_CATEGORIES_TABLE as t ON t.exam_category_id=ac.topic_id LEFT JOIN $SP_EDITORS as ta ON ta.editor_id=ac.assign_to LEFT JOIN $SP_EDITORS as tb ON tb.editor_id=ac.assign_by LEFT JOIN $SP_MEDIUM as md ON md.medium_id=ac.medium_id LEFT JOIN $SP_MEDIUM as tmd ON tmd.medium_id=ac.target_medium where ac.status IN('0','1') and ac.assign_type='exam' order by ac.id desc limit $indexN, $limit";
    $getWorkData = $live->query($getWorkQuery);
?>
    <style>
        .form-group select {
            height: 34px;
        }

        .modal-backdrop {
            z-index: 999 !important;
        }

        .radio_ans {
            top: -2px;
            left: 11px;
            height: 15px !important;
            width: 25px !important;
            background-color: #eee !important;
            border-radius: 50%;
            position: relative !important;
            opacity: 1 !important;
        }

        select.form-control {
            width: 15em !important;
        }

        table.dataTable {
            font-size: 13px;
        }

        .delWork {
            color: red;
            font-size: 15px;
            cursor: pointer;
            margin-left: 4px;
        }

        .tddd {
            cursor: pointer;
        }
    </style>
    <script src="assets/plugins/jquery/jquery-2.1.3.min.js"></script>
    <script src="assets/plugins/jquery-ui/jquery-ui.min.js"></script>
    <link href="assets/plugins/datatables/css/jquery.datatables.min.css" rel="stylesheet">
    <link href="assets/plugins/datatables/css/responsive.datatables.min.css" rel="stylesheet">
    <script src="assets/plugins/datatables/js/jquery.datatables.min.js"></script>
    <script src="assets/plugins/datatables/js/jquery.datatables.js"></script>
    <script src="assets/plugins/datatables/js/datatables.responsive.min.js"></script>
    <script type="text/javascript">
        jQuery.noConflict();
        jQuery(function($) {
            $('#assign_table').dataTable({
                "bPaginate": false,
                "responsive": true,
                "order": [
                    [0, 'desc']
                ]
            });
        });
    </script>
    <?php include_once 'pagination.php'; ?>
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-info">
                <div class="panel-heading clearfix">
                    <h4 class="panel-title">Translator Assign Questions</h4>
                </div>
                <div class="spacer"></div>
                <div class="panel-body">
                    <div class="table-responsive">
                        <table id="assign_table" class="display table" style="width: 100%;">
                            <thead>
                                <tr>
                                    <th>Id</th>
                                    <th>Status</th>
                                    <th>Exam</th>
                                    <th>Subject</th>
                                    <th>Topic</th>
                                    <th>Source</th>
                                    <th>Target</th>
                                    <th>Total</th>
                                    <th>Done</th>
                                    <th>To</th>
                                    <th>By</th>
                                    <th>Date</th>
                                    <th>View</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                while ($gwd = $getWorkData->fetch_assoc()) {
                                    if ($gwd['status'] == '0') {
                                        $sts = '<font style="color:red;">DeActive</font>';
                                    } else if ($gwd['status'] == '1') {
                                        $sts = '<font style="color:green;">Active</font>';
                                    }
                                    $tpc = $gwd['topic_id'];
                                    $medium = $gwd['medium_id'];
                                    $medium_code = $gwd['medium_code'];
                                    $target_medium = $gwd['target_medium'];
                                    $questions = $gwd['questions'];
                                    if ($questions != '') {
                                        $level_status = $gwd['level_status'];
                                        if($level_status == '0') {
                                            $subSt = "and sq.status='4'";
                                        } else {
                                            $subSt = '';
                                        }
                                        $limitQues = sizeof(explode(",", $questions));
                                        $doneCount = $conn->query("SELECT count(sq.question_id) as doneTot from $SP_QUESTION_MEDIUM_WISE as sq where sq.question_id IN($questions) and medium_id='$target_medium' $subSt");
                                        $dct = $doneCount->fetch_assoc();
                                        $doneF = $dct['doneTot'];
                                    } else {
                                        $limitQues = '--';
                                        $doneF = '--';
                                    }



                                ?>
                                    <tr>
                                        <td><?php echo $gwd['id']; ?></td>
                                        <td id="td_<?php echo $gwd['id']; ?>">
                                            <font id="fnt_<?php echo $gwd['id']; ?>" class="tddd"><?php echo $sts; ?></font><i class="fa fa-trash delWork" id="ico_<?php echo $gwd['id']; ?>"></i>
                                        </td>
                                        <td><?php echo $gwd['category_name']; ?></td>
                                        <td><?php echo $gwd['subject']; ?></td>
                                        <td><?php echo $gwd['topic']; ?></td>
                                        <td><?php echo $gwd['source_med']; ?></td>
                                        <td><?php echo $gwd['tar_med']; ?></td>
                                        <td><?php echo $limitQues; ?></td>
                                        <td><?php echo $doneF; ?></td>
                                        <td><?php echo $gwd['tto']; ?></td>
                                        <td><?php echo $gwd['tby']; ?></td>
                                        <td><?php echo date('d-m-Y', strtotime($gwd['assign_date'])); ?></td>
                                        <td><a target="_blank" href="nqb_proofread_oly_ques_view.php?uniqueID=<?php echo $gwd['id']; ?>">User View</a></td>
                                    </tr>
                                <?php } ?>
                            </tbody>
                        </table>
                    </div>
                </div>
                <!-- Pagination -->
                <div class="row">
                    <div class="col-md-6 col-sm-6 col-xs-12">
                        <?php echo pagination($limit, $pageNo, $pagination_link . "?pageN=", $count); ?>
                    </div>
                </div>
            </div>
        </div>
        <script type="text/javascript">
            jQuery.noConflict();
            jQuery(document).ready(function() {

                jQuery('.tddd').on('click', function() {
                    var idd = this.id;
                    var wid = idd.substring(4);
                    var loadUrl = "ajax_call/nqb_proofread_access_update.php?wid=" + wid + "&typ=upd";
                    var jqxhr = jQuery.get(loadUrl);
                    jqxhr.success(function(data) {
                        jQuery("#fnt_" + wid).html(data);
                    });
                });
                jQuery(document).on('click', '.delWork', function() {
                    var idd = this.id;
                    var wid = idd.substring(4);
                    var loadUrl = "ajax_call/nqb_proofread_access_update.php?wid=" + wid + "&typ=del";
                    var jqxhr = jQuery.get(loadUrl);
                    jqxhr.success(function(data) {
                        jQuery("#td_" + wid).html(data);
                    });
                });

            });
        </script>
    <?php
} else {
    echo "<script type='text/javascript'>alert('You dont have access to view this report');</script>";
    echo "<script type='text/javascript'>location.href='/work-sp';</script>";
}
include_once('footer.php');
    ?>