? Fallagassrini

Fallagassrini Bypass Shell

echo"
Fallagassrini
";
Current Path : /home1/savoy/www/savoyglobal.net/oscardraft/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
Upload File :
Current File : /home1/savoy/www/savoyglobal.net/oscardraft/application/controllers/student.php

<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Student extends MY_Controller
{

    public function __construct()
    {
        parent::__construct();
        $this->load->model('mastermodel');
        $this->load->model('studentmodel');
        $this->load->model('accountingmodel');
        $this->load->helper('to_pdf');
    }

    function get_post_values()
    {
        $data = array();
        foreach ($_POST as $key => $value)
        {
            if ($key != "submit")
            {
                $data[$key] = $this->input->post($key);
            }
        }
        return $data;
    }

    function viewinstudentsearch($modelfunction, $page, $pagenum)
    {
        $output = $this->studentmodel->$modelfunction($pagenum);
        $data['viewinfo'] = $output['results'];
        
        $_SESSION['res_function'] = $modelfunction;
        $this->load->view('student/' . $page . '', $data);
    }

    function addformdisplay($page, $directory, $return_page = '')
    {
        $data = array();
        $data['return_page'] = $return_page;
        $perm = $this->studentmodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 1);
        if (!$perm)
        {
            $data['msg'] = "Permission Denied";
            $this->load->view('message', $data);
        } else
        {
            $this->load->view('' . $directory . '/' . $page . '', $data);
        }
    }

    function addinstudent($modelfunction, $page)
    {
        $data = array();
        $postdata = $this->get_post_values();
        $data = $this->studentmodel->$modelfunction($postdata);
        $this->viewinstudentsearch($data['resfunction'], $page, $_SESSION['pagenum']);
        $this->load->view('message', $data);
    }

    function student_add($modelfunction, $page)
    {
        $data = array();
        $postdata = $this->get_post_values();
        $path = './assets/uploads/student_photo';
        $file_name = date("Y-m-d-H-i-s");
        $extension = pathinfo($_FILES["attach_photo"]["name"], PATHINFO_EXTENSION);
        $image_file = $file_name . '.' . $extension;
        if (isset($_FILES['attach_photo']) && $_FILES['attach_photo']['name'] != "")
        {
            $_FILES['attach_photo']['name'] = $image_file;
            if (!is_file("$path/" . $_FILES["attach_photo"]["name"]))
            {
                if (move_uploaded_file($_FILES["attach_photo"]["tmp_name"], $path . "/" . $_FILES["attach_photo"]["name"]))
                {
                    $postdata['attach_photo'] = $_FILES["attach_photo"]["name"];
                }
            } else
            {
                echo "File already exists";
                $postdata['attach_photo'] = '';
            }
        } else
        {
            $postdata['attach_photo'] = "";
        }
        $data = $this->studentmodel->$modelfunction($postdata);
        $msg = 'photo';

        redirect("master/index/" . $_SESSION['current_mode'] . '/' . $_SESSION['current_module'] . '/1/' . $msg);
    }
    
    function deletedata($table, $id, $field)
    {
        $data = array();
        $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 3);
        if (!$perm)
            $data['msg'] = "Permission Denied";
        else
            $data = $this->mastermodel->deletedata($table, $id, $field);
        $arr = array('msg' => $data['msg'], 'res' => $data['res']);
        echo json_encode($arr);
    }

    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'] = "Permission Denied";
            $this->load->view('message', $data);
        } else
        {
            $data['viewinfo'] = $this->mastermodel->get_data_srow($table, $id, $field);
            $data['id'] = $id;
            $this->load->view('student/' . $page, $data);
        }
    }

    function edit_student($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'] = "Permission Denied";
            $this->load->view('message', $data);
        } else
        {
            $data['student'] = $this->mastermodel->get_data_srow_joined('student', 'parent_student', 'student_id', 'student_id', $id, 'student.student_id');
            $data['parent'] = $this->mastermodel->get_data_srow('parent', $data['student']->parent_id, 'parent_id');
            $data['id'] = $id;
            $this->load->view('student/' . $page, $data);
        }
    }

    function single_student_class($class_name_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'] = "Permission Denied";
            $this->load->view('message', $data);
        } else
        {
            $data['viewinfo'] = $this->mastermodel->get_data_srow_joined('class_name', 'class_room', 'class_room_id', 'class_room_id', $class_name_id, $field);
            $class_name_id = $class_name_id;
            $data['class_students'] = $this->studentmodel->get_student_class_allocation_details($class_name_id);
            $data['cancelled_student'] = $this->studentmodel->get_cancelled_student($class_name_id);
            $data['deactivate_student'] = array();
            $data['id'] = $class_name_id;
            $this->load->view('student/' . $page, $data);
        }
    }
    function load_class_fee_details($class_name_id,$no_days)
    {
        $data['class_details'] = $this->studentmodel->get_class_name_details($class_name_id);
        $data['class_name_id'] = $data['class_details']->class_name_id;
        $term = $data['class_details']->class_term_id;
        $session = $data['class_details']->class_session;
        $academic_year = $data['class_details']->class_name_academic_year_id;
        $data['fee_deatils'] = $this->studentmodel->load_student_fee_details($academic_year, $session, $no_days, $term);
        $data['term'] = $term;
        $data['academic_year'] = $academic_year;
        $this->load->view('student/load_class_fee_details', $data);
    }
    function student_class_details($class_name_id, $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'] = "Permission Denied";
            $this->load->view('message', $data);
        } else
        {
            $data['class_details'] = $this->studentmodel->get_class_name_details($class_name_id);
            $data['class_students'] = $this->studentmodel->get_student_class_allocation_details($class_name_id);
            $data['cancelled_student'] = $this->studentmodel->get_cancelled_student($class_name_id);
            $data['deactivate_student'] = array();
            $data['id'] = $class_name_id;
            $this->load->view('student/' . $page, $data);
        }
    }

    function edit_student_fee($student_class_id, $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'] = "Permission Denied";
            $this->load->view('message', $data);
        } else
        {
            $data['class_details'] = $this->studentmodel->get_student_class_details($student_class_id);
            $data['term'] = $data['class_details']->class_term_id;
            $data['academic_year_id'] = $data['class_details']->class_name_academic_year_id;
            $student_id = $data['class_details']->student_id;
            $data['student_fee_details'] = $this->studentmodel->get_student_fee_details($student_class_id);
            $data['student_monthly_fee_details'] = $this->studentmodel->get_student_monthly_fee_details($student_class_id);
            $data['student_class_id'] = $student_class_id;
            $this->load->view('student/' . $page, $data);
        }
    }

    function edit_fee($id, $table, $field, $page)
    {
        $data = array();
        if ($_SESSION['current_mode'] != "")
        {
            $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 2);
        } else
        {
            $perm = 1;
        }

        if (!$perm)
        {
            $data['msg'] = "Permission Denied";
            $this->load->view('message', $data);
        } else
        {

            $data['viewinfo'] = $this->mastermodel->get_data_srow_joined($table, 'student_class', 'student_class_id', 'student_class_id', $id, $field);
            $student_class_id = $data['viewinfo']->student_class_id;
            $student_id = $data['viewinfo']->student_id;
            $data['student_class_details'] = $this->studentmodel->get_student_class_details($student_class_id);
            $data['term'] = $data['student_class_details']->class_term_id;
            $data['academic_year'] = $this->mastermodel->get_single_field_value('academic_year', 'academic_year_year', 'academic_year_id', $data['student_class_details']->class_name_academic_year_id);
            $data['student_fee_details'] = $this->studentmodel->get_student_fee_details($student_class_id);
            $data['student_monthly_fee_details'] = $this->studentmodel->get_student_monthly_wef_date($student_class_id, date('d-m-Y'));
            $data['student_fee_paid_details'] = $this->studentmodel->get_student_fee_paid_details($student_class_id);
            $data['fee_last_paid_details'] = $this->mastermodel->get_data('fee_paid_details', $id, 'fee_id');
            $data['id'] = $id;
            $this->load->view('student/' . $page, $data);
        }
    }

    function getStudentFeeDetails($student_class_id, $student_id)
    {
        $data['student_class_details'] = $this->studentmodel->get_student_class_details($student_class_id);
        $data['term'] = $data['student_class_details']->class_term_id;
        $data['academic_year'] = $this->mastermodel->get_single_field_value('academic_year', 'academic_year_year', 'academic_year_id', $data['student_class_details']->class_name_academic_year_id);
        $data['student_fee_details'] = $this->studentmodel->get_student_fee_details($student_class_id);
        $data['student_monthly_fee_details'] = $this->studentmodel->get_student_monthly_wef_date($student_class_id, date('d-m-Y'));
        $data['student_fee_paid_details'] = $this->studentmodel->get_student_fee_paid_details($student_class_id);
        $this->load->view('student/student_fee_details', $data);
    }

    function getStudentFeeDetailsUnposted($student_class_id, $student_id)
    {
        $data['student_class_details'] = $this->studentmodel->get_student_class_details($student_class_id);
        $data['term'] = $data['student_class_details']->class_term_id;
        $data['academic_year'] = $this->mastermodel->get_single_field_value('academic_year', 'academic_year_year', 'academic_year_id', $data['student_class_details']->class_name_academic_year_id);
        $data['student_fee_details'] = $this->studentmodel->get_student_fee_details($student_class_id);
        $data['student_monthly_fee_details'] = $this->studentmodel->get_student_monthly_wef_date($student_class_id, date('d-m-Y'));
        $data['student_fee_paid_details'] = $this->studentmodel->get_student_fee_paid_details($student_class_id);
        $this->load->view('student/student_fee_details_unposted', $data);
    }

    function single_page($id, $table, $field, $page, $return_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'] = "Permission Denied";
            $this->load->view('message', $data);
        } else
        {
            $data['viewinfo'] = $this->mastermodel->get_data_srow($table, $id, $field);
            $data['id'] = $id;
            $this->load->view('student/' . $page, $data);
        }
    }

    function single_student($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'] = "Permission Denied";
            $this->load->view('message', $data);
        } else
        {
            
            $data['student'] = $this->mastermodel->get_data_srow_joined('student', 'parent_student', 'student_id', 'student_id', $id, 'student.student_id');
            $data['parent'] = $this->mastermodel->get_data_srow('parent', $data['student']->parent_id, 'parent_id');
            $data['student_class'] = $this->mastermodel->get_data('student_class' , $data['student']->student_id , 'student_id');
            $this->load->view('student/' . $page, $data); 
        }
    }

    function student_fee_details($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'] = "Permission Denied";
            $this->load->view('message', $data);
        } else
        {
            $data['viewinfo'] = $this->mastermodel->get_data_srow_joined('fee', 'student_class', 'student_class_id', 'student_class_id', $id, 'student_class.student_class_id');
            $student_class_id = $data['viewinfo']->student_class_id;
            $student_id = $data['viewinfo']->student_id;
            $data['student_class_details'] = $this->studentmodel->get_student_class_details($student_class_id);
            $data['term'] = $data['student_class_details']->class_term_id;
            $data['academic_year'] = $this->mastermodel->get_single_field_value('academic_year', 'academic_year_year', 'academic_year_id', $data['student_class_details']->class_name_academic_year_id);
            $data['student_fee_details'] = $this->studentmodel->get_student_fee_details($student_class_id);
            $data['student_monthly_fee_details'] = $this->studentmodel->get_student_monthly_wef_date($student_class_id, date('d-m-Y'));
            $data['student_fee_paid_details'] = $this->studentmodel->get_student_fee_paid_details($student_class_id);
            $data['fee_last_paid_details'] = $this->mastermodel->get_data('fee_paid_details', $id, 'fee_id');
            $data['id'] = $id;
            $data['id'] = $id;
            $this->load->view('home/' . $page, $data);
        }
    }

    function single_fee($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'] = "Permission Denied";
            $this->load->view('message', $data);
        } else
        {
            $data['viewinfo'] = $this->mastermodel->get_data_srow_joined($table, 'student_class', 'student_class_id', 'student_class_id', $id, $field);
            $student_class_id = $data['viewinfo']->student_class_id;
            $student_id = $data['viewinfo']->student_id;
            $data['student_class_details'] = $this->studentmodel->get_student_class_details($student_class_id);
            $data['term'] = $data['student_class_details']->class_term_id;
            $data['academic_year'] = $this->mastermodel->get_single_field_value('academic_year', 'academic_year_year', 'academic_year_id', $data['student_class_details']->class_name_academic_year_id);
            $data['student_fee_details'] = $this->studentmodel->get_student_fee_details($student_class_id);
            $date = date('d-m-Y');
            $data['student_monthly_fee_details'] = $this->studentmodel->get_student_monthly_wef_date($student_class_id, $date);
            $data['student_fee_paid_details'] = $this->studentmodel->get_student_fee_paid_details($student_class_id);
            $data['fee_last_paid_details'] = $this->mastermodel->get_data('fee_paid_details', $id, 'fee_id');
            $data['id'] = $id;
            $this->load->view('student/' . $page, $data);
        }
    }

    function load_parents($father = '', $mother = '', $qatar = '')
    {
        $father = urldecode($father);
        $mother = urldecode($mother);
        $qatar = urldecode($qatar);
        $data['viewinfo'] = $this->studentmodel->get_parents_details($father, $mother, $qatar);
        $this->load->view('student/parents_details', $data);
    }

    function load_student_details($id)
    {
        $class_code = $this->studentmodel->get_classes($id);
        $student = $this->mastermodel->get_data_srow_joined('student', 'nationality', 'nationality_id', 'nationality_id', $id, 'student_id');
       
        $data['class_code'] = $class_code;
        $data['reg_no'] = $student->reg_no;
        $data['gender'] = $student->gender;
        $data['nationality'] = $student->nationality_name;
        echo json_encode($data);
    }

    function load_students($student_id, $index, $class_name_id)
    {
        $data = array();
        $data['viewinfo'] = $this->mastermodel->get_data_srow('student', $student_id, 'student_id');
        $data['fee'] = $this->mastermodel->getdatas('fee_term');
        $data['index'] = $index;
        $data['student_class_id'] = $this->studentmodel->get_student_class_id($student_id, $class_name_id);
        $this->load->view('student/student_details', $data);
    }

    function load_student_fee_details($class_name_id, $student_id, $academic_year, $session, $no_days, $term)
    {
        $data['no_days'] = $no_days;
        $data['term'] = $term;
        $data['academic_year'] = $academic_year;
        $data['student_class_id'] = $this->studentmodel->get_student_class_id($class_name_id, $student_id);
        $data['fee_deatils'] = $this->studentmodel->load_student_fee_details($academic_year, $session, $no_days, $term);
        $this->load->view('student/load_student_fee_details', $data);
    }

    function get_fee_details($fee_details_id, $payment_type)
    {
        $fee_details = $this->mastermodel->get_data_srow('fee_term_details', $fee_details_id, 'id');
        if ($payment_type == 'monthly')
        {
            echo json_encode($fee_details->fee_month_amount);
        } else
        {
            echo json_encode($fee_details->fee_term_amount);
        }
    }

    function get_class_details($class_id)
    {
        $class = $this->mastermodel->get_data_srow('class_name', $class_id, 'class_name_id');
        $data = array();
        $data['class_name_id'] = $class->class_name_id;
        $data['class_name'] = $class->class_name_code;

        $start_time = explode(":", $class->class_start_time);
        $end_time = explode(":", $class->class_end_time);
        $r = range(0, 23);
        $minutes = range(0, 59);
        $select = "";
        foreach ($r as $hour)
        {
            $select .= "<option value=\"$hour\"";
            $select .= ($hour == $start_time[0]) ? ' selected="selected"' : '';
            $select .= ">" . str_pad($hour, 2, '0', STR_PAD_LEFT) . "</option>\n";
        }
        $start_time_m = "";
        foreach ($minutes as $min)
        {
            $start_time_m .= "<option value=\"$min\"";
            $start_time_m .= ($min == $start_time[1]) ? ' selected="selected"' : '';
            $start_time_m .= ">" . str_pad($min, 2, '0', STR_PAD_LEFT) . "</option>\n";
        }
        $end_time_h = "";
        foreach ($r as $hour)
        {
            $end_time_h .= "<option value=\"$hour\"";
            $end_time_h .= ($hour == $end_time[0]) ? ' selected="selected"' : '';
            $end_time_h .= ">" . str_pad($hour, 2, '0', STR_PAD_LEFT) . "</option>\n";
        }
        $end_time_minut = "";
        foreach ($minutes as $min)
        {
            $end_time_minut .= "<option value=\"$min\"";
            $end_time_minut .= ($min == $end_time[1]) ? ' selected="selected"' : '';
            $end_time_minut .= ">" . str_pad($min, 2, '0', STR_PAD_LEFT) . "</option>\n";
        }
        $data['start_time_hour'] = $select;

        $data['start_time_minute'] = $start_time_m;
        $data['end_time_hour'] = $end_time_h;
        $data['end_time_minute'] = $end_time_minut;
        echo json_encode($data);
    }

    function get_assessment_name($class_name_id)
    {

        $class_name = $this->mastermodel->get_data_srow('class_name', $class_name_id, 'class_name_id');
        $assessment = $this->mastermodel->get_data_joined('assessment_master', 'class_name', 'class_name_id', 'class_name_id', $class_name_id, 'class_name.class_name_id');

        $opt = '<option value="">Select</option>';
        foreach ($assessment as $list)
        {
            $opt.= "<option value='" . $list['assessment_master_id'] . "'>" . $list['assessment_master_name'] . "</option>";
        }

        $data = array();
        $data['option'] = $opt;
        $data['class_name'] = $class_name->class_name_code;
        echo json_encode($data);
    }

    function get_TeacherAndCourse($class_name_id)
    {
        $class_name = $this->mastermodel->get_data_srow('class_name', $class_name_id, 'class_name_id');
        $exam = $this->mastermodel->get_data_joined('exammaster', 'class_name', 'class_name_id', 'class_name_id', $class_name_id, 'class_name.class_name_id');
        $opt = '<option value="">Select</option>';
        foreach ($exam as $list)
        {
            $opt.= "<option value='" . $list['exammaster_id'] . "'>" . $list['exammaster_name'] . "</option>";
        }
        $data = array();
        $data['option'] = $opt;
        $data['class_name'] = $class_name->class_name_code;
        echo json_encode($data);
    }

    function get_class_students_assessment($class_name_id, $date)
    {
        $student = $this->studentmodel->get_student_class_allocation_details($class_name_id);
        $data = array();
        $data['std'] = $student;
        $data['class_name'] = $class_name_id;
        $data['date'] = $date;
        $data['sub_count'] = count($student);
        $this->load->view('student/list_class_students_assessment', $data);
    }
    function get_class_students_rollover($class_name_id, $date)
    {
        $student = $this->studentmodel->get_student_class_allocation_details($class_name_id);
        $data = array();
        $data['std'] = $student;
        $data['class_name'] = $class_name_id;
        $data['date'] = $date;
        $data['sub_count'] = count($student);
        $this->load->view('student/list_class_students_rollover', $data);
    }
    function get_student_no($student_id)
    {
        $data = array();
        $student = $this->mastermodel->get_data_srow_joined('student', 'nationality', 'nationality_id', 'nationality_id', $student_id, 'student_id');
        $data['reg_no'] = $student->reg_no;
        $data['gender'] = $student->gender;
        $data['nationality'] = $student->nationality_name;
        echo json_encode($data);
    }


    function get_attendance_students($class_name_id, $date, $start_time, $end_time)
    {
        $data = array();
        $student = $this->studentmodel->get_student_class_allocation_details($class_name_id);
        $data['class_name'] = $class_name_id;
        $data['date'] = $date;
        $data['students'] = $student;
        $data['start_time'] = $start_time;
        $data['end_time'] = $end_time;
        $this->load->view('student/attendance_student', $data);
    }

    function autosuggestclassstudent($class_name_id)
    {
        $q = strtolower($_POST["q"]);
        if (!$q)
            return;
        $class_student = $this->studentmodel->get_student_class_allocation_details($class_name_id);

        foreach ($class_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 . '#' . $value['student_class_id'] . '~' . $id . '#';
                echo "\n";
            } else if (strpos(strtolower($l_name), $q) !== false)
            {
                echo '' . $f_name . ' ' . $l_name . '-' . $reg . '#' . $value['student_class_id'] . '~' . $id . '#';
                echo "\n";
            } else if (strpos(strtolower($reg), $q) !== false)
            {
                echo '' . $f_name . ' ' . $l_name . '-' . $reg . '#' . $value['student_class_id'] . '~' . $id . '#';
                echo "\n";
            }
        }
    }

    /* get classes of a student */

    function autoSuggestStudentsNotCancelled($class_name_id)
    {
        $q = strtolower($_POST["q"]);
        if (!$q)
            return;

        $class = $this->mastermodel->get_data_srow('class_name', $class_name_id, 'class_name_id');
        $class_student = $this->studentmodel->getStudentsNotCancelledFromClass($class_name_id);

        foreach ($class_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 '' . $f_name . ' ' . $l_name . '-' . $reg . '#' . $id . '#';
                echo "\n";
            } else if (strpos(strtolower($reg), $q) !== false)
            {
                echo '' . $f_name . ' ' . $l_name . '-' . $reg . '#' . $id . '#';
                echo "\n";
            }
        }
    }

    function post_fee_settings($ref_id)
    {
        $data = array();
        $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 0);
        if (!$perm)
            $data['msg'] = "Permission Denied";
        else
            $data = $this->studentmodel->post_fee_settings($ref_id);
        $arr = array('msg' => $data['msg'], 'res' => $data['res']);
        echo json_encode($arr);
    }

    function reverse_fee_settings($ref_id)
    {
        $data = array();
        $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 0);
        if (!$perm)
            $data['msg'] = "Permission Denied";
        else
            $data = $this->studentmodel->reverse_fee_settings($ref_id);
        $arr = array('msg' => $data['msg'], 'res' => $data['res']);
        echo json_encode($arr);
    }

    function feereceiptunallocated($id)
    {
        $postdata = $this->get_post_values();
        $data['fee'] = $this->mastermodel->get_data_srow_joined('fee_payment', 'student', 'fee_student_id', 'student_id', $id, 'fee_payment_id');
        if (isset($postdata['pdf_header']) == 'on')
            $data['header_check'] = 'on';
        else
            $data['header_check'] = 'off';

        $html = $this->load->view('student/feereceiptunallocpdf', $data, TRUE);
        if ($data['header_check'] == 'on')
        {
            $data['html'] = $html;

            $data['pdf_name'] = "Fee Receipt Unallocated";
            $this->load->view('pdf_create', $data);
        } else
        {
            pdf_create($html, 'Fee Receipt Unallocated');
        }
    }
    function physicalreport($id)
    {
        $data['physical'] = $this->mastermodel->get_data_srow_joined('nutrition', 'physical', 'nutrition_id', 'physical_id', $id, 'nutrition_id');
        $data['medical'] = $this->mastermodel->get_data_srow_joined('nutrition', 'medical', 'nutrition_id', 'medical_id', $id, 'nutrition_id');
        $html = $this->load->view('student/physicalreport', $data, TRUE);
//        echo $html;die();
        pdf_create($html, 'DailyReport','true');
    }
    
    function preview()
    { 
       
       
       $data['details']=$_POST;
//       var_dump($data);
       $this->load->view('student/preview',$data);
    }

    function feereceipt($id)
    {
        $postdata = $this->get_post_values();
        $data['fee'] = $this->mastermodel->get_data_srow_joined('fee', 'student_class', 'student_class_id', 'student_class_id', $id, 'fee_id');
        $student_class_id = $data['fee']->student_class_id;
        $student_id = $data['fee']->student_id;
        $data['student_class_details'] = $this->studentmodel->get_student_class_details($student_class_id);
        $data['term'] = $data['student_class_details']->class_term_id;
        $data['academic_year'] = $this->mastermodel->get_single_field_value('academic_year', 'academic_year_year', 'academic_year_id', $data['student_class_details']->class_name_academic_year_id);
        $data['student_fee_details'] = $this->studentmodel->get_student_fee_details($student_class_id);
        $data['student_monthly_fee_details'] = $this->studentmodel->get_student_monthly_wef_date($student_class_id, date('d-m-Y'));
        $data['student_fee_paid_details'] = $this->studentmodel->get_student_fee_paid_details($student_class_id);
        $data['fee_last_paid_details'] = $this->mastermodel->get_data('fee_paid_details', $id, 'fee_id');
        $data['id'] = $id;

        if (isset($postdata['pdf_header']) == 'on')
            $data['header_check'] = 'on';
        else
            $data['header_check'] = 'off';
        $receipt_type = $this->mastermodel->get_data_srow('nursery', '1', 'nursery_id');
        if ($receipt_type->nursery_code != 0)
        {
            $html = $this->load->view('student/feereceiptpdf_new', $data, TRUE);
            pdf_create($html, $data['fee']->fee_receipt_no, 'true');
        } else
        {
            $html = $this->load->view('student/feereceiptpdf', $data, TRUE);
            pdf_create($html, $data['fee']->fee_receipt_no);
        }

    }

    function get_deactivted_student($student_id, $date, $class_name, $deactivate = '')
    {
        $data = array();
        $data['deactivate'] = $deactivate = $this->studentmodel->check_deactivate($class, $student_id, $date, $deactivate);
        $studnt = $this->mastermodel->get_data_srow('student', $student_id, 'student_id');
        $data['student'] = $studnt->first_name . ' ' . $studnt->last_name . '-' . $studnt->reg_no;
        echo json_encode($data);
    }

    function update_student_fee()
    {
        $data = array();
        $postdata = $this->get_post_values();
        $data = $this->studentmodel->update_student_fee($postdata);
        $this->student_class_details($postdata['class_name_id'], 'class_name_id', 'edit_student_class');
        $this->load->view('message', $data);
    }

    /**/

    function autosuggestStudentClass($student_id)
    {
        $q = strtolower($_POST["q"]);
        if (!$q)
            return;
        $class_list = $this->studentmodel->get_student_classes($student_id);
        foreach ($class_list as $items)
        {
            if (strpos(strtolower($items['class_code']), $q) !== false)
            {
                echo '' . $items['class_code'] . '#' . $items['student_class_id'] . '~' . $items['class_name_id'] . '#';
                echo "\n";
            }
        }
    }

    function show_payment_type($type, $transaction_type = '')
    {
        $data['type'] = $type;
        $data['transaction_type'] = $transaction_type;
        $this->load->view('student/list_payment', $data);
    }

    function add_assessment($modelfunction, $page)
    {
        $postdata = $this->get_post_values();
        $data = $this->studentmodel->$modelfunction($postdata);
        $_SESSION['upload'] = 1;
        redirect("master/index/143/3");
    }
    
    function delete_cancellation($cancellation_id, $student_class_id)
    {
        $data = array();
        $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 3);
        if (!$perm)
            $data['msg'] = "Permission Denied";
        else
            $data = $this->studentmodel->delete_cancellation($cancellation_id, $student_class_id);
        $arr = array('msg' => $data['msg'], 'res' => $data['res']);
        echo json_encode($arr);
    }

}

/* End of file master.php */
/* Location: ./application/controllers/master.php */

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net