?
Current Path : /home1/savoy/public_html/savoyglobal.net/sims/draft/school/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/sims/draft/school/application/controllers/settings.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Settings extends BaseController { function __construct() { parent::BaseController(); $this->load->model('settingsmodel'); $this->load->model('mastermodel'); $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; } // function viewinsettings($modelfunction,$page,$pagenum="") // { // /*<---------------- For pagination purpose------------>*/ // $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['userid'],0); // if(!$perm) // { // $this->load->view('Settings/nopermission'); // } // else // { // $perpage= $this->config->item('perpage'); // $data['pagenum']=$pagenum; // $_SESSION['searchdata'] = ''; // if($pagenum==1) // { // $data['id']=1; // } // else // { // $data['id']= (($pagenum-1)*$perpage)+1; // } // // // /*<---------------- For pagination purpose------------> */ // if(isset($encoded_data)) // { // $decoded_data= urldecode($encoded_data); // $postdata=json_decode($decoded_data, true); // } // else // { // $postdata=""; // } // // $output=$this->settingsmodel->$modelfunction($postdata,$pagenum); // $data['startpage']=$output['startpage']; // $data['endpage']=$output['endpage']; // $data['viewinfo']=$output['results']; // $this->load->view('Settings/'.$page.'',$data); // } // } function viewinsettingssearch($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(); } /*<---------------- For pagination purpose------------> */ if(!empty ($postdata)) $_SESSION['searchdata']=$postdata; else if(!isset($_SESSION['searchdata'])) $_SESSION['searchdata']=""; $output=$this->settingsmodel->$modelfunction($postdata,$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['viewinfo']=$output['results']; $this->load->view('Settings/'.$page.'',$data); } function addinsettings($modelfunction,$page) { $postdata=$this->get_post_values(); if(isset($postdata['to_upload'])) { $path = './school/uploads/'; if($_FILES['upload_logo']['size'] != 0) { $_FILES["upload_logo"]["name"]=date("Y-m-d-H-i-s").$_FILES["upload_logo"]["name"]; if (!is_file("$path/".$_FILES["upload_logo"]["name"])) { if (!(move_uploaded_file($_FILES["upload_logo"]["tmp_name"],$path."/".$_FILES["upload_logo"]["name"]))) { $data['res']=0; $data['resfunction']='searchexamination'; } else { $postdata['logo']=$path."/".$_FILES["upload_logo"]["name"]; } } else { echo "File already exists"; } } else { $postdata['logo']=$postdata['oldlogo']; } } $data=$this->settingsmodel->$modelfunction($postdata); if($data['res']==1) { if(!isset($data['msg'])) $data['msg']="Record added Successfully"; $this->viewinsettingssearch($data['resfunction'],$page,$_SESSION['pagenum']); $this->load->view('insertsuccess',$data); } else { if(!isset($data['msg'])) $data['msg']="Problem while adding record"; $this->viewinsettingssearch($data['resfunction'],$page,$_SESSION['pagenum']); $this->load->view('insertfailure',$data); } } function editform($controllerfunction,$id) { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['userid'],1); if(!$perm) { $this->load->view('Settings/nopermission'); } else { $this->$controllerfunction($id); } } function edituser($id) { $data['user']=$this->mastermodel->get_data_srow('user',$id,'user_id'); $this->load->view('Settings/edituser',$data); } function editpassword($id) { $data['user']=$this->mastermodel->get_data_srow('user',$id,'user_id'); $this->load->view('Settings/editpassword',$data); } function editterm($id) { $data['term']=$this->mastermodel->get_data_srow('term',$id,'term_id'); $this->load->view('Settings/editterm',$data); } function editacademicyear($id) { $data['ayear']=$this->mastermodel->get_data_srow('academicyear',$id,'ayear'); $this->load->view('Settings/editacademicyear',$data); } function edituserprofile($id) { $data['userprofile']=$this->mastermodel->get_data_srow('user_profiles',$id,'profile_id'); $this->load->view('Settings/edituserprofile',$data); } function singleuserprofile($id) { $data['userprofile']=$this->mastermodel->get_data_srow('user_profiles',$id,'profile_id'); $this->load->view('Settings/singleuserprofile',$data); } function singleclasslevel($id) { $data['classlevel']=$this->mastermodel->get_data_srow('classlevel',$id,'classlevel_id'); $this->load->view('Settings/singleclasslevel',$data); } function viewsubjectsearch($searchtect,$field,$pagenum='1') { /*<---------------- For pagination purpose------------>*/ $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } /*<---------------- For pagination purpose------------> */ $output=$this->settingsmodel->subjectsearch($searchtect,$field,$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['viewinfo']=$output['results']; $this->load->view('Settings/subjsearchresults',$data); } function setcurrentacademicyear($ayear) { $this->settingsmodel->setayear($ayear); } function remove_subject($subject_id) { echo $this->settingsmodel->remove_subject($subject_id); } function checkclassfee($feeterm_id,$classlevel_id) { if($this->settingsmodel->checkclassfee($feeterm_id,$classlevel_id)>0) { echo 1; } } function singlesubject($classlevel_id) { $data['viewinfo']=$this->mastermodel->get_data_srow('classlevel',$classlevel_id,'classlevel_id'); $this->load->view('Settings/singlesubject',$data); } }