D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
www
/
grievance
/
sys_admin
/
application
/
controllers
/
admin
/
Filename :
DefaultStuffs.php
back
Copy
<?php /** * Controller For Handling All Requests Related To Default Things * * @author Softpro India Pvt. Ltd. */ class DefaultStuffs extends CI_Controller { public function __construct() { parent::__construct(); $this->load->helper('url'); $this->load->library('session'); $this->load->helper('form'); $this->load->library('form_validation'); $this->load->model('admin/GrievanceCategoriesManagement'); } public function defaultGrvncCatgs() { if ($this->session->userdata('logged_in')) { $viewData['allDefGrvnces'] = $this->GrievanceCategoriesManagement->getAllDefaultGrievanceCategories()->result(); $this->load->view('admin/def_grievance_catgs', $viewData); } else { redirect("admin/"); } } public function createDefaultGCategory() { if ($this->session->userdata('logged_in')) { $this->load->view('admin/add_def_grievance_catg'); } else { redirect("admin/"); } } public function saveDefGCategory(){ if ($this->session->userdata('logged_in')) { $this->form_validation->set_rules('defGCatTitle', 'Grievance Title', 'trim|required', array('required' => 'Grievance Title Is Required.')); if ($this->form_validation->run() == FALSE) { $this->createDefaultGCategory(); } else { $NewDefGCatInfo = array( 'dfc_title' => $this->input->post('defGCatTitle'), 'dfc_description' => $this->input->post('defGCatDesc'), 'dfc_added_on' => date("Y-m-d H:i:s"), 'dfc_added_by' => $this->session->userdata('id'), 'dfc_updated_on' => date("Y-m-d H:i:s"), 'dfc_updated_by' => $this->session->userdata('id') ); if ($this->GrievanceCategoriesManagement->createNewDefGCategory($NewDefGCatInfo)) { $this->session->set_flashdata('successMessage', 'Default Grievance Category Created Successfully.'); redirect("admin/DefaultStuffs/defaultGrvncCatgs"); } else { $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Creating Default Grievance Category Info. Try Later.'); $this->createDefaultGCategory(); } } } else { redirect("admin/"); } } public function toggleDefGCategoriesInsertStatus($dfc_id, $toUpdateStatus) { if ($this->session->userdata('logged_in')) { $defGCatgUpdateData = array( 'dfc_id' => $dfc_id, 'dfc_allotment_allow_status' => $toUpdateStatus, 'dfc_updated_on' => date("Y-m-d H:i:s"), 'dfc_updated_by' => $this->session->userdata('id') ); if ($this->GrievanceCategoriesManagement->updateDefaultGrievanceCategoryInfo($defGCatgUpdateData)) { $this->session->set_flashdata('successMessage', 'Default Grievance Category\'s Insert Status Updated Successfully.'); redirect("admin/DefaultStuffs/defaultGrvncCatgs"); } else { $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Updating Insert Status. Try Later.'); redirect("admin/DefaultStuffs/defaultGrvncCatgs"); } } else { redirect("admin/"); } } public function deleteDefGCategories($dfc_id) { if ($this->session->userdata('logged_in')) { $defGCatgDeleteData = array( 'dfc_id' => $dfc_id, 'dfc_updated_on' => date("Y-m-d H:i:s"), 'dfc_updated_by' => $this->session->userdata('id'), 'dfc_delete_status' => 'T' ); $this->GrievanceCategoriesManagement->updateDefaultGrievanceCategoryInfo($defGCatgDeleteData); redirect("admin/DefaultStuffs/defaultGrvncCatgs"); } else { redirect("admin/"); } } public function undoDeleteDefGCategories($dfc_id) { if ($this->session->userdata('logged_in')) { $defGCatDeleteData = array( 'dfc_id' => $dfc_id, 'dfc_updated_on' => date("Y-m-d H:i:s"), 'dfc_updated_by' => $this->session->userdata('id'), 'dfc_delete_status' => 'F' ); $this->GrievanceCategoriesManagement->updateDefaultGrievanceCategoryInfo($defGCatDeleteData); redirect("admin/DefaultStuffs/defaultGrvncCatgs"); } else { redirect("admin/"); } } public function editDefGCategory($dfc_id) { if ($this->session->userdata('logged_in')) { $viewData['def_gcat_info'] = $this->GrievanceCategoriesManagement->getDefGCategoryInfoById($dfc_id)->result()[0]; $this->load->view('admin/edit_def_grievance_catg', $viewData); } else { redirect("admin/"); } } public function updateDefGCategory() { if ($this->session->userdata('logged_in')) { $this->form_validation->set_rules('defGCatTitle', 'Grievance Title', 'trim|required', array('required' => 'Grievance Title Is Required.')); if ($this->form_validation->run() == FALSE) { $this->editDefGCategory($this->input->post('defGCatId')); } else { $defGCatUpdateInfo = array( 'dfc_id' => $this->input->post('defGCatId'), 'dfc_title' => $this->input->post('defGCatTitle'), 'dfc_description' => $this->input->post('defGCatDesc'), 'dfc_updated_on' => date("Y-m-d H:i:s"), 'dfc_updated_by' => $this->session->userdata('id') ); if ($this->GrievanceCategoriesManagement->updateDefaultGrievanceCategoryInfo($defGCatUpdateInfo)) { $this->session->set_flashdata('successMessage', 'Default Grievance Category Updated Successfully.'); redirect("admin/DefaultStuffs/defaultGrvncCatgs"); } else { $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Updating Default Grievance Category Info. Try Later.'); $this->editDefGCategory($this->input->post('defGCatId')); } } } else { redirect("admin/"); } } }