?
Current Path : /home1/savoy/www/savoyglobal.net/horeitia/application/controllers/.svn/text-base/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/www/savoyglobal.net/horeitia/application/controllers/.svn/text-base/exits.php.svn-base |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Exits extends MY_Controller { public function __construct() { parent::__construct(); $this->load->model('mastermodel'); $this->load->model('onboardingmodel'); $this->load->model('administrationmodel'); $this->load->model('exitsmodel'); $this->load->library('Fpaginate'); } function get_post_values() { $data = array(); foreach ($_POST as $key => $value) { if($key != "submit") { $data[$key] = $this->input->post($key); } } return $data; } /* common function loading pages through jquery load method . * Usages:-used for displaying addform. */ function addformdisplay($page,$directory,$table="",$pagenum="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['userid'],1); if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $this->load->view(''.$directory.'/'.$page.''); } } function deletedata($table,$id,$field) { $data=array(); $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['userid'],2); if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $data=$this->mastermodel->deletedata($table,$id,$field); $data['msg']=$data['msg']; if($data['res']==1) { $this->load->view('message',$data); } else { $this->load->view('message',$data); } } } function checkexistence($table,$field,$value) { if($this->mastermodel->checkexistence($table,$field,$value)>0) { echo 1; } } function checkexistencearray($table,$field,$value) { if($this->mastermodel->checkexistencearray($table,$field,$value)>0) { echo 1; } } function addinexits($modelfunction,$page) { $postdata=$this->get_post_values(); $path = './assets/uploads'; if(isset($_FILES['leave_application_form_doc']) && $_FILES['leave_application_form_doc']['name'] != "") { $_FILES["leave_application_form_doc"]["name"]=date("y-m-d-H-i-s").$_FILES["leave_application_form_doc"]["name"]; if (!is_file("$path/".$_FILES["leave_application_form_doc"]["name"])) { (move_uploaded_file($_FILES["leave_application_form_doc"]["tmp_name"],$path."/".$_FILES["leave_application_form_doc"]["name"])); $postdata['leave_application_form_doc']=$_FILES["leave_application_form_doc"]["name"]; } } else if(isset($postdata['leave_application_form_name'])) { $postdata['leave_application_form_doc']=""; } if(isset($_FILES['proof_emergency_doc']) && $_FILES['proof_emergency_doc']['name'] != "") { $_FILES["proof_emergency_doc"]["name"]=date("y-m-d-H-i-s").$_FILES["proof_emergency_doc"]["name"]; if (!is_file("$path/".$_FILES["proof_emergency_doc"]["name"])) { (move_uploaded_file($_FILES["proof_emergency_doc"]["tmp_name"],$path."/".$_FILES["proof_emergency_doc"]["name"])); $postdata['proof_emergency_doc']=$_FILES["proof_emergency_doc"]["name"]; } } else if(isset($postdata['proof_emergency_name'])) { $postdata['proof_emergency_doc']=""; } if(isset($_FILES['clearence_form_doc']) && $_FILES['clearence_form_doc']['name'] != "") { $_FILES["clearence_form_doc"]["name"]=date("y-m-d-H-i-s").$_FILES["clearence_form_doc"]["name"]; if (!is_file("$path/".$_FILES["clearence_form_doc"]["name"])) { (move_uploaded_file($_FILES["clearence_form_doc"]["tmp_name"],$path."/".$_FILES["clearence_form_doc"]["name"])); $postdata['clearence_form_doc']=$_FILES["clearence_form_doc"]["name"]; } } else if(isset($postdata['clearence_form_name'])) { $postdata['clearence_form_doc']=""; } if(isset($_FILES['self_declaration_doc']) && $_FILES['self_declaration_doc']['name'] != "") { $_FILES["self_declaration_doc"]["name"]=date("y-m-d-H-i-s").$_FILES["self_declaration_doc"]["name"]; if (!is_file("$path/".$_FILES["self_declaration_doc"]["name"])) { (move_uploaded_file($_FILES["self_declaration_doc"]["tmp_name"],$path."/".$_FILES["self_declaration_doc"]["name"])); $postdata['self_declaration_doc']=$_FILES["self_declaration_doc"]["name"]; } } else if(isset($postdata['self_declaration_name'])) { $postdata['self_declaration_doc']=""; } if(isset($_FILES['settlement_sheet_doc']) && $_FILES['settlement_sheet_doc']['name'] != "") { $_FILES["settlement_sheet_doc"]["name"]=date("y-m-d-H-i-s").$_FILES["settlement_sheet_doc"]["name"]; if (!is_file("$path/".$_FILES["settlement_sheet_doc"]["name"])) { (move_uploaded_file($_FILES["settlement_sheet_doc"]["tmp_name"],$path."/".$_FILES["settlement_sheet_doc"]["name"])); $postdata['settlement_sheet_doc']=$_FILES["settlement_sheet_doc"]["name"]; } } else if(isset($postdata['settlement_sheet_name'])) { $postdata['settlement_sheet_doc']=""; } $data=$this->exitsmodel->$modelfunction($postdata); $data['msg']=$data['msg']; if($data['res']==1) { if(isset($data['alert_id'])) { $alert_id = $data['alert_id']; $this->returntoalert($alert_id); } else { $this->viewinexits($data['resfunction'],$page,'1'); } $this->load->view('message',$data); } else { $this->viewinexits($data['resfunction'],$page,'1'); $this->load->view('message',$data); } } function viewinexits($modelfunction,$page,$pagenum) { /*<---------------- For pagination purpose------------>*/ $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $postdata = $this->get_post_values(); if(isset($postdata['tab_name'])) $postdata =""; /*<---------------- For pagination purpose------------> */ $output=$this->exitsmodel->$modelfunction($postdata,$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['viewinfo']=$output['results']; $this->load->view('Exits/'.$page.'',$data); } function viewinexitssearch($modelfunction,$page,$pagenum) { /*<---------------- For pagination purpose------------>*/ $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; $postdata=$this->get_post_values(); $_SESSION['searchdata']=$postdata; } else { $data['id']= (($pagenum-1)*$perpage)+1; } /*<---------------- For pagination purpose------------> */ if(!isset($_SESSION['searchdata'])) $_SESSION['searchdata']=""; $output=$this->exitsmodel->$modelfunction($pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['viewinfo']=$output['results']; $this->load->view('Exits/'.$page.'',$data); } function edit_page($id,$table,$field,$page,$alert_id='') { if($_SESSION['current_mode']!="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['userid'],1); } else { $perm=1; } if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $data['viewinfo']=$this->mastermodel->get_data_srow($table,$id,$field); $data['id']=$id; $data['alert_id']=$alert_id; $this->load->view('Exits/'.$page,$data); } } function single_page($id,$table,$field,$page,$alert_id='') { if($_SESSION['current_mode']!="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['userid'],0); } else { $perm=1; } if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $data['viewinfo']=$this->mastermodel->get_data_srow($table,$id,$field); $data['id']=$id; $data['alert_id']=$alert_id; $this->load->view('Exits/'.$page,$data); } } function load_page($page) { $this->load->view('Exits/'.$page); } function all_employees() { $q = strtolower($_POST["q"]); if (!$q) return; $employee_list=$this->administrationmodel->get_all_employees(); foreach ($employee_list as $items) { $name = $items['emp_non_full_name']; $emp_non_no= $items['emp_non_no']; $batch= $items['batch_code']; if($emp_non_no[0]==',') { $emp_non_no=substr($emp_non_no, 1); } $emp_non_no = str_replace(',',', ', $emp_non_no); if (strpos(strtolower($name), $q) !== false) { echo '"'.$name.'" - '.$emp_non_no; echo "\n"; } else if (strpos(strtolower($emp_non_no), $q) !== false) { echo '"'.$name.'" - '.$emp_non_no; echo "\n"; } else if (strpos(strtolower($batch), $q) !== false) { echo '"'.$name.'" - '.$emp_non_no; echo "\n"; } } } function get_employee_leave_info($page,$employee_name) { $data=array(); $employee_name = urldecode($employee_name); if(strstr($employee_name, ',') != "") { $emp_num_array = explode(',', $employee_name); $num=count($emp_num_array); $employee_number = $emp_num_array[$num-1]; $employee_number = trim($employee_number," "); } else { $emp_num_array = explode('-', $employee_name); $num=count($emp_num_array); $employee_number = $emp_num_array[$num-1]; $employee_number = trim($employee_number," "); } $data['viewinfo']=$this->exitsmodel->get_employee_info_leave($employee_number); $this->load->view('Exits/'.$page,$data); } function returntoalert($alert_id) { $data['alert_master_id']=$this->mastermodel->getSingleFieldValue('alert','alert_master_id','alert_id',$alert_id); $this->load->view('alert_return',$data); } function get_employee_info($page,$employee_name) { $data=array(); $employee_name = urldecode($employee_name); if(strstr($employee_name, ',') != "") { $emp_num_array = explode(',', $employee_name); $num=count($emp_num_array); $employee_number = $emp_num_array[$num-1]; $employee_number = trim($employee_number," "); } else { $emp_num_array = explode('-', $employee_name); $num=count($emp_num_array); $employee_number = $emp_num_array[$num-1]; $employee_number = trim($employee_number," "); } $data['viewinfo']=$this->administrationmodel->get_employee_info_training($employee_number); $this->load->view('Exits/'.$page,$data); } } /* End of file exits.php */ /* Location: ./application/controllers/exits.php */