?
Current Path : /home1/savoy/www/savoyglobal.net/horeitia/application/controllers/ |
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/employee.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Employee extends MY_Controller { public function __construct() { parent::__construct(); $this->load->model('mastermodel'); $this->load->model('employeemodel'); $this->load->model('administrationmodel'); $this->load->model('employeemodel'); $this->load->library('Fpaginate'); //$this->load->library('employees'); } 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 addinemployee($modelfunction,$page) { $postdata=$this->get_post_values(); $path = './assets/uploads'; if(isset($_FILES['office_employee_photo_doc']) && $_FILES['office_employee_photo_doc']['name'] != "") { $_FILES["office_employee_photo_doc"]["name"]=date("y-m-d-H-i-s").$_FILES["office_employee_photo_doc"]["name"]; if (!is_file("$path/".$_FILES["office_employee_photo_doc"]["name"])) { (move_uploaded_file($_FILES["office_employee_photo_doc"]["tmp_name"],$path."/".$_FILES["office_employee_photo_doc"]["name"])); $postdata['office_employee_photo_doc']=$_FILES["office_employee_photo_doc"]["name"]; } } else if(isset($postdata['office_employee_photo_name'])) { $postdata['office_employee_photo_doc']=""; } if(isset($_FILES['attestment_doc']) && $_FILES['attestment_doc']['name'] != "") { $_FILES["attestment_doc"]["office_employee_application_form_doc"]=date("y-m-d-H-i-s").$_FILES["office_employee_application_form_doc"]["name"]; if (!is_file("$path/".$_FILES["attestment_doc"]["name"])) { (move_uploaded_file($_FILES["office_employee_application_form_doc"]["tmp_name"],$path."/".$_FILES["office_employee_application_form_doc"]["name"])); $postdata['office_employee_application_form_doc']=$_FILES["office_employee_application_form_doc"]["name"]; } } else if(isset($postdata['office_employee_application_form_name'])) { $postdata['office_employee_application_form_doc']=""; } if(isset($_FILES['office_employee_offer_letter_doc']) && $_FILES['office_employee_offer_letter_doc']['name'] != "") { $_FILES["office_employee_offer_letter_doc"]["name"]=date("y-m-d-H-i-s").$_FILES["office_employee_offer_letter_doc"]["name"]; if (!is_file("$path/".$_FILES["office_employee_offer_letter_doc"]["name"])) { (move_uploaded_file($_FILES["office_employee_offer_letter_doc"]["tmp_name"],$path."/".$_FILES["office_employee_offer_letter_doc"]["name"])); $postdata['office_employee_offer_letter_doc']=$_FILES["office_employee_offer_letter_doc"]["name"]; } } else if(isset($postdata['office_employee_offer_letter_name'])) { $postdata['office_employee_offer_letter_doc']=""; } if(isset($_FILES['office_employee_other_doc_doc']) && $_FILES['office_employee_other_doc_doc']['name'] != "") { $_FILES["office_employee_other_doc_doc"]["name"]=date("y-m-d-H-i-s").$_FILES["office_employee_other_doc_doc"]["name"]; if (!is_file("$path/".$_FILES["office_employee_other_doc_doc"]["name"])) { (move_uploaded_file($_FILES["office_employee_other_doc_doc"]["tmp_name"],$path."/".$_FILES["office_employee_other_doc_doc"]["name"])); $postdata['office_employee_other_doc_doc']=$_FILES["office_employee_other_doc_doc"]["name"]; } } else if(isset($postdata['office_employee_other_doc_name'])) { $postdata['office_employee_other_doc_doc']=""; } if(isset($_FILES['office_exit_clearence_form_doc']) && $_FILES['office_exit_clearence_form_doc']['name'] != "") { $_FILES["office_exit_clearence_form_doc"]["name"]=date("y-m-d-H-i-s").$_FILES["office_exit_clearence_form_doc"]["name"]; if (!is_file("$path/".$_FILES["office_exit_clearence_form_doc"]["name"])) { (move_uploaded_file($_FILES["office_exit_clearence_form_doc"]["tmp_name"],$path."/".$_FILES["office_exit_clearence_form_doc"]["name"])); $postdata['office_exit_clearence_form_doc']=$_FILES["office_exit_clearence_form_doc"]["name"]; } } else if(isset($postdata['office_exit_clearence_form_name'])) { $postdata['office_exit_clearence_form_doc']=""; } if(isset($_FILES['office_exit_resignation_letter_doc']) && $_FILES['office_exit_resignation_letter_doc']['name'] != "") { $_FILES["office_exit_resignation_letter_doc"]["name"]=date("y-m-d-H-i-s").$_FILES["office_exit_resignation_letter_doc"]["name"]; if (!is_file("$path/".$_FILES["office_exit_resignation_letter_doc"]["name"])) { (move_uploaded_file($_FILES["office_exit_resignation_letter_doc"]["tmp_name"],$path."/".$_FILES["office_exit_resignation_letter_doc"]["name"])); $postdata['office_exit_resignation_letter_doc']=$_FILES["office_exit_resignation_letter_doc"]["name"]; } } else if(isset($postdata['office_exit_resignation_letter_name'])) { $postdata['office_exit_resignation_letter_doc']=""; } if(isset($_FILES['office_exit_relieving_letter_doc']) && $_FILES['office_exit_relieving_letter_doc']['name'] != "") { $_FILES["office_exit_relieving_letter_doc"]["name"]=date("y-m-d-H-i-s").$_FILES["office_exit_relieving_letter_doc"]["name"]; if (!is_file("$path/".$_FILES["office_exit_relieving_letter_doc"]["name"])) { (move_uploaded_file($_FILES["office_exit_relieving_letter_doc"]["tmp_name"],$path."/".$_FILES["office_exit_relieving_letter_doc"]["name"])); $postdata['office_exit_relieving_letter_doc']=$_FILES["office_exit_relieving_letter_doc"]["name"]; } } else if(isset($postdata['office_exit_relieving_letter_name'])) { $postdata['office_exit_relieving_letter_doc']=""; } $data=$this->employeemodel->$modelfunction($postdata); $data['msg']=$data['msg']; if($data['res']==1) { $this->viewinemployee($data['resfunction'],$page,'1'); $this->load->view('message',$data); } else { $this->viewinemployee($data['resfunction'],$page,'1'); $this->load->view('message',$data); } } function viewinemployee($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->employeemodel->$modelfunction($postdata,$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['viewinfo']=$output['results']; $this->load->view('Employee/'.$page.'',$data); } function viewinemployeesearch($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->employeemodel->$modelfunction($pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['viewinfo']=$output['results']; $this->load->view('Employee/'.$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('Employee/'.$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('Employee/'.$page,$data); } } function all_employees_office() { $q = strtolower($_POST["q"]); if (!$q) return; $employee_list=$this->employeemodel->get_all_employees_office(); foreach ($employee_list as $items) { $name = $items['office_employee_name']; $no= $items['office_employee_no']; if (strpos(strtolower($name), $q) !== false) { echo '"'.$name.'" <'.$no.'>'; echo "\n"; } else if (strpos(strtolower($no), $q) !== false) { echo '"'.$name.'" <'.$no.'>'; echo "\n"; } } } } /* End of file employee.php */ /* Location: ./application/controllers/employee.php */