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

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/../css/../cas/application/controllers/admin/OperationGroup.php
<?php

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

class OperationGroup extends CI_Controller {

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

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

    public function createOperationGroup() {
        if ($this->sessionvalidator->isLoggedIn()) {
            $this->load->view('admin/createOperationGroup');
        } else {
            redirect("admin/");
        }
    }

    public function saveNewOperationGroup() {
        if ($this->sessionvalidator->isLoggedIn()) {
            $this->form_validation->set_rules('ogName', 'Operation Group Name', 'trim|required', array('required' => 'Operation Group Name Can Not Be Blank.'));
            $this->form_validation->set_rules('ogTooltip', 'Operation Grou Tooltip', 'trim|required', array('required' => 'Operation Group Tooltip Can Not Be Blank.'));
            $this->form_validation->set_rules('ogTitle', 'Operation Grou Title', 'trim|required', array('required' => 'Operation Group Title Can Not Be Blank.'));
            $this->form_validation->set_rules('ogIconClass', 'Operation Group Icon Class Name', 'trim|required', array('required' => 'Operation Group Icon Class Name Can Not Be Blank.'));
            $queryByOperationGroupName = $this->MenuManagement->getOperationGroupByName(trim($this->input->post('ogName')));
            $operationGroupInfoByName = $queryByOperationGroupName->result();
            if ($this->form_validation->run() == FALSE) {
                $this->createOperationGroup();
            } else if (sizeof($operationGroupInfoByName)) {
                $this->session->set_flashdata('errorMessage', "An Operation Group With This Name Already Exits. Please choose A Different Name.");
                $this->createOperationGroup();
            } else {
                $newOperationGroupInfo = array(
                    'group_name' => addslashes(trim($this->input->post('ogName'))),
                    'group_title' => addslashes(trim($this->input->post('ogTitle'))),
                    'group_tooltip' => addslashes(trim($this->input->post('ogTooltip'))),
                    'group_icon' => trim($this->input->post('ogIconClass')),
                    'group_slug_url' => (trim($this->input->post('ogSlug')) == "") ? NULL : $this->input->post('ogSlug'),
                    'group_added_on' => date("Y-m-d H:i:s"),
                    'group_added_by' => $this->session->userdata("adminData")["smember_id"],
                    'group_updated_on' => date("Y-m-d H:i:s"),
                    'group_updated_by' => $this->session->userdata("adminData")["smember_id"]
                );
                if ($this->MenuManagement->createNewOperationGroup($newOperationGroupInfo)) {
                    $this->session->set_flashdata('successMessage', 'Operation Group Created Successfully.');
                    redirect("admin/OperationGroup");
                } else {
                    $this->session->set_flashdata('errorMessage', 'An Error Occured While Creating Operation Group. Try Later.');
                    redirect("admin/OperationGroup");
                }
            }
        } else {
            redirect("admin/");
        }
    }

    public function editOperationGroup($group_id) {
        if ($this->sessionvalidator->isLoggedIn()) {
            $viewData['operationGroupInfo'] = $this->MenuManagement->getOperationGroupInfoBy($group_id)->result()[0];
            $this->load->view('admin/editOperationGroup', $viewData);
        } else {
            redirect("admin/");
        }
    }

