?
Current Path : /home1/savoy/public_html/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/public_html/savoyglobal.net/horeitia/application/controllers/administration.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Administration extends MY_Controller { public function __construct() { parent::__construct(); $this->load->model('mastermodel'); $this->load->model('onboardingmodel'); $this->load->model('administrationmodel'); $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 addinadministration($modelfunction,$page) { $postdata=$this->get_post_values(); $path = './assets/uploads'; if(isset($_FILES['cir_document_file']) && $_FILES['cir_document_file']['name'] != "") { $_FILES["cir_document_file"]["name"]=date("y-m-d-H-i-s").$_FILES["cir_document_file"]["name"]; if (!is_file("$path/".$_FILES["cir_document_file"]["name"])) { (move_uploaded_file($_FILES["cir_document_file"]["tmp_name"],$path."/".$_FILES["cir_document_file"]["name"])); $postdata['cir_document_file']=$_FILES["cir_document_file"]["name"]; } } else if(isset($postdata['cir_document_name'])) { $postdata['cir_document_file']=""; } $data=$this->administrationmodel->$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->viewinadministrationsearch($data['resfunction'],$page,'1'); } $this->load->view('message',$data); } else { $this->viewinadministrationsearch($data['resfunction'],$page,'1'); $this->load->view('message',$data); } } function viewinadministrationsearch($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->administrationmodel->$modelfunction($pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['viewinfo']=$output['results']; $this->load->view('Administration/'.$page.'',$data); } function edit_page($id,$table,$field,$page) { 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; $this->load->view('Administration/'.$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('Administration/'.$page,$data); } } function load_page($page) { $this->load->view('Administration/'.$page); } function load_tools($page,$trade_id) { $data['trade_id']=$trade_id; $this->load->view('Administration/'.$page,$data); } function autosuggest_batch() { $q = strtolower($_POST["q"]); if (!$q) return; $employee_list=$this->mastermodel->getdatas('batch','id'); 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 autosuggest($table_name,$field,$value) { $q = strtolower($_POST["q"]); if (!$q) return; $employee_list=$this->administrationmodel->get_alloted_employees_camp($value); 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_site($table_name,$field,$value) { $q = strtolower($_POST["q"]); if (!$q) return; $employee_list=$this->administrationmodel->get_alloted_employees_site($value); 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 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 all_employees_camp($camp_id,$attendance_date) { $q = strtolower($_POST["q"]); if (!$q) return; $employee_list=$this->administrationmodel->get_all_employees_camp($camp_id,$attendance_date); foreach ($employee_list as $items) { $name = $items['emp_non_full_name']; $emp_non_no= $items['emp_non_no']; $batch= $items['batch_code']; $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 load_employees($page,$table,$batch_name,$field,$value) { $batch_name = urldecode($batch_name); $data['table_name'] = $table; $data['field'] = $field; $data['value'] = $value; 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('Administration/'.$page,$data); } function load_employee_emp($page,$table,$employee_name,$field,$value) { $data['table_name'] = $table; $data['field'] = $field; $data['value'] = $value; $data['employee_name'] = $employee_name; $this->load->view('Administration/'.$page,$data); } function load_employees_camp_attendance($page,$camp_id,$attendance_date) { $data=array(); $data['camp_id']=$camp_id; $data['attendance_date']=$attendance_date; $this->load->view('Administration/'.$page,$data); } function load_employees_camp_attendance_edit($page,$camp_id,$date) { $data=array(); $data['camp_id']=$camp_id; $data['viewinfo']=$this->administrationmodel->get_alloted_employees_camp_attendance_edit($camp_id,$date); $this->load->view('Administration/'.$page,$data); } function load_employees_emp_attendance($page,$employee_name,$camp_id,$count,$attendance_date) { $data=array(); $employee_name = urldecode($employee_name); $data['camp_id']=$camp_id; $data['count']=$count; if($employee_name!="" && (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," "); $data['viewinfo']=$this->administrationmodel->get_alloted_employees_camp_empno($camp_id,$batch_id="",$employee_number,$attendance_date); } else { $employee_name = $employee_name; $data['viewinfo']=$this->administrationmodel->get_alloted_employees_camp($camp_id,$batch_id="",$employee_name,$attendance_date); } $this->load->view('Administration/'.$page,$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('Administration/'.$page,$data); } function temp_employee($function, $employee_id) { $this->administrationmodel->$function($employee_id); } function check_employee_attendance($employee_id, $attendance_date) { $attendance_date=$this->mastermodel->convertdateformat($attendance_date); $numtemp = $this->mastermodel->number_rows('temp_employee','employee_id',$employee_id); if($numtemp == 0) $numat = $this->mastermodel->number_rows('employee_absent','employee_id',$employee_id,'attendance_date',$attendance_date); if($numtemp != 0 or $numat != 0) echo 0; else echo 1; } 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_items($page,$employee_name,$alert_id="") { $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; $data['alert_id'] = $alert_id; $this->load->view('Administration/'.$page,$data); } } } /* End of file administration.php */ /* Location: ./application/controllers/administration.php */