?
Current Path : /home1/savoy/public_html/savoyglobal.net/sgms/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/public_html/savoyglobal.net/sgms/application/controllers/onboarding.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Onboarding extends MY_Controller { public function __construct() { parent::__construct(); $this->load->model('mastermodel'); $this->load->model('onboardingmodel'); $this->load->model('administrationmodel'); $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 addinonboarding($modelfunction,$page) { $postdata=$this->get_post_values(); $path = './assets/uploads'; if(isset($_FILES['agreement_doc']) && $_FILES['agreement_doc']['name'] != "") { $_FILES["agreement_doc"]["name"]=date("y-m-d-H-i-s").$_FILES["agreement_doc"]["name"]; if (!is_file("$path/".$_FILES["agreement_doc"]["name"])) { (move_uploaded_file($_FILES["agreement_doc"]["tmp_name"],$path."/".$_FILES["agreement_doc"]["name"])); $postdata['agreement_doc']=$_FILES["agreement_doc"]["name"]; } } else if(isset($postdata['agreement_name'])) { $postdata['agreement_doc']=""; } if(isset($_FILES['attestment_doc']) && $_FILES['attestment_doc']['name'] != "") { $_FILES["attestment_doc"]["name"]=date("y-m-d-H-i-s").$_FILES["attestment_doc"]["name"]; if (!is_file("$path/".$_FILES["attestment_doc"]["name"])) { (move_uploaded_file($_FILES["attestment_doc"]["tmp_name"],$path."/".$_FILES["attestment_doc"]["name"])); $postdata['attestment_doc']=$_FILES["attestment_doc"]["name"]; } } else if(isset($postdata['attestment_name'])) { $postdata['attestment_doc']=""; } if(isset($_FILES['photo_doc']) && $_FILES['photo_doc']['name'] != "") { $config['upload_path'] = './assets/uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['overwrite'] = false; $config['remove_spaces'] = true; $this->load->library('upload'); $this->load->library('image_lib'); $this->upload->initialize($config); if(!$this->upload->do_upload('photo_doc')) { echo $this->upload->display_errors('<p class="error">', '</p>'); } else { $file_data = $this->upload->data(); $postdata['photo_doc']=$file_data['file_name']; $configimg['source_image'] = $this->upload->upload_path.$file_data['file_name']; $configimg['maintain_ratio'] = FALSE; $configimg['width'] = 160; $configimg['height'] =200; $this->image_lib->initialize($configimg); if(!$this->image_lib->resize()) { echo $this->image_lib->display_errors('<p class="error">', '</p>'); } } // $_FILES["photo_doc"]["name"]=date("y-m-d-H-i-s").$_FILES["photo_doc"]["name"]; // if (!is_file("$path/".$_FILES["photo_doc"]["name"])) // { // (move_uploaded_file($_FILES["photo_doc"]["tmp_name"],$path."/".$_FILES["photo_doc"]["name"])); // $postdata['photo_doc']=$_FILES["photo_doc"]["name"]; // } } else if(isset($postdata['photo_doc_name'])) { $postdata['photo_doc']=""; } $data=$this->onboardingmodel->$modelfunction($postdata); $data['msg']=$data['msg']; if($data['res']==1) { if(isset($data['batch_id'])) { $batch_id = $data['batch_id']; $batch_date = $data['batch_date']; $this->newaddpage($batch_id,$batch_date,'add_employee_joining'); } else if(isset($data['alert_id'])) { $alert_id = $data['alert_id']; $this->returntoalert($alert_id); } else { $this->viewinonboardingsearch($data['resfunction'],$page,'1'); } $this->load->view('message',$data); } else { $this->viewinonboardingsearch($data['resfunction'],$page,'1'); $this->load->view('message',$data); } } function viewinonboardingsearch($modelfunction,$page,$pagenum) { /*<---------------- For pagination purpose------------>*/ $perpage= $this->config->item('perpage'); $_SESSION['pagenum']=$pagenum; $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } if(isset($_POST['tab_name'])) { $postdata =""; } else { $postdata=$this->get_post_values(); } if(!empty ($postdata)) $_SESSION['searchdata']=$postdata; else if(!isset($_SESSION['searchdata'])) $_SESSION['searchdata']=""; /*<---------------- For pagination purpose------------> */ $output=$this->onboardingmodel->$modelfunction($pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['viewinfo']=$output['results']; $this->load->view('Onboarding/'.$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('Onboarding/'.$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('Onboarding/'.$page,$data); } } function newaddpage($id,$batch_date,$page) { $data['batch_id']=$id; $data['date_joining']=$batch_date; $this->load->view('Onboarding/'.$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 load_page($page) { $this->load->view('Onboarding/'.$page); } function load_items($page,$employee_name) { $employee_name = urldecode($employee_name); if($employee_name!="" && (strstr($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['employee_no'] = $employee_number; $this->load->view('Onboarding/'.$page,$data); } } function load_employees($page,$table,$batch_name) { $batch_name = urldecode($batch_name); $data['table_name'] = $table; if($batch_name!="" && (strstr($batch_name, '<') != "")) { $no_array = explode('<', $batch_name); $data['batch_code'] = trim($no_array['1'],">"); } else { $data['batch_code'] = $batch_name; } $this->load->view('Onboarding/'.$page,$data); } function load_employee_emp($page,$table,$employee_name) { $employee_name = urldecode($employee_name); $data['table_name'] = $table; if($employee_name!="" && (strstr($employee_name, '-') != "")) { $emp_array = explode('"', $employee_name); $employee_name = $emp_array[1]; $data['employee_name'] = $employee_name; } else { $data['employee_name'] = $employee_name; } $this->load->view('Onboarding/'.$page,$data); } function search_employees_popupup_function($search_field,$search_text) { $output=$this->onboardingmodel->search_employee_popup($search_field,$search_text); $data['viewinfo']=$output['results']; $this->load->view('Onboarding/view_employee_list_popup',$data); } function autosuggest($table_name,$allotment_date="") { $q = strtolower($_POST["q"]); if (!$q) return; $employee_list=$this->onboardingmodel->get_unalloted_employees($table_name,'','',$allotment_date); 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 autosuggest_batch($allotment_date="") { $q = strtolower($_POST["q"]); if (!$q) return; $employee_list=$this->mastermodel->get_batch($allotment_date); foreach ($employee_list as $items) { $date = $this->mastermodel->convertdatenormalformat($items['batch_date']); $batch_code= $items['batch_code']; if (strpos(strtolower($date), $q) !== false) { echo '"'.$date.'" <'.$batch_code.'>'; echo "\n"; } else if (strpos(strtolower($batch_code), $q) !== false) { echo '"'.$date.'" <'.$batch_code.'>'; echo "\n"; } } } function calculate_expiry_date($allotment_date,$shelf_life) { echo date("d-m-Y", strtotime(date("d-m-Y", strtotime($allotment_date)) . " +$shelf_life day"));; } function camp_allotment_alert($employee_id,$alert_id) { $data=array(); $data['viewinfo']=$this->administrationmodel->get_emp_info($employee_id); $data['camp']=$this->mastermodel->getdatas('camp','camp_name'); $data['alert_id']=$alert_id; $this->load->view('Onboarding/camp_allotment_alert',$data); } function site_allotment_alert($employee_id,$alert_id) { $data=array(); $data['viewinfo']=$this->administrationmodel->get_emp_info($employee_id); $data['site']=$this->mastermodel->getdatas('site','site_name'); $data['alert_id']=$alert_id; $this->load->view('Onboarding/site_allotment_alert',$data); } function shan() { //$this->mastermodel->update_visatemp(); } } /* End of file onboarding.php */ /* Location: ./application/controllers/onboarding.php */