    public function updateOperationGroup() {
        $group_id = $this->input->post('ogId');
        if ($this->sessionvalidator->isLoggedIn()) {
            $this->form_validation->set_rules('ogName', 'Operation Group Name', 'trim|required', array('required' => 'Operation Group Name Can Not Be Blank.'));
            $this->form_validation->set_rules('ogTooltip', 'Operation Grou Tooltip', 'trim|required', array('required' => 'Operation Group Tooltip Can Not Be Blank.'));
            $this->form_validation->set_rules('ogTitle', 'Operation Grou Title', 'trim|required', array('required' => 'Operation Group Title Can Not Be Blank.'));
            $this->form_validation->set_rules('ogIconClass', 'Operation Group Icon Class Name', 'trim|required', array('required' => 'Operation Group Icon Class Name Can Not Be Blank.'));
            if ($this->form_validation->run() == FALSE) {
                $this->editOperationGroup($group_id);
            } else if (!$this->MenuManagement->isOperationGroupNameSafeUpdate($group_id, trim($this->input->post('ogName')))) {
                $this->session->set_flashdata('errorMessage', "An Operation Group With This Name Already Exits. Please choose A Different Name.");
                $this->editOperationGroup($group_id);
            } else {
                $operationGroupInfo = array(
                    'group_id' => $group_id,
                    'group_name' => addslashes(trim($this->input->post('ogName'))),
                    'group_title' => addslashes(trim($this->input->post('ogTitle'))),
                    'group_tooltip' => addslashes(trim($this->input->post('ogTooltip'))),
                    'group_icon' => trim($this->input->post('ogIconClass')),
                    'group_slug_url' => (trim($this->input->post('ogSlug')) == "") ? NULL : $this->input->post('ogSlug'),
                    'group_updated_on' => date("Y-m-d H:i:s"),
                    'group_updated_by' => $this->session->userdata("adminData")["smember_id"]
                );
                if ($this->MenuManagement->updateOperationGroupInfo($operationGroupInfo)) {
                    $this->session->set_flashdata('successMessage', 'Operation Group Updated Successfully.');
                    redirect("admin/OperationGroup");
                } else {
                    $this->session->set_flashdata('errorMessage', 'An Error Occured While Updating Operation Group. Try Later.');
                    redirect("admin/OperationGroup");
                }
            }
        } else {
            redirect("admin/");
        }
    }

    public function toggleOperationGroupStatus($group_id, $toUpdateStatus) {
        if ($this->sessionvalidator->isLoggedIn()) {
            $operationGroupUpdateData = array(
                'group_id' => $group_id,
                'group_updated_on' => date("Y-m-d H:i:s"),
                'group_updated_by' => $this->session->userdata("adminData")["smember_id"],
                'group_active_status' => $toUpdateStatus
            );
            if ($this->MenuManagement->updateOperationGroupInfo($operationGroupUpdateData)) {
                $this->session->set_flashdata('successMessage', 'Operation Group Status Updated Successfully.');
                redirect("admin/OperationGroup");
            } else {
                $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Updating Operation Group Status. Try Later.');
                redirect("admin/OperationGroup");
            }
        } else {
            redirect("admin/");
        }
    }

    public function deleteOperationGroup($group_id) {
        if ($this->sessionvalidator->isLoggedIn()) {
            $operationGroupUpdateData = array(
                'group_id' => $group_id,
                'group_updated_on' => date("Y-m-d H:i:s"),
                'group_updated_by' => $this->session->userdata("adminData")["smember_id"],
                'group_delete_status' => 'T'
            );
            if ($this->MenuManagement->updateOperationGroupInfo($operationGroupUpdateData)) {
                $this->session->set_flashdata('successMessage', 'Operation Group Deleted Successfully.');
                redirect("admin/OperationGroup");
            } else {
                $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Deleting Operation Group. Try Later.');
                redirect("admin/OperationGroup");
            }
        } else {
            redirect("admin/");
        }
    }

    public function undoDeleteOperationGroup($group_id) {
        if ($this->sessionvalidator->isLoggedIn()) {
            $operationGroupUpdateData = array(
                'group_id' => $group_id,
                'group_updated_on' => date("Y-m-d H:i:s"),
                'group_updated_by' => $this->session->userdata("adminData")["smember_id"],
                'group_delete_status' => 'F'
            );
            if ($this->MenuManagement->updateOperationGroupInfo($operationGroupUpdateData)) {
                $this->session->set_flashdata('successMessage', 'Operation Group Recovered Successfully.');
                redirect("admin/OperationGroup");
            } else {
                $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Recovering Operation Group. Try Later.');
                redirect("admin/OperationGroup");
            }
        } else {
            redirect("admin/");
        }
    }

}

KBHT - 2023