GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 18.116.49.243
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/../.well-known/../cas/application/controllers/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/../.well-known/../cas/application/controllers/admin/Operation.php
<?php

/**
 * Controller Class For Location Management (State/City)
 *
 * @author Softpro India Pvt. Ltd.
 */
defined('BASEPATH') OR exit('No direct script access allowed');

class Operation extends CI_Controller {

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

    public function index() {
        if ($this->sessionvalidator->isLoggedIn() && $this->sessionvalidator->isAccessGranted()) {
            $viewData['allOperations'] = $this->MenuManagement->getAllOperations()->result();
            $this->load->view('admin/operations', $viewData);
        } else {
            redirect("admin/");
        }
    }

    public function createOperation() {
        if ($this->sessionvalidator->isLoggedIn()) {
            $viewData['operationGroups'] = $this->MenuManagement->getNonDeletedOperationGroups()->result();
            $this->load->view('admin/createOperation', $viewData);
        } else {
            redirect("admin/");
        }
    }

    public function saveNewOperation() {
        if ($this->sessionvalidator->isLoggedIn()) {
            $this->form_validation->set_rules('opGroup', 'Operation Group', 'trim|required', array('required' => 'Please Select Operation Group.'));
            $this->form_validation->set_rules('opName', 'Operation Name', 'trim|required', array('required' => 'Operation Name Can Not Be Blank.'));
            $this->form_validation->set_rules('opTooltip', 'Operation Tooltip', 'trim|required', array('required' => 'Operation Tooltip Can Not Be Blank.'));
            $this->form_validation->set_rules('opTitle', 'Operation Title', 'trim|required', array('required' => 'Operation Title Can Not Be Blank.'));
            $this->form_validation->set_rules('opSlug', 'Operation Slur URL', 'trim|required', array('required' => 'Operation Slug URL Is Required.'));
            $this->form_validation->set_rules('opHiddenFlag', 'Operation Hidden Status', 'trim|required', array('required' => 'Operation Hidden Status Is Required.'));
            $queryByOperationName = $this->MenuManagement->getOperationByName(trim($this->input->post('opName')));
            $operationInfoByName = $queryByOperationName->result();
            if ($this->form_validation->run() == FALSE) {
                $this->createOperation();
            } else if (sizeof($operationInfoByName)) {
                $this->session->set_flashdata('errorMessage', "An Operation With This Name Already Exits. Please choose A Different Name.");
                $this->createOperation();
            } else {
                $newOperationInfo = array(
                    'oprtn_name' => addslashes(trim($this->input->post('opName'))),
                    'oprtn_title' => addslashes(trim($this->input->post('opTitle'))),
                    'oprtn_tooltip' => addslashes(trim($this->input->post('opTooltip'))),
                    'oprtn_slug_url' => addslashes(trim($this->input->post('opSlug'))),
                    'oprtn_hidden_status' => $this->input->post('opHiddenFlag'),
                    'group_id' => $this->input->post('opGroup'),
                    'oprtn_added_on' => date("Y-m-d H:i:s"),
                    'oprtn_added_by' => $this->session->userdata("adminData")["smember_id"],
                    'oprtn_updated_on' => date("Y-m-d H:i:s"),
                    'oprtn_updated_by' => $this->session->userdata("adminData")["smember_id"]
                );
                if ($this->MenuManagement->createNewOperation($newOperationInfo)) {
                    $this->session->set_flashdata('successMessage', 'Operation Created Successfully.');
                    redirect("admin/Operation");
                } else {
                    $this->session->set_flashdata('errorMessage', 'An Error Occured While Creating Operation. Try Later.');
                    redirect("admin/Operation");
                }
            }
        } else {
            redirect("admin/");
        }
    }

    public function editOperation($oprtn_id) {
        if ($this->sessionvalidator->isLoggedIn()) {
            $viewData['operationGroups'] = $this->MenuManagement->getNonDeletedOperationGroups()->result();
            $viewData['operationInfo'] = $this->MenuManagement->getOperationInfoBy($oprtn_id)->result()[0];
            $this->load->view('admin/editOperation', $viewData);
        } else {
            redirect("admin/");
        }
    }

