?
Current Path : /home1/savoy/public_html/savoyglobal.net/sims/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/school/application/controllers/sms.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class sms extends BaseController { function __construct() { parent::BaseController(); $this->load->model('smsmodel'); $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 viewinsms($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; // } // $_SESSION['searchdata']=""; // // /*<---------------- For pagination purpose------------> */ // if(isset($encoded_data)) // { // $decoded_data= urldecode($encoded_data); // $postdata=json_decode($decoded_data, true); // } // else // { // $postdata=""; // } // // $output=$this->smsmodel->$modelfunction($postdata,$pagenum); // $data['startpage']=$output['startpage']; // $data['endpage']=$output['endpage']; // $data['viewinfo']=$output['results']; // $this->load->view('Sms/'.$page.'',$data); // } // // } function viewinsmssearch($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->smsmodel->$modelfunction($postdata,$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['viewinfo']=$output['results']; $this->load->view('Sms/'.$page.'',$data); } function addinsms($modelfunction,$page) { $postdata=$this->get_post_values(); $data=$this->smsmodel->$modelfunction($postdata); if($data['res']==1) { if(!isset($data['msg'])) $data['msg']="Record added Successfully"; $this->viewinsmssearch($data['resfunction'],$page,$_SESSION['pagenum']); $this->load->view('insertsuccess',$data); } else { if(!isset($data['msg'])) $data['msg']="Problem while adding record"; $this->viewinsmssearch($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 edittemplate($id) { $data['template']=$this->mastermodel->get_data_srow('template',$id,'template_id'); $this->load->view('Sms/edittemplate',$data); } function loadsmslist($modelfunction,$page,$pagenum="") { $postdata=$this->get_post_values(); $output=$this->smsmodel->$modelfunction($postdata); if($output['results']!="") { $data['pagenum']=1; $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['viewinfo']=$output['results']; $this->load->view('Sms/'.$page,$data); } else { $data['msg']="No records found"; $this->load->view('insertfailure',$data); } } function gettemplate($template_id) { echo $this->mastermodel->getsinglefieldvalue('template','content','template_id',$template_id); } function senddraft($smsid) { $res= $this->smsmodel->senddraft($smsid); if($res==1) { $data['msg']="Message sent successfully"; $this->load->view('Sms/smssucess',$data); } else { $data['msg']="Error..Message not sent"; $this->load->view('Sms/smssucess',$data); } } }