?
Current Path : /home1/savoy/public_html/savoyglobal.net/sgms/draft/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/draft/application/controllers/training.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Training extends MY_Controller { public function __construct() { parent::__construct(); $this->load->model('mastermodel'); $this->load->model('settingsmodel'); $this->load->model('trainingmodel'); $this->load->model('accountingmodel'); $this->load->library('Fpaginate'); $this->load->helper('to_pdf'); } 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['sgms_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['sgms_userid'],3); 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 addintraining($modelfunction,$page) { $postdata=$this->get_post_values(); $path = './assets/uploads'; if(isset($_FILES['file_path']) && $_FILES['file_path']['name'] != "") { $_FILES["file_path"]["name"]=date("y-m-d-H-i-s").$_FILES["file_path"]["name"]; if (!is_file("$path/".$_FILES["file_path"]["name"])) { (move_uploaded_file($_FILES["file_path"]["tmp_name"],$path."/".$_FILES["file_path"]["name"])); $postdata['file_path']=$_FILES["file_path"]["name"]; } } else if(isset($postdata['document_name'])) { $postdata['file_path']=""; } // if(isset($_FILES['filename']) && $_FILES['filename']['name'] != "") // { // $_FILES["filename"]["name"]=date("y-m-d-H-i-s").$_FILES["filename"]["name"]; // if (!is_file("$path/".$_FILES["filename"]["name"])) // { // (move_uploaded_file($_FILES["filename"]["tmp_name"],$path."/".$_FILES["filename"]["name"])); // $postdata['proposal_file_location']=$_FILES["filename"]["name"]; // } // } // else if(isset($postdata['training_id'])) // { // $postdata['proposal_file_location']=""; // } $data=$this->trainingmodel->$modelfunction($postdata); $data['msg']=$data['msg']; if($data['res']==1) { $this->viewintrainingsearch($data['resfunction'],$page,$_SESSION['pagenum']); $this->load->view('message',$data); } else { $this->viewintrainingsearch($data['resfunction'],$page,$_SESSION['pagenum']); $this->load->view('message',$data); } } function training_payment() { $postdata=$this->get_post_values(); $data=$this->trainingmodel->insert_registration_training($postdata); if($data['res']==1) { $this->edit_page($data['training_registration_id'], 'training_registration', 'training_registration_id', 'edit_registration_training_payment'); $this->load->view('message',$data); } } function viewintrainingsearch($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->trainingmodel->$modelfunction($pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['viewinfo']=$output['results']; $this->load->view('Training/'.$page.'',$data); } function edit_page($id,$table,$field,$page) { if($_SESSION['current_mode']!="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['sgms_userid'],2); } 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('Training/'.$page,$data); } } function single_page($id,$table,$field,$page) { if($_SESSION['current_mode']!="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['sgms_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; $this->load->view('Training/'.$page,$data); } } function insertevent($title,$start,$end) { $this->trainingmodel->insertcalevent($title,$start,$end); } function get_proposal_info($page,$id) { $data=array(); $data['viewinfo']=$this->mastermodel->get_data_srow('training_proposal_details',$id,'id'); $data['code'] = $this->mastermodel->get_training_quotation_code($id); $this->load->view('Training/'.$page,$data); } function get_quotation_info($page,$training_quotation_id) { $data=array(); $data['viewinfo'] = $this->mastermodel->get_data_srow('training_quotation',$training_quotation_id,'training_quotation_id'); $this->load->view('Training/'.$page,$data); } function get_registration_info($page,$training_registration_id) { $data=array(); $data['viewinfo'] = $this->mastermodel->get_data_srow('training_registration',$training_registration_id,'training_registration_id'); $this->load->view('Training/'.$page,$data); } function quotationslip($id) { $data['quotation']=$this->mastermodel->get_data_srow('training_quotation',$id,'training_quotation_id'); $data['training_quotation_details']=$this->mastermodel->get_data('training_quotation_details',$id,'training_quotation_id'); $this->load->view('Training/quotationslippdf',$data); } function registrationslip($id) { $data['registration']=$this->mastermodel->get_data_srow('training_registration',$id,'training_registration_id'); $data['training_registration_details']=$this->mastermodel->get_data('training_registration_details',$id,'training_registration_id'); $this->load->view('Training/registrationslippdf',$data); } function uploadform($training_id) { $data=array(); $data['training_id']=$training_id; $this->load->view('Training/uploadform',$data); } function submitupload() { $data=array(); $postdata=$this->get_post_values(); $path = './assets/uploads/'; $_FILES["upload_file"]["name"]=date('Y-m-d-h-i-s').$_FILES["upload_file"]["name"]; if (!is_file("$path".$_FILES["upload_file"]["name"])) { if (!(move_uploaded_file($_FILES["upload_file"]["tmp_name"],$path."/".$_FILES["upload_file"]["name"]))) { $data['msg']= "File not uploaded.. Permission denied!"; } else { $postdata['file_location']=$path."/".$_FILES["upload_file"]["name"]; $data=$this->trainingmodel->uploadfile($postdata); $data['msg']= "File Uploaded successfully!"; } } else { $data['msg']= "File already exists"; } $this->load->view('Training/afterupload',$data); } } /* End of file training.php */ /* Location: ./application/controllers/training.php */