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_proofread_access_report.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_access';
if (in_array($fileName, $pageArray)) {

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

    $SP_MASTER_CATEGORY = 'csp_sp_master_category';
    $SP_MASTER_STRUCTURE = 'csp_sp_master_structure';
    $SP_MEDIUM = 'csp_sp_medium';
    $SP_EDITORS = 'csp_editors';
    $SP_MASTER_PROOF_READ_ACCESS = 'csp_proofread_access';
    $SP_QUESTION_MEDIUM_WISE = 'csp_sp_question_medium_wise';
    $SP_QUESTION = 'csp_sp_question';

    $getWorkQuery = "SELECT ac.id,ac.master_type,ac.master_id, mc.master_name, ac.subject_id, ac.topic_id, ac.sub_topic_id, s.category_name as subject, t.category_name as topic, st.category_name as subtopic, 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 $SP_MASTER_CATEGORY as mc ON mc.master_id=ac.master_id LEFT JOIN $SP_MASTER_STRUCTURE as s ON s.sub_id=ac.subject_id LEFT JOIN $SP_MASTER_STRUCTURE as t ON t.sub_id=ac.topic_id LEFT JOIN $SP_MASTER_STRUCTURE as st ON st.sub_id=ac.sub_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='master' order by ac.id desc";
    $getWorkData = $conn->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": true,
                bFilter: true,
                "responsive": true,
                "iDisplayLength": 100,
                "order": [
                    [0, 'desc']
                ]
            });
        });
    </script>
    <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%; cellspacing: 0;">
                            <thead>
                                <tr>
                                    <th>Id</th>
                                    <th>Status</th>
                                    <th>Master</th>
                                    <th>Subject</th>
                                    <th>Topic</th>
                                    <th>SubTopic</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
                                $i = 1;
                                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>';
                                    }
                                    $subTpc = $gwd['sub_topic_id'];
                                    $tpc = $gwd['topic_id'];
                                    $medium = $gwd['medium_id'];
                                    $medium_code = $gwd['medium_code'];
                                    $target_medium = $gwd['target_medium'];
                                    $questions = $gwd['questions'];
                                    $level_status = $gwd['level_status'];
                                    $assign_to = $gwd['assign_to'];
                                    $assign_date = date('Y-m-d',strtotime($gwd['assign_date']));
                                    if ($questions != '') {
                                        $limitQues = sizeof(explode(",", $questions));
                                        $level_status = $gwd['level_status'];
                                            if ($level_status == '0') {
                                                $subSt = "and sq.status IN('3','4')";
                                            } else {
                                                $subSt = '';
                                            }
                                        $doneCount = $conn->query("SELECT sq.question_id from $SP_QUESTION_MEDIUM_WISE as sq where sq.question_id IN($questions) and medium_id='$target_medium' and (last_proofread_by='$assign_to' OR add_by='$assign_to') and (date(last_proofread_date) >= '$assign_date' OR date(add_date) >= '$assign_date') $subSt");
                                        $dct = array();
                                        while($r = $doneCount->fetch_assoc()) {
                                            $dct[] = $r['question_id']; 
                                        }
                                        $doneCount2 = $conn->query("SELECT sq.question_id from $SP_QUESTION as sq where sq.question_id IN($questions) and medium_id='$medium' and (last_proofread_by='$assign_to' OR add_by='$assign_to') and (date(last_proofread_date) >= '$assign_date' OR date(add_date) >= '$assign_date') $subSt");
                                        $dct2 = array();
                                        while($r2 = $doneCount2->fetch_assoc()) {
                                            $dct2[] = $r2['question_id']; 
                                        }
                                        $merge = array_unique(array_merge($dct,$dct2));
                                        // print_r($merge);
                                        $doneF = count($merge);
                                    } 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['master_name']; ?></td>
                                        <td><?php echo $gwd['subject']; ?></td>
                                        <td><?php echo $gwd['topic']; ?></td>
                                        <td><?php echo $gwd['subtopic']; ?></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_ques_view.php?uniqueID=<?php echo $gwd['id']; ?>&master_id=<?php echo $gwd['master_id']; ?>&subject_id=<?php echo $gwd['subject_id']; ?>&topic_id=<?php echo $tpc; ?>&sub_topic_id=<?php echo $subTpc; ?>&viewIn=<?php echo $medium_code; ?>&mType=<?php echo $gwd['master_type']; ?>">User View</a></td>
                                    </tr>
                                <?php } ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="page-footer">
        <p class="no-s">Graposs Connect &#169;</p>
        </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');
    ?>