GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 3.133.123.162
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/../web/../alumni/application/controllers/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/../web/../alumni/application/controllers/admin/User.php
<?php


/**
 * Description of User
 *
 * @author Softpro India Pvt. Ltd.
 */
class User extends CI_Controller {

    //put your code here
    public function __construct() {
        parent::__construct();
        $this->load->model("admin/reports/GeneralReports");
        $this->load->model("admin/UserManagement");
        $this->load->model("admin/CourseManagement");
        $this->load->model("admin/GallaryManagement");
        $this->load->model("user/JobManagement");
    }

    public function index() {
        if ($this->sessionvalidator->validateSession()) {

            if (isset($_POST['filterSubmitBtn']) != "") {
                $name = $this->input->post("userName");
                $passingYear = $this->input->post("passingYear");
                $startDate = trim($this->input->post("startDate")) == "" ? "" : date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post("startDate"))));
                $endDate = trim($this->input->post("endDate")) == "" ? "" : date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post("endDate"))));
                $userType = $this->input->post("userType");
                $course = $this->input->post("course");
                $viewData["users"] = $this->GeneralReports->getUsers($name, $course, $passingYear, $startDate, $endDate, $userType)->result();
                $viewData["courses"] = $this->CourseManagement->getCourses()->result();
                $this->load->view("admin/users", $viewData);
            } else {
                $viewData["users"] = $this->GeneralReports->getUsers()->result();
                $viewData["courses"] = $this->CourseManagement->getCourses()->result();
                $this->load->view("admin/users", $viewData);
            }
        } else {
            redirect("admin/");
        }
    }

    public function toggleUserStatus($userid, $chnagedStatus) {
        if ($this->sessionvalidator->validateSession() && $this->sessionvalidator->getRole() == "Master Admin") {

            $userUpdateData = array(
                'userid' => $userid,
                'user_status' => $chnagedStatus
            );
            if ($this->UserManagement->updateUser($userUpdateData)) {
                $this->session->set_flashdata('successMessage', 'User Status Updated Successfully.');
                redirect("admin/User/manageUsers");
            } else {
                $this->session->set_flashdata('errorMessage', 'Failed To Update User Status.');
                redirect("admin/User/manageUsers");
            }
        } else {
            redirect("admin/");
        }
    }

    public function manageUsers() {
        if ($this->sessionvalidator->validateSession() && $this->sessionvalidator->getRole() == "Master Admin") {
            $viewData=array();
            if (isset($_POST['filterSubmitBtn']) != "") {
                $name = $this->input->post("userName");
                $passingYear = $this->input->post("passingYear");
                $startDate = trim($this->input->post("startDate")) == "" ? "" : date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post("startDate"))));
                $endDate = trim($this->input->post("endDate")) == "" ? "" : date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post("endDate"))));
                $userType = $this->input->post("userType");
                $course = $this->input->post("course");
                $viewData["users"] = $this->GeneralReports->getUsers($name, $course, $passingYear, $startDate, $endDate, $userType)->result();
                $viewData["courses"] = $this->CourseManagement->getCourses()->result();
                //$this->load->view("admin/manageUsers", $viewData);
            } else {
                $viewData["users"] = $this->GeneralReports->getUsers()->result();
                $viewData["courses"] = $this->CourseManagement->getCourses()->result();
                //$this->load->view("admin/manageUsers", $viewData);
            }
            $this->load->view("admin/manageUsers", $viewData);
        } else {
            redirect("admin/");
        }
    }

    public function toggleUserType($userid, $changedType) {
        if ($this->sessionvalidator->validateSession() && $this->sessionvalidator->getRole() == "Master Admin") {

            $userUpdateData = array(
                'userid' => $userid,
                'user_type' => $changedType
            );
            if ($this->UserManagement->updateUser($userUpdateData)) {
                $this->session->set_flashdata('successMessage', 'User Type Updated Successfully.');
                redirect("admin/User/manageUsers");
            } else {
                $this->session->set_flashdata('errorMessage', 'Failed To Update User Type.');
                redirect("admin/User/manageUsers");
            }
        } else {
            redirect("admin/");
        }
    }

    public function getUserCompleteDetails($userid) {
        if ($this->sessionvalidator->validateSession()) {
            if (sizeof($this->UserManagement->getUserPersoanlAndProfileDetails($userid)->result()) > 0) {
                $viewData["gallaryData"] = $this->GallaryManagement->getGalleryImagesByUserID($userid)->result();
                $viewData["jobData"] = $this->JobManagement->getJobsForAdminViewByUserID($userid)->result();
                $viewData["personalAndProfileData"] = $this->UserManagement->getUserPersoanlAndProfileDetails($userid)->result()[0];
                $this->load->view("admin/userProfile", $viewData);
            } else {
                redirect("admin/User/manageUsers");
            }
        } else {
            redirect("admin/");
        }
    }

    public function deleteImage($pic_id, $userid) {
        if ($this->sessionvalidator->validateSession()) {
            if ($this->GallaryManagement->deleteGallaryImage($pic_id)) {
                echo "hello";
                $this->session->set_flashdata('successMessage', 'Gallery Image Disabled Successfully');
                //exit;
                redirect("admin/User/getUserCompleteDetails/" . $userid);
            } else {
                $this->session->set_flashdata("errorMessage", "Failed To Disable Gallery Image.");
                $this->index();
            }
        } else {
            echo $this->sessionvalidator->validateSession();
            //exit;
            redirect("admin/");
        }
    }

}

KBHT - 2023