?
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/email.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Email extends BaseController { function __construct() { parent::BaseController(); $this->load->model('emailmodel'); $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 viewinemail($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->emailmodel->$modelfunction($postdata,$pagenum); // $data['startpage']=$output['startpage']; // $data['endpage']=$output['endpage']; // $data['viewinfo']=$output['results']; // $this->load->view('Email/'.$page.'',$data); // } // // } function viewinemailsearch($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->emailmodel->$modelfunction($postdata,$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['viewinfo']=$output['results']; $this->load->view('Email/'.$page.'',$data); } function addinemail($modelfunction,$page) { $postdata=$this->get_post_values(); $data=$this->emailmodel->$modelfunction($postdata); if($data['res']==1) { if(!isset($data['msg'])) $data['msg']="Record added Successfully"; $this->viewinemailsearch($data['resfunction'],$page,$_SESSION['pagenum']); $this->load->view('insertsuccess',$data); } else { if(!isset($data['msg'])) $data['msg']="Problem while adding record"; $this->viewinemailsearch($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('Email/edittemplate',$data); } function loademaillist($modelfunction,$page,$pagenum="") { $postdata=$this->get_post_values(); $output=$this->emailmodel->$modelfunction($postdata); if($output['results']!="") { $data['pagenum']=1; $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['viewinfo']=$output['results']; $this->load->view('Email/'.$page,$data); } else { $data['msg']="No records found"; $this->load->view('insertfailure',$data); } } function gettemplatesubj($template_id) { echo $this->mastermodel->getsinglefieldvalue('emailtemplate','template_subject','template_id',$template_id); } function gettemplatecont($template_id) { echo $this->mastermodel->getsinglefieldvalue('emailtemplate','template_contents','template_id',$template_id); } function senddraft($emailid) { $res= $this->emailmodel->senddraft($emailid); if($res==1) { $data['msg']="Message sent successfully"; $this->load->view('Email/emailsucess',$data); } else { $data['msg']="Error..Message not sent"; $this->load->view('Email/emailsucess',$data); } } function singleemailreport($id) { $data['emailreport']=$this->mastermodel->get_data_srow('emailreport',$id,'email_id'); $data['email_receipents']=$this->mastermodel->get_data('email_receipents',$id,'email_id'); $this->load->view('Email/singleemailreport',$data); } }