    public function updateOperation() {
        if ($this->sessionvalidator->isLoggedIn()) {
            if ($this->sessionvalidator->isLoggedIn()) {
                $oprtn_id = $this->input->post("opId");
                $this->form_validation->set_rules('opGroup', 'Operation Group', 'trim|required', array('required' => 'Please Select Operation Group.'));
                $this->form_validation->set_rules('opName', 'Operation Name', 'trim|required', array('required' => 'Operation Name Can Not Be Blank.'));
                $this->form_validation->set_rules('opTooltip', 'Operation Tooltip', 'trim|required', array('required' => 'Operation Tooltip Can Not Be Blank.'));
                $this->form_validation->set_rules('opTitle', 'Operation Title', 'trim|required', array('required' => 'Operation Title Can Not Be Blank.'));
                $this->form_validation->set_rules('opSlug', 'Operation Slur URL', 'trim|required', array('required' => 'Operation Slug URL Is Required.'));
                $this->form_validation->set_rules('opHiddenFlag', 'Operation Hidden Status', 'trim|required', array('required' => 'Operation Hidden Status Is Required.'));
                if ($this->form_validation->run() == FALSE) {
                    $this->editOperation($oprtn_id);
                } else if (!$this->MenuManagement->isOperationNameSafeUpdate($oprtn_id, trim($this->input->post('opName')))) {
                    $this->session->set_flashdata('errorMessage', "An Operation With This Name Already Exits. Please choose A Different Name.");
                    $this->editOperation($oprtn_id);
                } else {
                    $operationInfo = array(
                        'oprtn_id' => $oprtn_id,
                        'oprtn_name' => addslashes(trim($this->input->post('opName'))),
                        'oprtn_title' => addslashes(trim($this->input->post('opTitle'))),
                        'oprtn_tooltip' => addslashes(trim($this->input->post('opTooltip'))),
                        'oprtn_slug_url' => addslashes(trim($this->input->post('opSlug'))),
                        'oprtn_hidden_status' => $this->input->post('opHiddenFlag'),
                        'group_id' => $this->input->post('opGroup'),
                        'oprtn_updated_on' => date("Y-m-d H:i:s"),
                        'oprtn_updated_by' => $this->session->userdata("adminData")["smember_id"]
                    );
                    if ($this->MenuManagement->updateOperationInfo($operationInfo)) {
                        $this->session->set_flashdata('successMessage', 'Operation Updated Successfully.');
                        redirect("admin/Operation");
                    } else {
                        $this->session->set_flashdata('errorMessage', 'An Error Occured While Updating Operation. Try Later.');
                        redirect("admin/Operation");
                    }
                }
            } else {
                redirect("admin/");
            }
        } else {
            redirect("admin/");
        }
    }

    public function toggleOperationStatus($oprtn_id, $toUpdateStatus) {
        if ($this->sessionvalidator->isLoggedIn()) {
            $operationUpdateData = array(
                'oprtn_id' => $oprtn_id,
                'oprtn_updated_on' => date("Y-m-d H:i:s"),
                'oprtn_updated_by' => $this->session->userdata("adminData")["smember_id"],
                'oprtn_active_status' => $toUpdateStatus
            );
            if ($this->MenuManagement->updateOperationInfo($operationUpdateData)) {
                $this->session->set_flashdata('successMessage', 'Operation Status Updated Successfully.');
                redirect("admin/Operation");
            } else {
                $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Updating Operation Status. Try Later.');
                redirect("admin/Operation");
            }
        } else {
            redirect("admin/");
        }
    }

    public function deleteOperation($oprtn_id) {
        if ($this->sessionvalidator->isLoggedIn()) {
            $operationUpdateData = array(
                'oprtn_id' => $oprtn_id,
                'oprtn_updated_on' => date("Y-m-d H:i:s"),
                'oprtn_updated_by' => $this->session->userdata("adminData")["smember_id"],
                'oprtn_delete_status' => 'T'
            );
            if ($this->MenuManagement->updateOperationInfo($operationUpdateData)) {
                $this->session->set_flashdata('successMessage', 'Operation Deleted Successfully.');
                redirect("admin/Operation");
            } else {
                $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Deleting Operation. Try Later.');
                redirect("admin/Operation");
            }
        } else {
            redirect("admin/");
        }
    }

    public function undoDeleteOperation($oprtn_id) {
        if ($this->sessionvalidator->isLoggedIn()) {
            $operationUpdateData = array(
                'oprtn_id' => $oprtn_id,
                'oprtn_updated_on' => date("Y-m-d H:i:s"),
                'oprtn_updated_by' => $this->session->userdata("adminData")["smember_id"],
                'oprtn_delete_status' => 'F'
            );
            if ($this->MenuManagement->updateOperationInfo($operationUpdateData)) {
                $this->session->set_flashdata('successMessage', 'Operation Recovered Successfully.');
                redirect("admin/Operation");
            } else {
                $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Recovering Operation. Try Later.');
                redirect("admin/Operation");
            }
        } else {
            redirect("admin/");
        }
    }

}

KBHT - 2023