Server IP : 103.191.208.50 / Your IP : 216.73.216.53 Web Server : LiteSpeed System : Linux orion.herosite.pro 4.18.0-553.53.1.lve.el8.x86_64 #1 SMP Wed May 28 17:01:02 UTC 2025 x86_64 User : celkcksm ( 1031) PHP Version : 7.4.33 Disable Function : show_source, system, shell_exec, passthru, popen, exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/celkcksm/ecampus.ncriptech.com/application/controllers/admin/asm/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php defined('BASEPATH') OR exit('No direct script access allowed'); /** * */ class AssetsCategory extends BaseAdminController { protected $inst_id=''; protected $inst_parent_id=''; protected $inst_code=''; protected $inst_type=''; protected $asm_access=''; function __construct() { parent::__construct(); $institute_data=check_institute($this->data['userdata']); $this->inst_id=$institute_data['institute_id']; $this->inst_parent_id=$institute_data['inst_parent_id']; $this->inst_code=$institute_data['inst_code']; $this->inst_type=$institute_data['inst_type']; $this->asm_access=$institute_data['asm_access']; $this->load->model('asm/assets_model','asm'); } function index(){ if(session_userdata('isAdminLoggedin')){ if($this->asm_access=='yes'){ $this->data['page_title']='Assets Category'; $this->theme->title($this->data['page_title'])->load('asm/vw_assets_categories', $this->data); }else{ $this->data['page_title']='Assets Category'; $this->theme->title($this->data['page_title'])->load('asm/vw_assets_permission_denied', $this->data); } }else{ redirect($this->data['base_url']); } } public function onSearchAssetsCategoriesList(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $param['column_order'] = array( null, 'category_name' ); $param['category_inst_id']=$this->inst_id; $param['category_inst_type']=$this->inst_type; $param['column_search'] = array('category_name'); $param['order'] = array('category_id' => 'ASC'); $posts=$this->input->post(); $list = $this->asm->_get_assets_category($posts,$param,FALSE,FALSE); //print_obj($list);die; $data = array(); $no = isset($posts['start'])?$posts['start']:0; $action=''; foreach ($list as $asm){ $no++; $row = array(); $row[] = $no; $row[] = $asm->category_name; if($asm->category_status=='active'){ $status='<span class="badge badge-sm badge-success">Active</span>'; }else if($asm->category_status=='inactive'){ $status='<span class="badge badge-sm badge-danger">Inactive</span>'; } $row[] = $status; if($asm->category_status=='active'){ $add_assets='<a href="'.$this->data['base_url'].'/assets/add/'.encode_data($asm->category_id).'" class="btn btn-xs btn-dark">Add Assets</a>'; }else if($asm->category_status=='inactive'){ $add_assets=''; } $row[] = $add_assets.' <button type="button" class="btn btn-xs btn-dark btn_asset_category_edit" data-asset_category_id="'.encode_data($asm->category_id).'"><i class="fa fa-edit"></i></button> <button type="button" class="btn btn-xs btn-danger btn_asset_category_del" data-asset_category_id="'.encode_data($asm->category_id).'" data-asset_category_status="'.$asm->category_status.'"><i class="fa fa-trash"></i></button>'; $data[] = $row; } $output = array( "draw" => isset($posts['draw'])?$posts['draw']:'', "recordsTotal" => $this->asm->_get_assets_category($posts,$param,TRUE), "recordsFiltered" => $this->asm->_get_assets_category($posts,$param,TRUE), "data" => $data, ); echo json_encode($output); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } public function onAddEditAssetsCategory(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $_assets_category=post_data('_assets_category'); $assets_category_name=post_data('assets_category_name'); $assets_category_note=post_data('assets_category_note'); $assets_category_status=post_data('assets_category_status'); $institute_data=check_institute($this->data['userdata']); $category_inst_id=$this->inst_id; $inst_type=$this->inst_type; if(empty($_assets_category)){ $category_found=$this->asm->get_assets_category(array('category_name'=>$assets_category_name,'category_inst_id'=>$category_inst_id)); if(empty($category_found)){ $data_to_add=array( 'category_name'=>$assets_category_name, 'category_notes'=>$assets_category_note, 'category_inst_type'=>$inst_type, 'category_inst_id'=>$category_inst_id, 'category_status'=>$assets_category_status ); $added=$this->asm->store_assets_category($data_to_add); if($added){ $return['success']='Assets Category added.'; }else{ $return['error']='Assets Category not added.'; } }else{ $return['error']='Assets Category already found in the system'; } }else{ $category_id=decode_data($_assets_category); $category_found=$this->asm->get_assets_category(array('category_id'=>$category_id,'category_inst_id'=>$category_inst_id)); if(!empty($category_found)){ $data_to_add=array( 'category_name'=>$assets_category_name, 'category_notes'=>$assets_category_note, 'category_inst_type'=>$inst_type, 'category_inst_id'=>$category_inst_id, 'category_status'=>$assets_category_status ); $added=$this->asm->update_assets_category($data_to_add,array('category_id'=>$category_id,'category_inst_id'=>$category_inst_id)); if($added){ $return['success']='Assets Category updated.'; }else{ $return['error']='Assets Category not updated.'; } }else{ $return['error']='Assets Category data not found in the system.'; } } json_headers($return); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } public function onDeleteAssetsCategory(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $_assets_category=post_data('_assets_category'); $category_inst_id=$this->inst_id; if(!empty($_assets_category)){ $category_id=decode_data($_assets_category); $category_found=$this->asm->get_assets_category(array('category_id'=>$category_id,'category_inst_id'=>$category_inst_id)); if(!empty($category_found)){ $deleted=$this->asm->delete_assets_category(array('category_id'=>$category_id,'category_inst_id'=>$category_inst_id)); if($deleted){ $return['success']='Assets Category deleted successfully.'; }else{ $return['error']='Assets Category not deleted.'; } $return['success']='Assets Category deleted successfully.'; }else{ $return['error']='Assets Category not found'; } }else{ $return['error']='Data manipulation not permitted'; } json_headers($return); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } public function onSearchSubDepartmentsList(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $param['column_order'] = array( null, 'department_name' ); $param['department_institute_id']=$this->inst_id; $param['column_search'] = array('department_name'); $param['order'] = array('department_sub_id' => 'ASC'); $posts=$this->input->post(); $posts['department_id']= decode_data($posts['department_id']); $list = $this->dm->_get_sub_departments($posts,$param,FALSE,FALSE); //print_obj($list);die; $data = array(); $no = isset($posts['start'])?$posts['start']:0; $action=''; foreach ($list as $dep){ $no++; $row = array(); if(!empty($agent_image) && is_file(FCPATH.$agent_image->media_disk_path)){ $image=$this->data['base_url'].$agent_image->media_disk_path; }else{ $image=$this->data['no_image']; } $row[] = $no; $row[] = $dep->department_name; $row[] = $dep->department_name_alias; if($dep->department_status=='active'){ $status='<span class="badge badge-sm badge-success">Active</span>'; }else if($dep->department_status=='inactive'){ $status='<span class="badge badge-sm badge-danger">Inactive</span>'; } $row[] = $status; $row[] = ' <button type="button" class="btn btn-xs btn-info btn_sub_dep_edit" data-dep_id="'.encode_data($dep->department_sub_id).'" data-dep_name="'.$dep->department_name.'" data-dep_name_alias="'.$dep->department_name_alias.'" data-dep_status="'.$dep->department_status.'"><i class="fa fa-pencil"></i></button> <button type="button" class="btn btn-xs btn-danger btn_sub_dep_del" data-dep_id="'.encode_data($dep->department_sub_id).'" data-dep_status="'.$dep->department_status.'"><i class="fa fa-trash"></i></button>'; $data[] = $row; } $output = array( "draw" => isset($posts['draw'])?$posts['draw']:'', "recordsTotal" => $this->dm->_get_sub_departments($posts,$param,TRUE), "recordsFiltered" => $this->dm->_get_sub_departments($posts,$param,TRUE), "data" => $data, ); echo json_encode($output); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } public function onLoadCategoryForm(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $category=[]; if($this->input->post('category_id')){ $_category_id=post_data('category_id'); $category_id=decode_data($_category_id); $category=$this->asm->get_assets_category(array('category_id'=>$category_id,'category_inst_id'=>$this->inst_id,'category_inst_type'=>$this->inst_type,'category_status'=>'active')); } $this->data['category']=$category; $return['html']=$this->theme->view('_pages/asm/vw_asm_category_form_data_dyna',$this->data,true); json_headers($return); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } }