?
Current Path : /home1/savoy/www/savoyglobal.net/chess2015open/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/www/savoyglobal.net/chess2015open/application/controllers/admin.php |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?> <?php class Admin extends MY_Controller { public function __construct() { parent::MY_Controller(); $this->load->model('adminmodel'); $this->load->model('mastermodel'); $this->load->library('Fpaginate'); $this->load->library('mail'); } function home() { $_SESSION['admin_page'] = 'home'; $this->load->view('admin/home'); } function registration_details($pagenum = "1") { $_SESSION['admin_page'] = 'registration'; $perpage = $this->config->item('perpage'); $data['pagenum'] = $pagenum; if ($pagenum == 1) { $data['id'] = 1; } else { $data['id'] = (($pagenum - 1) * $perpage) + 1; } $output = $this->mastermodel->getdatas('registration', 'registration_id', 'desc', $pagenum); $data['startpage'] = $output['startpage']; $data['endpage'] = $output['endpage']; $data['registration'] = $output['results']; $this->load->view('admin/registration_details', $data); } function update_registration_details($id = "") { $_SESSION['admin_page'] = 'registration'; if (isset($_POST['savep'])) { $postdata = $this->mastermodel->get_post_values(); $res = $this->adminmodel->update_registration_details($postdata); redirect('admin/registration_details'); } $data['registration'] = $this->mastermodel->get_data_srow('registration', $id, 'registration_id'); $this->load->view('admin/update_registration_details', $data); } function contact_details($pagenum = "1") { $_SESSION['admin_page'] = 'contact'; $perpage = $this->config->item('perpage'); $data['pagenum'] = $pagenum; if ($pagenum == 1) { $data['id'] = 1; } else { $data['id'] = (($pagenum - 1) * $perpage) + 1; } $output = $this->mastermodel->getdatas('contact', 'datetime', 'desc', $pagenum); $data['startpage'] = $output['startpage']; $data['endpage'] = $output['endpage']; $data['registration'] = $output['results']; $this->load->view('admin/contact_details', $data); } function email() { $_SESSION['admin_page'] = 'email'; $this->load->view('admin/email'); } function load_email_list($singles, $doubles, $mixed) { $data['viewinfo'] = $this->adminmodel->get_contacts_list($singles, $doubles, $mixed); $this->load->view('admin/email_list', $data); } function load_sms_list($singles, $doubles, $mixed) { $data['viewinfo'] = $this->adminmodel->get_contacts_list($singles, $doubles, $mixed); $this->load->view('admin/sms_list', $data); } function settings() { $_SESSION['admin_page'] = 'settings'; $this->load->view('admin/settings'); } function update_password() { $_SESSION['admin_page'] = 'settings'; $postdata = $this->mastermodel->get_post_values(); $this->adminmodel->update_password($postdata); $this->load->view('admin/settings'); } public function logout() { session_destroy(); redirect('site/login'); } function delete($table, $field, $id, $function) { $this->mastermodel->deletedata($table, $field, $id); try { $res = $this->mastermodel->deletedata($table, $field, $id); if ($res != 1) { throw new Exception("Error"); } redirect('admin/' . $function); } catch (Exception $exception) { redirect('admin/' . $function); } } function send_email() { $postdata = $this->mastermodel->get_post_values(); $this->adminmodel->send_email($postdata); $data['msg'] = "Email Sent! "; $_SESSION['admin_page'] = 'email_list'; $this->load->view('admin/view-message', $data); } function set_student_status($id, $status, $age) { $count = 1; $data = array(); if ($age < 10) { $count = $this->mastermodel->get_approved_student_count('J'); $reg_code = 'J'. ($count + 1); $category='Age 10 yr and Below'; } else if (10 < $age || $age < 14) { $count = $this->mastermodel->get_approved_student_count('S'); $reg_code = 'S'. ( $count + 1); $category='Age Between 10.1 yr and 14 yr'; } $data['mail_details'] = $this->mastermodel->get_data_srow('registration', $id, 'registration_id'); $parent_email=$data['mail_details']->father_email; $name=$data['mail_details']->name; $data = $this->adminmodel->set_student_status($id, $status, $reg_code,$parent_email,$name,$category); echo $data; } function mail_before_two_days() { $data = array(); $data = $this->mastermodel->mail_before_two_days(); echo $data; } } ?>