<?php
class StudentAccessModel extends CI_MODEL{

    public function get_active_subject_data($class,$subject){
        $table='class_and_subjects';
        $info=array();
        $this->db->select('*');
        $this->db->from($table);
        $this->db->where('class',$class);
        $this->db->where('subject',$subject);
        $info=$this->db->get()->result_array();
        return $info;
    }

    public function check_subject_chapters($subject_id){
        $table='chapters';
        $info=array();
        $this->db->select('*');
        $this->db->from($table);
        $this->db->where('subject_id',$subject_id);
        $info=$this->db->get()->result_array();
        return $info;    
    }

    public function get_chapter_content($chapter_id){
        $table='econtent';
        $info=array();
        $this->db->select('*');
        $this->db->from($table);
        $this->db->where('chapter_id',$chapter_id);
        $info=$this->db->get()->result_array();
        return $info;        
    }   


    public function get_chapter_detail($chapter_id){
        $table='chapters';
        $info=array();
        $this->db->select('*');
        $this->db->from($table);
        $this->db->where('id',$chapter_id);
        $info=$this->db->get()->result_array();
        return $info;        
    }
    public function get_single_content_detail($content_id){
        $table='econtent';
        $info=array();
        $this->db->select('*');
        $this->db->from($table);
        $this->db->where('id',$content_id);
        $info=$this->db->get()->result_array();
        return $info;    
    }

    public function get_single_subject_detail($subject_id){
        $table='class_and_subjects';
        $info=array();
        $this->db->select('*');
        $this->db->from($table);
        $this->db->where('id',$subject_id);
        $info=$this->db->get()->result_array();
        return $info;    
    }

    public function student_attendance($sid,$day,$month,$year){
        $table='attendence';
        $info=array();
        $this->db->select('*');
        $this->db->from($table);
        $this->db->where('sid',$sid);
        $this->db->where('day',$day);
        $this->db->where('month',$month);
        $this->db->where('year',$year);
        $info=$this->db->get()->result_array();
        return $info;    
    }

}