?
Current Path : /home1/savoy/public_html/savoyglobal.net/sec_old/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/sec_old/application/controllers/master.php |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Master extends MY_Controller { public function __construct() { parent::__construct(); $this->load->model('mastermodel'); $this->load->model('settingsmodel'); $this->load->model('studentmodel'); } public function index($menuid = "", $modid = "", $upload = 0, $msg = "") { $ret = $this->mastermodel->chk_url_permission($menuid); if ($ret != 1) { $menuid = ""; $modid = ""; } if (empty($modid)) { $data['modname'] = 'home'; $data['module_title'] = 'Home'; $data['msg']='Access is restricted'; $this->load->view('message', $data); } else { $mod_id = $this->mastermodel->get_data('module', $modid, 'module_id', 'sort'); foreach ($mod_id as $id) { $modname = $id['module_name']; $module_title = $id['module_title']; } $data['modname'] = $modname; $data['module_title'] = $module_title; } if (empty($menuid)) { $tart = 'index'; $data['menuname'] = ''; $data['men_id'] = $menuid; $data['modulelist'] = $this->mastermodel->getmoduledatamaster(); } else { $tar = $this->mastermodel->get_data('menu', $menuid, 'menu_id'); foreach ($tar as $target) { $tart = $target['target']; $data['menuname'] = $target['caption']; } } $_SESSION['searchdata'] = ""; $_SESSION['current_mode'] = $menuid; $_SESSION['current_module'] = $modid; $_SESSION['modename'] = $data['modname']; $_SESSION['menuname'] = $data['menuname']; $_SESSION['module_title'] = $data['module_title']; $_SESSION['unique_form'] = ''; $data['modules'] = $this->mastermodel->build_module(); $data['submenuchild'] = $this->mastermodel->get_sub_menu_child(); $data['menus'] = $this->mastermodel->build_menu($modid); $output = $this->mastermodel->get_fee_payment_alert(); $data['fee_alert'] = $output; if ($data['modname'] == 'home') $this->load->view($data['modname'] . '/' . $tart . '', $data); else $this->load->view($tart, $data); if ($upload == 1) { if ($msg == 'photo') $data['msg'] = 'Record Added Successfully!'; else $data['msg'] = 'File uploaded successfully!'; $this->load->view('message', $data); } } function student_fee_alert($page,$batch_id) { $output = $this->mastermodel->get_fee_payment_alert($batch_id); $data['fee_alert'] = $output; $this->load->view('home/'.$page, $data); } public function view($folder, $page) { $this->load->view($folder . '/' . $page); } function viewinmastersearch($modelfunction, $page, $pagenum) { $output = $this->mastermodel->$modelfunction($pagenum); $data['viewinfo'] = $output['results']; $this->load->view('master/' . $page . '', $data); } function get_post_values() { $data = array(); foreach ($_POST as $key => $value) { if ($key != "submit") { $data[$key] = $this->input->post($key); } } return $data; } function checkexistencearray($table, $field, $value) { if ($this->mastermodel->checkexistencearray($table, $field, $value) > 0) { echo 1; } else echo 0; } function checkexistence($table, $field, $value) { if ($this->mastermodel->checkexistence($table, $field, $value) > 0) { echo 1; } else echo 0; } function upload_form($controller, $controller_function, $master_id, $return_function, $return_page) { $data = array(); $data['master_id'] = $master_id; $data['return_function'] = $return_function; $data['controller'] = $controller; $data['controller_function'] = $controller_function; $data['return_page'] = $return_page; $this->load->view('master/upload_form', $data); } function submit_upload() { $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.. Access is restricted!"; } else { $postdata['file_location'] = $path . "/" . $_FILES["upload_file"]["name"]; $data = $this->mastermodel->upload_file($postdata); $data['msg'] = "File Uploaded successfully!"; } } else { $data['msg'] = "File already exists"; } redirect("master/index/" . $_SESSION['current_mode'] . '/' . $_SESSION['current_module'] . '/1'); } function deletedata($table, $id, $field) { $data = array(); $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 3); if (!$perm) $data['msg'] = "Access is restricted"; else $data = $this->mastermodel->deletedata($table, $id, $field); $arr = array('msg' => $data['msg'], 'res' => $data['res']); echo json_encode($arr); } function addformdisplay($page, $directory, $return_page = '') { $data = array(); $data['return_page'] = $return_page; $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 1); if (!$perm) { $data['msg'] = "Access is restricted"; $this->load->view('message', $data); } else { $this->load->view('' . $directory . '/' . $page . '', $data); } } function addinmaster($modelfunction, $page) { $data = array(); $postdata = $this->get_post_values(); $data = $this->mastermodel->$modelfunction($postdata); $this->viewinmastersearch($data['resfunction'], $page, $_SESSION['pagenum']); $this->load->view('message', $data); } function single_page($id, $table, $field, $page, $alert_id = '') { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 0); } else { $perm = 1; } if (!$perm) { $data['msg'] = "Access is restricted"; $this->load->view('message', $data); } else { $data['viewinfo'] = $this->mastermodel->get_data_srow($table, $id, $field); $data['id'] = $id; $data['alert_id'] = $alert_id; $this->load->view('master/' . $page, $data); } } function edit_page($id, $table, $field, $page) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 2); } else { $perm = 1; } if (!$perm) { $data['msg'] = "Access is restricted"; $this->load->view('message', $data); } else { $data['viewinfo'] = $this->mastermodel->get_data_srow($table, $id, $field); $data['id'] = $id; $this->load->view('master/' . $page, $data); } } function edit_course($id, $table, $field, $page) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 2); } else { $perm = 1; } if (!$perm) { $data['msg'] = "Access is restricted"; $this->load->view('message', $data); } else { $data['viewinfo'] = $this->mastermodel->get_data_srow($table, $id, $field); $data['details'] = $this->mastermodel->get_data('course_subject', $id, $field); $data['id'] = $id; $this->load->view('master/' . $page, $data); } } function single_contract($id, $table, $field, $page) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 0); } else { $perm = 1; } if (!$perm) { $data['msg'] = "Access is restricted"; $this->load->view('message', $data); } else { $data['viewinfo'] = $this->mastermodel->get_data_srow($table, $id, $field); $data['details'] = $this->mastermodel->get_data('contracting_company_details', $id, $field); $data['id'] = $id; $this->load->view('master/' . $page, $data); } } function checkid($id) { $cod = $this->mastermodel->checkexistence('teacher_subject', 'course_subject_id', $id); $perf = $this->mastermodel->checkexistence('performance_exam_subject', 'course_subject_id', $id); if ($cod == 0 && $perf == 0) { $del = $this->mastermodel->deletsub($id); $data1 = 0; } else { $data1 = 1; } echo $data1; } function checkcodeexistence($code) { $cod = $this->mastermodel->checkexistence('course', 'course_code', $code); echo $cod; } function load_code($id) { $cod = $this->mastermodel->get_single_field_value('course', 'course_code', 'course_id', $id); echo $cod; } function get_batch_code($course_id) { $cod = $this->mastermodel->get_batch_code($course_id); echo $cod; } function get_course_franchisee($course_id) { $course = $this->mastermodel->get_data_joined('franchisee_course', 'course', 'course_id', 'course_id', $course_id, 'franchisee_course.franchisee_id'); echo "<option value=''>Select</option>"; foreach ($course as $items) { echo "<option value=" . $items['course_id'] . ">" . $items['course_name'] . "</option>"; } } function autosuggeststudent() { $q = strtolower($_POST["q"]); if (!$q) return; $student = $this->mastermodel->getdatas('student', 'student_id', 'asc', 'student_id'); foreach ($student as $value) { $f_name = $value['first_name']; $l_name = $value['last_name']; $reg = $value['reg_no']; $id = $value['student_id']; if (strpos(strtolower($f_name), $q) !== false) { echo '' . $f_name . ' ' . $l_name . '-' . $reg . '#' . $id . '#'; echo "\n"; } else if (strpos(strtolower($l_name), $q) !== false) { echo '' . $l_name . ' ' . $f_name . '-' . $reg . '#' . $id . '#'; echo "\n"; } else if (strpos(strtolower($reg), $q) !== false) { echo '' . $reg . ' ' . $f_name . '-' . $l_name . '#' . $id . '#'; echo "\n"; } } } function autosuggestbatch() { $q = strtolower($_POST["q"]); if (!$q) return; $batch_details = $this->mastermodel->get_data('batch', '0', 'close'); foreach ($batch_details as $value) { $batch_code = $value['batch_no']; $batch_id = $value['batch_id']; if (strpos(strtolower($batch_code), $q) !== false) { echo $batch_code . '#' . $batch_id . '#'; echo "\n"; } } } function autosuggestaccount() { $q = strtolower($_POST["q"]); if (!$q) return; $accounts = $this->mastermodel->getdatas('finance_chart_master', 'chart_type_id'); foreach ($accounts as $items) { $name = $items['chart_account_name']; $code = $items['chart_account_code']; if (strpos(strtolower($name), $q) !== false) { echo '' . $name . '-' . $code . '#' . $items['chart_master_id'] . '~' . $code . '~' . $name . '#'; echo "\n"; } else if (strpos(strtolower($code), $q) !== false) { echo '' . $name . '-' . $code . '#' . $items['chart_master_id'] . '~' . $code . '~' . $name . '#'; echo "\n"; } } } function autosuggestbankaccount() { $q = strtolower($_POST["q"]); if (!$q) return; $bankacc = $this->mastermodel->getdatas('finance_bank_account', 'bank_account_id', 'asc', 'bank_account_id'); foreach ($bankacc as $value) { $name = $value['bank_name']; $code = $value['chart_account_code']; if (strpos(strtolower($name), $q) !== false) { echo '' . $name . '-' . $code . '#' . $value['bank_account_id'] . '~' . $value['chart_account_code'] . '~' . $value["bank_name"] . '#'; echo "\n"; } else if (strpos(strtolower($code), $q) !== false) { echo '' . $name . '-' . $code . '#' . $value['bank_account_id'] . '~' . $value['chart_account_code'] . '~' . $value["bank_name"] . '#'; echo "\n"; } } } function autosuggestmainaccount() { $q = strtolower($_POST["q"]); if (!$q) return; $acc_main = $this->mastermodel->get_data('finance_chart_master', '0', 'parent', 'chart_type_id'); foreach ($acc_main as $value) { $name = $value['chart_account_name']; $code = $value['chart_account_code']; if (strpos(strtolower($name), $q) !== false) { echo '' . $name . '-' . $code . '#' . $value['chart_master_id'] . '~' . $value['chart_type_id'] . '#'; echo "\n"; } else if (strpos(strtolower($code), $q) !== false) { echo '' . $name . '-' . $code . '#' . $value['chart_master_id'] . '~' . $value['chart_type_id'] . '#'; echo "\n"; } } } function getStudentDetails($id) { $data = array(); $res = $this->mastermodel->get_data_srow('student', $id, 'student_id'); $data['student_id'] = $id; $data['gender'] = $res->gender; $data['reg_no'] = $res->reg_no; $data['nationality'] = $res->nationality; echo json_encode($data); } function autosuggestemployeenotuser() { $q = strtolower($_POST["q"]); if (!$q) return; $employee_list = $this->mastermodel->get_employee_not_user(); foreach ($employee_list as $items) { $name = $items['employee_name']; $emp_no = $items['employee_no']; if (strpos(strtolower($name), $q) !== false) { echo '' . $name . '-' . $emp_no . '#' . $items['employee_id'] . '#'; echo "\n"; } else if (strpos(strtolower($emp_no), $q) !== false) { echo '' . $name . '-' . $emp_no . '#' . $items['employee_id'] . '#'; echo "\n"; } } } function close_batch($id) { echo $this->mastermodel->close_batch($id); } function reopen_batch($id) { echo $this->mastermodel->reopen_batch($id); } function update_psw($modelfunction) { $postdata = $this->get_post_values(); $data = $this->settingsmodel->$modelfunction($postdata); $data['msg'] = $data['msg']; json_encode($data['msg']); } function autosuggestchartaccount() { $q = strtolower($_POST["q"]); if (!$q) return; $bank_acc_list = $this->mastermodel->get_chart_account(); foreach ($bank_acc_list as $items) { $name = $items['chart_account_name']; $acc_code = $items['chart_account_code']; if (strpos(strtolower($name), $q) !== false) { echo '' . $name . '-' . $acc_code . '#' . $items['chart_master_id'] . '~' . $acc_code . '~' . $name . '#'; echo "\n"; } else if (strpos(strtolower($acc_code), $q) !== false) { echo '' . $name . '-' . $acc_code . '#' . $items['chart_master_id'] . '~' . $acc_code . '~' . $name . '#'; echo "\n"; } } } function remove_fee_alert($student_batch_id) { $remove_status = $this->mastermodel->remove_fee_alert($student_batch_id); } // function autostudentaccount() { // $q = strtolower($_POST["q"]); // if (!$q) // return; // $bank_acc_list = $this->mastermodel->get_student_account(); // foreach ($bank_acc_list as $items) { // // // $name = $items['chart_account_name']; // $acc_code = $items['chart_account_code']; // if (strpos(strtolower($name), $q) !== false) { // echo '' . $name . '-' . $acc_code . '#' . $items['chart_master_id'] . '~' . $acc_code . '~' . $name . '#'; // echo "\n"; // } else if (strpos(strtolower($acc_code), $q) !== false) { // echo '' . $name . '-' . $acc_code . '#' . $items['chart_master_id'] . '~' . $acc_code . '~' . $name . '#'; // echo "\n"; // } // // } // } } /* End of file master.php */ /* Location: ./application/controllers/master.php */