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/hrm/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php defined('BASEPATH') OR exit('No direct script access allowed'); /** * */ class AttendanceScheme extends BaseAdminController { protected $inst_id=''; protected $inst_parent_id=''; protected $inst_code=''; protected $inst_type=''; protected $hrms_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->hrms_access=$institute_data['hrms_access']; $this->load->model('hrm/attendance_model','hrmatm'); } function index(){ if(session_userdata('isAdminLoggedin')){ $this->data['page_title']='Attendance Scheme'; if($this->hrms_access=='yes'){ $view='hrm/payroll/vw_attendance_scheme'; }else{ $view='hrm/vw_permission_denied'; } $this->theme->title($this->data['page_title'])->load($view, $this->data); }else{ redirect($this->data['base_url']); } } public function onSearchAttendanceSchemeList(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ if($this->hrms_access=='yes'){ $param['column_order'] = array( null, 'att_scheme_name' ); $param['att_scheme_inst_id']=$this->inst_id; $param['column_search'] = array('att_scheme_name'); $param['order'] = array('att_scheme_id ' => 'ASC'); $posts=$this->input->post(); $list = $this->hrmatm->_get_attendance_scheme($posts,$param,FALSE,FALSE); //print_obj($list);die; $data = array(); $no = isset($posts['start'])?$posts['start']:0; $action=''; foreach ($list as $atm){ $no++; $row = array(); $row[] = $no; $row[] = $atm->att_scheme_name; $row[] = $atm->att_scheme_desc; if($atm->att_scheme_status=='active'){ $status='<span class="badge badge-sm badge-success">Active</span>'; }else if($atm->att_scheme_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_att_scheme_edit" data-att_scheme_id ="'.encode_data($atm->att_scheme_id ).'" data-att_scheme_name="'.$atm->att_scheme_name.'" data-att_scheme_desc="'.$atm->att_scheme_desc.'" data-att_scheme_status="'.$atm->att_scheme_status.'"><i class="fa fa-pencil"></i></button> <button type="button" class="btn btn-xs btn-danger btn_att_scheme_del" data-att_scheme_id ="'.encode_data($atm->att_scheme_id).'"><i class="fa fa-trash"></i></button>'; $data[] = $row; } $output = array( "draw" => isset($posts['draw'])?$posts['draw']:'', "recordsTotal" => $this->hrmatm->_get_attendance_scheme($posts,$param,TRUE), "recordsFiltered" => $this->hrmatm->_get_attendance_scheme($posts,$param,TRUE), "data" => $data, ); }else{ $output['error']='Permission denied'; } echo json_encode($output); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } public function onAddEditAttendanceScheme(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ if($this->hrms_access=='yes'){ $_scheme=post_data('_scheme'); $scheme_name=post_data('scheme_name'); $scheme_desc=post_data('scheme_desc'); $scheme_status=post_data('scheme_status'); $inst_id=$this->inst_id; if(empty($_scheme)){ $scheme_found=$this->hrmatm->get_attendance_scheme(array('scheme_name'=>$grade_name,'att_scheme_inst_id'=>$inst_id,'att_scheme_inst_type'=>$this->inst_type)); if(empty($scheme_found)){ $data_to_add=array( 'att_scheme_name'=>$scheme_name, 'att_scheme_desc'=>$scheme_desc, 'att_scheme_inst_id'=>$inst_id, 'att_scheme_inst_type'=>$this->inst_type, 'att_scheme_status'=>$scheme_status ); $added=$this->hrmatm->store_attendance_scheme($data_to_add); if($added){ $return['success']='Scheme added.'; }else{ $return['error']='Scheme not added.'; } }else{ $return['error']='Scheme already foudn in the system'; } }else{ $scheme_id=decode_data($_scheme); $scheme_found=$this->hrmatm->get_attendance_scheme(array('att_scheme_id'=>$scheme_id,'att_scheme_inst_id'=>$inst_id,'att_scheme_inst_type'=>$this->inst_type)); if(!empty($scheme_found)){ $data_to_add=array( 'att_scheme_name'=>$scheme_name, 'att_scheme_desc'=>$scheme_desc, 'att_scheme_inst_id'=>$inst_id, 'att_scheme_inst_type'=>$this->inst_type, 'att_scheme_status'=>$scheme_status ); $added=$this->hrmatm->update_attendance_scheme($data_to_add,array('att_scheme_id'=>$scheme_id,'att_scheme_inst_id'=>$inst_id,'att_scheme_inst_type'=>$this->inst_type)); if($added){ $return['success']='Scheme updated.'; }else{ $return['error']='Scheme not updated.'; } }else{ $return['error']='Scheme data not found in the system.'; } } }else{ $return['error']='Permission denied'; } json_headers($return); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } public function onDeleteAttendanceScheme(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ if($this->hrms_access=='yes'){ $_scheme_id=post_data('scheme_id'); $inst_id=$this->inst_id; if(!empty($_scheme_id)){ $scheme_id=decode_data($_scheme_id); $scheme_found=$this->hrmatm->get_attendance_scheme(array('att_scheme_id'=>$scheme_id,'att_scheme_inst_id'=>$inst_id,'att_scheme_inst_type'=>$this->inst_type)); if(!empty($scheme_found)){ $deleted=$this->hrmatm->delete_attendance_scheme(array('att_scheme_id'=>$scheme_id,'att_scheme_inst_id'=>$inst_id,'att_scheme_inst_type'=>$this->inst_type)); if($deleted){ $return['success']='Scheme deleted successfully.'; }else{ $return['error']='Scheme not deleted.'; } $return['success']='Scheme deleted successfully.'; }else{ $return['error']='Scheme not found'; } }else{ $return['error']='Data manipulation not permitted'; } }else{ $return['error']='Permission denied'; } json_headers($return); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } }