<?php

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

class Everbright extends CI_Controller {

    public function __construct() {
        parent::__construct();
        date_default_timezone_set('Asia/Dhaka');
        $this->load->model('main_model');
        $this->load->database();
        $this->load->library(array('session'));
        $this->load->helper(array('url', 'form', 'text', 'array'));
        /* grocery_crud */
        $this->load->library('Grocery_crud');
        $this->gc = new grocery_CRUD();
        $this->gc->unset_read()->unset_print()->unset_export();
        if ($this->session->userdata('user_type') == 'user') {
            $this->gc->unset_edit();
        }
    }

    /** DEFAUL FUNCTION * */
    public function index() {
        $page_data = array(
            'page_name' => 'dashboard',
            'page_title' => 'Welcome to Dashboard',
            'sidebar' => 'dashboard_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    /* freight */

    public function freight($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $freight = $this->db->count_all('freight')+1;
            $invoice_no = "EBL".date("y").date("m").str_pad($freight,4,"0",STR_PAD_LEFT);

            $freight_data = array(
                'invoice_no' => $invoice_no,
                'date' => $this->input->post('date'),
                'del_date' => $this->input->post('del_date'),
                'to' => $this->input->post('to'),
                'job_no' => $this->input->post('job_no'),
                'pol_pod_type' => $this->input->post('pol_pod_type'),
                'pol_pod' => $this->input->post('pol_pod'),
                'vol' => $this->input->post('vol'),
                'ATTN' => $this->input->post('ATTN'),
                'SHIPPER' => $this->input->post('SHIPPER'),
                'QTY' => $this->input->post('QTY'),
                'CNTR' => $this->input->post('CNTR'),
                'LCNO' => $this->input->post('LCNO'),
                'HBLNO' => $this->input->post('HBLNO'),
                'MBLNO' => $this->input->post('MBLNO'),
                'HAWABLNO' => $this->input->post('HAWABLNO'),
                'MAWBLNO' => $this->input->post('MAWBLNO'),
                'SHPT_EX' => $this->input->post('SHPT_EX'),
				'commodity' => $this->input->post('commodity'),
                'updated_by' => $this->session->userdata('user_id'),
                'created_at' => date('Y-m-d H:i:s')
            );
            $this->db->insert('freight', $freight_data);

            $freight_id = $this->db->insert_id(); //To get the last generated id in the table
            // freight_invoice
            $fi_amount = $this->input->post('fi_amount');
            if (!empty($fi_amount)) {
                foreach ($fi_amount as $a => $b) {
                    $fi_data['freight_id'] = $freight_id;
                    $fi_data['description'] = $this->input->post('fi_description[' . $a . ']');
                    $fi_data['freight_rate'] = $this->input->post('freight_rate[' . $a . ']');
                    $fi_data['exchange_rate'] = $this->input->post('exchange_rate[' . $a . ']');
                    $fi_data['unit'] = $this->input->post('fi_unit[' . $a . ']');
                    $fi_data['amount'] = $this->input->post('fi_amount[' . $a . ']');
                    $fi_data['updated_by'] = $this->session->userdata('user_id');
                    $fi_data['created_at'] = date('Y-m-d H:i:s');

                    $this->db->insert('freight_invoice', $fi_data);
                }
            }

            redirect('everbright/freight', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $freight_data = array(
                'date' => $this->input->post('date'),
                'del_date' => $this->input->post('del_date'),
                'to' => $this->input->post('to'),
                'job_no' => $this->input->post('job_no'),
                'pol_pod_type' => $this->input->post('pol_pod_type'),
                'pol_pod' => $this->input->post('pol_pod'),
                'vol' => $this->input->post('vol'),
                'ATTN' => $this->input->post('ATTN'),
                'SHIPPER' => $this->input->post('SHIPPER'),
                'QTY' => $this->input->post('QTY'),
                'CNTR' => $this->input->post('CNTR'),
                'LCNO' => $this->input->post('LCNO'),
                'HBLNO' => $this->input->post('HBLNO'),
                'MBLNO' => $this->input->post('MBLNO'),
                'HAWABLNO' => $this->input->post('HAWABLNO'),
                'MAWBLNO' => $this->input->post('MAWBLNO'),
                'SHPT_EX' => $this->input->post('SHPT_EX'),
				'commodity' => $this->input->post('commodity'),
                'updated_by' => $this->session->userdata('user_id'),
                'updated_at' => date('Y-m-d H:i:s')
            );
            $this->db->where('freight_id', $param2);
            $this->db->update('freight', $freight_data);

            // freight_invoice update
            $this->db->where('freight_id', $param2);
            $this->db->delete('freight_invoice');
            $fi_amount = $this->input->post('fi_amount');
            if (!empty($fi_amount)) {
                foreach ($fi_amount as $a => $b) {
                    $fi_data = array(
                        'freight_id' => $param2,
                        'description' => $this->input->post('fi_description[' . $a . ']'),
                        'freight_rate' => $this->input->post('freight_rate[' . $a . ']'),
                        'exchange_rate' => $this->input->post('exchange_rate[' . $a . ']'),
                        'unit' => $this->input->post('fi_unit[' . $a . ']'),
                        'amount' => $this->input->post('fi_amount[' . $a . ']'),
                        'updated_by' => $this->session->userdata('user_id'),
                        'created_at' => date('Y-m-d H:i:s')
                    );
                    $this->db->insert('freight_invoice', $fi_data);
                }
            }
            redirect('everbright/freight', 'refresh');
        }

        $page_data = array(
            'page_name' => 'freight',
            'page_title' => 'Freight Information',
            'sidebar' => 'freight_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function freight_add() {
        $page_data = array(
            'page_name' => 'freight_add',
            'page_title' => 'Freight: Add',
            'sidebar' => 'freight_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function freight_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'freight_edit',
            'page_title' => 'Freight: Edit',
            'sidebar' => 'freight_sidebar',
            'freight_id' => $param1
        );
        $this->load->view('index', $page_data);
    }

    public function freight_view($param1 = '') {
        $page_data = array(
            'page_name' => 'freight_view',
            'page_title' => 'Freight: View',
            'sidebar' => 'freight_sidebar',
            'freight_id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	
    function freight_doc($param1 = '') {
        $file = 'Freight_'.$this->main_model->freight_invoiceno($param1).'.doc';
        header("Content-type: application/vnd.ms-word");
	    header("Content-Disposition: attachment; filename=$file");
		
        $page_data = array(
            'freight_id' => $param1
        );
        $this->load->view('freight_doc', $page_data);
    } 
	
	
    /* debit_credit */

    public function debit_credit() {
        $page_data = array(
            'page_name' => 'debitcredit',
            'page_title' => 'Debit/Credit Information',
            'sidebar' => 'debitcredit_sidebar'
        );
        $this->load->view('index', $page_data);
    }
/* School Class */
    public function sclass($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $sclass_data = array(
                'name' => $this->input->post('name'),
                'updated_by' => $this->session->userdata('user_id'),
                'updated_at' => date('Y-m-d H:i:s')
            );
            $this->db->insert('sclass', $sclass_data);


            redirect('everbright/sclass', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $sclass_data = array(
                'name' => $this->input->post('name'),             
                'updated_at' => date('Y-m-d H:i:s')
            );
            $this->db->where('scid', $param2);
            $this->db->update('sclass', $sclass_data);
			redirect('everbright/sclass', 'refresh');
        }

        $page_data = array(
            'page_name' => 'sclass',
            'page_title' => 'Class Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function sclass_add() {
        $page_data = array(
            'page_name' => 'sclass_add',
            'page_title' => 'Class: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function sclass_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'sclass_edit',
            'page_title' => 'Class: Edit',
            'sidebar' => 'homecontent_sidebar',
            'scid' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function sclass_delete($scid)
		{				
			   $com_info=$this->db->delete('sclass', array('scid' => $scid));
				if($com_info==TRUE)
				{
				  
			  $this->sclass();
				}
		
		}
	/* Home Content Picture Edit */
	public function do_upload_edit_homecontent_picture(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "76800",
                  'max_width'       => "102400",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['home_id'] = $this->input->post('home_id');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'home_image' == $this->main_model->store_homecontent_pic_data_update($data);
					redirect('everbright/homecontent', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
	/* School Class */
	public function do_upload(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "768",
                  'max_width'       => "1024",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['content_type'] = $this->input->post('content_type');
					$data['content_option'] = $this->input->post('content_option');
					$data['title'] = $this->input->post('title');
					$data['details'] = $this->input->post('details');
					$data['date'] = date('Y-m-d');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'home_image' == $this->main_model->store_pic_data($data);
					redirect('everbright/homecontent_add', 'refresh');
				}
				else
				{
				$data['content_type'] = $this->input->post('content_type');
					$data['content_option'] = $this->input->post('content_option');
					$data['title'] = $this->input->post('title');
					$data['details'] = $this->input->post('details');
					$data['date'] = date('Y-m-d');

					'home_image' == $this->main_model->store_pic_data34($data);
					redirect('everbright/homecontent_add', 'refresh');
				}    
}
	

	
	/* Home Content */
    public function homecontent($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
		
				$homecontent_data = array(
                'content_type' => $this->input->post('content_type'),
				'content_option' => $this->input->post('content_option'),
				'title' => $this->input->post('title'),
				//'home_image' => $this->input->post('pic_file'),
                'details' => $this->input->post('details'),
                'date' => date('Y-m-d')
            );
            $this->db->insert('home', $homecontent_data);
            redirect('everbright/homecontent', 'refresh');
        }
		
		

        /* edit */
        if ($param1 == 'edit') {
            $homecontent_data = array(
                'content_option' => $this->input->post('content_option'), 
				'title' => $this->input->post('title'),
				'details' => $this->input->post('details')
            );
            $this->db->where('home_id', $param2);
            $this->db->update('home', $homecontent_data);
			redirect('everbright/homecontent', 'refresh');
        }

        $page_data = array(
            'page_name' => 'homecontent',
            'page_title' => 'Home Content Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function homecontent_add() {	

		
        $page_data = array(
            'page_name' => 'homecontent_add',
            'page_title' => 'Home Content: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }

    public function homecontent_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'homecontent_edit',
            'page_title' => 'Home Content: Edit',
            'sidebar' => 'homecontent_sidebar',
            'home_id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function homecontent_edit_picture($param1 = '') {
        $page_data = array(
            'page_name' => 'homecontent_edit_picture',
            'page_title' => 'Home Content : Picture Edit',
            'sidebar' => 'homecontent_sidebar',
            'home_id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function homecontent_delete($home_id)
		{				
			   $com_info=$this->db->delete('home', array('home_id' => $home_id));
				if($com_info==TRUE)
				{
				  
			  $this->homecontent();
				}
		
		}
	/* Home Content */
	
	
	
	/* Banner */
	
	
	public function do_upload_banner(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "768000",
                  'max_width'       => "1024000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['title'] = $this->input->post('title');
					$data['details'] = $this->input->post('details');
					$data['date'] = date('Y-m-d H:i:s');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'image' == $this->main_model->store_pic_data_banner($data);
					redirect('everbright/banner_add', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->banner();
				}    
}

/* Home Content Picture Edit */
	public function do_upload_edit_banner_picture(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "76800",
                  'max_width'       => "102400",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['id'] = $this->input->post('id');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'image' == $this->main_model->store_banner_pic_data_update($data);
					redirect('everbright/banner', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
	
    public function banner($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $banner_data = array(
                
				'title' => $this->input->post('title')
				
            );
            $this->db->where('id', $param2);
            $this->db->update('banner', $banner_data);
			redirect('everbright/banner', 'refresh');
        }

        $page_data = array(
            'page_name' => 'banner',
            'page_title' => 'Banner Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function banner_add() {	

		
        $page_data = array(
            'page_name' => 'banner_add',
            'page_title' => 'Banner: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }

    public function banner_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'banner_edit',
            'page_title' => 'Banner: Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function banner_edit_picture($param1 = '') {
        $page_data = array(
            'page_name' => 'banner_edit_picture',
            'page_title' => 'Banner : Picture Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function banner_delete($id)
		{				
			   $com_info=$this->db->delete('banner', array('id' => $id));
				if($com_info==TRUE)
				{  
			  $this->banner();
				}
		
		}
	/* Banner */
		/* BNotice Board */

	public function do_upload_bnoticeboard(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['notice_headline'] = $this->input->post('notice_headline');
					$data['notice_des'] = $this->input->post('notice_des');
					$data['date'] = date('Y-m-d H:i:s');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'image' == $this->main_model->store_pic_data_bnoticeboard($data);
					redirect('everbright/bnoticeboard_add', 'refresh');
				}
				else
				{
				$data['notice_headline'] = $this->input->post('notice_headline');
					$data['notice_des'] = $this->input->post('notice_des');
					$data['date'] = date('Y-m-d H:i:s');
					'image' == $this->main_model->store_pic_data_bnoticeboard1($data);
				
				redirect('everbright/bnoticeboard_add', 'refresh');
				}    
}
	/* Notice Board File Edit */
	public function do_upload_edit_bnoticeboard_file(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "102400000",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['id'] = $this->input->post('id');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'image' == $this->main_model->store_bnoticeboard_file_data_update($data);
					redirect('everbright/bnoticeboard', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
    public function bnoticeboard($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $noticeboard_data = array(
                
				'notice_headline' => $this->input->post('notice_headline'),
				'notice_des' => $this->input->post('notice_des'),
				'date' => $this->input->post('date')
            );
            $this->db->where('id', $param2);
            $this->db->update('notice', $noticeboard_data);
			redirect('everbright/bnoticeboard', 'refresh');
        }

        $page_data = array(
            'page_name' => 'bnoticeboard',
	'page_title' => ' আদেশ/ নোটিশ/ কার্যক্রম | লিষ্ট',
            'sidebar' => 'bongobondhu_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function bnoticeboard_add() {	

		
        $page_data = array(
            'page_name' => 'bnoticeboard_add',
            'page_title' => ' আদেশ/ নোটিশ/ কার্যক্রম: নতুন',
            'sidebar' => 'bongobondhu_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }

    public function bnoticeboard_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'bnoticeboard_edit',
            'page_title' => ' আদেশ/ নোটিশ/ কার্যক্রম: পরিবর্তন',
            'sidebar' => 'bongobondhu_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function bnoticeboard_edit_file($param1 = '') {
        $page_data = array(
            'page_name' => 'bnoticeboard_edit_file',
            'page_title' => ' আদেশ/ নোটিশ/ কার্যক্রম: ফাইল পরিবর্তন',
            'sidebar' => 'bongobondhu_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function bnoticeboard_delete($id)
		{				
			   $com_info=$this->db->delete('bnotice', array('id' => $id));
				if($com_info==TRUE)
				{  
			  $this->bnoticeboard();
				}
		
		}
	/* Notice */
	/* Gallery */
	public function do_upload_gallery3(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "768000",
                  'max_width'       => "1024000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['album'] = $this->input->post('album');
					$data['title'] = $this->input->post('title');
					
					$data['date'] = date('Y-m-d');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'image' == $this->main_model->store_pic_data_gallery3($data);
					redirect('everbright/gallery3_add', 'refresh');
				}
				else
				{
					$data['album'] = $this->input->post('album');
					$data['title'] = $this->input->post('title');
					$data['date'] = date('Y-m-d');
					'image' == $this->main_model->store_pic_data_gallery4($data);
				
				redirect('everbright/gallery3_add', 'refresh');
				}    
}
	/* Gallery Picture Edit */
	public function do_upload_edit_gallery3_picture(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "102400000",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['id'] = $this->input->post('id');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'image' == $this->main_model->store_gallery3_picture_data_update($data);
					redirect('everbright/gallery3', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
    public function gallery3($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $gallery_data = array(
			
				'date' => $this->input->post('date'),
				'title' => $this->input->post('title'),
            );
            $this->db->where('id', $param2);
            $this->db->update('gallery1', $gallery_data);
			redirect('everbright/gallery3', 'refresh');
        }

        $page_data = array(
            'page_name' => 'gallery3',
            'page_title' => 'Gallery Information',
            'sidebar' => 'bongobondhu_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function gallery3_add() {	

		
        $page_data = array(
            'page_name' => 'gallery3_add',
            'page_title' => 'Gallery Info: Add',
            'sidebar' => 'bongobondhu_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }

    public function gallery3_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'gallery3_edit',
            'page_title' => 'Gallery Info: Edit',
            'sidebar' => 'bongobondhu_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function gallery3_edit_file($param1 = '') {
        $page_data = array(
            'page_name' => 'gallery3_edit_picture',
            'page_title' => 'Gallery Picture: Edit',
            'sidebar' => 'bongobondhu_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function gallery3_delete($id)
		{				
			   $com_info=$this->db->delete('gallery1', array('id' => $id));
				if($com_info==TRUE)
				{  
			  $this->gallery3();
				}
		
		}
	/* Gallery */
		/* Album */
    public function album3($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $album_data = array(
				'title' => $this->input->post('title'),
                'name' => $this->input->post('name'),
                'date' => date('Y-m-d')
            );
            $this->db->insert('album1', $album_data);
            redirect('everbright/album3', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $album_data = array(
				'title' => $this->input->post('title'),
                'name' => $this->input->post('name'),             
                'date' => date('Y-m-d')
            );
            $this->db->where('album_id', $param2);
            $this->db->update('album1', $album_data);
			redirect('everbright/album3', 'refresh');
        }

        $page_data = array(
            'page_name' => 'album3',
            'page_title' => 'ভিডিও তথ্য | তালিকা',
            'sidebar' => 'bongobondhu_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function album3_add() {
        $page_data = array(
            'page_name' => 'album3_add',
            'page_title' => 'ভিডিও তথ্য: নতুন',
            'sidebar' => 'bongobondhu_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function album3_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'album3_edit',
            'page_title' => 'ভিডিও তথ্য: পরিবর্তন',
            'sidebar' => 'bongobondhu_sidebar',
            'album_id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function album3_delete($album_id)
		{				
			   $com_info=$this->db->delete('album1', array('album_id' => $album_id));
				if($com_info==TRUE)
				{
				  
			  $this->album3();
				}
		
		}
    
	
	/* Album */
	/* Notice Board */

	public function do_upload_noticeboard(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['notice_headline'] = $this->input->post('notice_headline');
					$data['notice_des'] = $this->input->post('notice_des');
					$data['date'] = date('Y-m-d H:i:s');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'image' == $this->main_model->store_pic_data_noticeboard($data);
					redirect('everbright/noticeboard_add', 'refresh');
				}
				else
				{
				$data['notice_headline'] = $this->input->post('notice_headline');
					$data['notice_des'] = $this->input->post('notice_des');
					$data['date'] = date('Y-m-d H:i:s');
					'image' == $this->main_model->store_pic_data_noticeboard1($data);
				
				redirect('everbright/noticeboard_add', 'refresh');
				}    
}
	/* Notice Board File Edit */
	public function do_upload_edit_noticeboard_file(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "102400000",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['id'] = $this->input->post('id');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'image' == $this->main_model->store_noticeboard_file_data_update($data);
					redirect('everbright/noticeboard', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
    public function noticeboard($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $noticeboard_data = array(
                
				'notice_headline' => $this->input->post('notice_headline'),
				'notice_des' => $this->input->post('notice_des'),
				'date' => $this->input->post('date')
            );
            $this->db->where('id', $param2);
            $this->db->update('notice', $noticeboard_data);
			redirect('everbright/noticeboard', 'refresh');
        }

        $page_data = array(
            'page_name' => 'noticeboard',
            'page_title' => 'Notice Board',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function noticeboard_add() {	

		
        $page_data = array(
            'page_name' => 'noticeboard_add',
            'page_title' => 'Notice Board: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }

    public function noticeboard_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'noticeboard_edit',
            'page_title' => 'Notice Board: Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function noticeboard_edit_file($param1 = '') {
        $page_data = array(
            'page_name' => 'noticeboard_edit_file',
            'page_title' => 'Notice Board: File Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function noticeboard_delete($id)
		{				
			   $com_info=$this->db->delete('notice', array('id' => $id));
				if($com_info==TRUE)
				{  
			  $this->noticeboard();
				}
		
		}
	/* Notice */
	
	
	/* Notice Board */

	public function do_upload_newinformation(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['notice_headline'] = $this->input->post('notice_headline');
					$data['notice_des'] = $this->input->post('notice_des');
					$data['date'] = date('Y-m-d H:i:s');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'image' == $this->main_model->store_pic_data_newinformation($data);
					redirect('everbright/newinformation_add', 'refresh');
				}
				else
				{
				$data['notice_headline'] = $this->input->post('notice_headline');
					$data['notice_des'] = $this->input->post('notice_des');
					$data['date'] = date('Y-m-d H:i:s');
					'image' == $this->main_model->store_pic_data_newinformation1($data);
				
				redirect('everbright/newinformation_add', 'refresh');
				}    
}
	/* Notice Board File Edit */
	public function do_upload_edit_newinformation_file(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "102400000",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['id'] = $this->input->post('id');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'image' == $this->main_model->store_newinformation_file_data_update($data);
					redirect('everbright/newinformation', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
    public function newinformation($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $noticeboard_data = array(
                
				'notice_headline' => $this->input->post('notice_headline'),
				'notice_des' => $this->input->post('notice_des'),
				'date' => $this->input->post('date')
            );
            $this->db->where('id', $param2);
            $this->db->update('newinformation', $noticeboard_data);
			redirect('everbright/newinformation', 'refresh');
        }

        $page_data = array(
            'page_name' => 'newinformation',
            'page_title' => 'New information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function newinformation_add() {	

		
        $page_data = array(
            'page_name' => 'newinformation_add',
            'page_title' => 'New information : Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }

    public function newinformation_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'newinformation_edit',
            'page_title' => 'New information : Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function newinformation_edit_file($param1 = '') {
        $page_data = array(
            'page_name' => 'newinformation_edit_file',
            'page_title' => 'New information: File Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function newinformation_delete($id)
		{				
			   $com_info=$this->db->delete('newinformation', array('id' => $id));
				if($com_info==TRUE)
				{  
			  $this->newinformation();
				}
		
		}
	/* Notice */
	
	
	
	/* Teacher */
	public function do_upload_teacher(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "7680000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['serial'] = $this->input->post('serial');
					$data['name'] = $this->input->post('name');
					$data['designation'] = $this->input->post('designation');
					$data['contact'] = $this->input->post('contact');
					$data['education'] = $this->input->post('education');
					$data['join_date'] = $this->input->post('join_date');
					$data['class_teacher'] = $this->input->post('class_teacher');
					$data['section'] = $this->input->post('section');
					$data['t_class'] = $this->input->post('t_class');
					$data['t_department'] = $this->input->post('t_department');
					$data['email'] = $this->input->post('email');
					$data['date'] = date('Y-m-d H:i:s');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'image' == $this->main_model->store_pic_data_teacher($data);
					redirect('everbright/teacher_add', 'refresh');
				}
				else
				{
					$data['serial'] = $this->input->post('serial');
					$data['name'] = $this->input->post('name');
					$data['designation'] = $this->input->post('designation');
					$data['contact'] = $this->input->post('contact');
					$data['education'] = $this->input->post('education');
					$data['join_date'] = $this->input->post('join_date');
					$data['class_teacher'] = $this->input->post('class_teacher');
					$data['section'] = $this->input->post('section');
					$data['t_class'] = $this->input->post('t_class');
					$data['t_department'] = $this->input->post('t_department');
					$data['email'] = $this->input->post('email');
					$data['date'] = date('Y-m-d H:i:s');
					'image' == $this->main_model->store_pic_data_teacher1($data);
				
				redirect('everbright/teacher_add', 'refresh');
				}    
}
/* Teacher Picture Edit */
	public function do_upload_edit_teacher_picture(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "102400000",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['tid'] = $this->input->post('tid');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'image' == $this->main_model->store_teacher_pic_data_update($data);
					redirect('everbright/teacher', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}	
    public function teacher($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $teacher_data = array(
			
				'serial' => $this->input->post('serial'),
				'name' => $this->input->post('name'),
				'designation' => $this->input->post('designation'),
				'contact' => $this->input->post('contact'),
				'education' => $this->input->post('education'),
				'join_date' => $this->input->post('join_date'),
				'class_teacher' => $this->input->post('class_teacher'),
				'section' => $this->input->post('section'),
				't_class' => $this->input->post('t_class'),
				't_department' => $this->input->post('t_department'),
				'email' => $this->input->post('email')
            );
            $this->db->where('tid', $param2);
            $this->db->update('teacher', $teacher_data);
			redirect('everbright/teacher', 'refresh');
        }

        $page_data = array(
            'page_name' => 'teacher',
            'page_title' => 'Teacher Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function teacher_add() {	

		
        $page_data = array(
            'page_name' => 'teacher_add',
            'page_title' => 'Teacher Info: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }
	public function teacher_report() {	

		
        $page_data = array(
            'page_name' => 'teacher_attandance_report',
            'page_title' => 'Teacher Attendance Report: Show',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }
	public function teacher_report_show() {	

		
        $page_data = array(
            'page_name' => 'teacher_attandance_report_show',
            'page_title' => 'Teacher Attendance Report: Show',
            'sidebar' => 'homecontent_sidebar',
			'user_ID' => $this->input->post('user_ID'),
			'tdate' => $this->input->post('tdate'),
			'fdate' => $this->input->post('fdate')
        );
        $this->load->view('index', $page_data);
		
    }
	public function teacher_leave() {	

		
        $page_data = array(
            'page_name' => 'teacher_leave_report',
            'page_title' => 'Teacher Leave Report: Show',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }
	public function teacher_leave_show() {	

		
        $page_data = array(
            'page_name' => 'teacher_leave_report_show',
            'page_title' => 'Teacher Leave Report: Show',
            'sidebar' => 'homecontent_sidebar',
			'user_ID' => $this->input->post('user_ID'),
			'tdate' => $this->input->post('tdate'),
			'fdate' => $this->input->post('fdate')
        );
        $this->load->view('index', $page_data);
		
    }
    public function teacher_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'teacher_edit',
            'page_title' => 'Teacher Info: Edit',
            'sidebar' => 'homecontent_sidebar',
            'tid' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function teacher_edit_picture($param1 = '') {
        $page_data = array(
            'page_name' => 'teacher_edit_picture',
            'page_title' => 'Teacher Info : Picture Edit',
            'sidebar' => 'homecontent_sidebar',
            'tid' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function teacher_delete($tid)
		{				
			   $com_info=$this->db->delete('teacher', array('tid' => $tid));
				if($com_info==TRUE)
				{  
			  $this->teacher();
				}
		
		}
	/* Teacher */
	
	
	
	
	/* Others Employee */
	public function do_upload_oemployee(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|bmp",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "7680000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['serial'] = $this->input->post('serial');
					$data['name'] = $this->input->post('name');
					$data['designation'] = $this->input->post('designation');
					$data['contact'] = $this->input->post('contact');
					$data['education'] = $this->input->post('education');
					$data['join_date'] = $this->input->post('join_date');
					$data['date'] = date('Y-m-d H:i:s');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'image' == $this->main_model->store_pic_data_oemployee($data);
					redirect('everbright/oemployee_add', 'refresh');
				}
				else
				{
					$data['serial'] = $this->input->post('serial');
					$data['name'] = $this->input->post('name');
					$data['designation'] = $this->input->post('designation');
					$data['contact'] = $this->input->post('contact');
					$data['education'] = $this->input->post('education');
					$data['join_date'] = $this->input->post('join_date');
					$data['date'] = date('Y-m-d H:i:s');
					'image' == $this->main_model->store_pic_data_oemployee1($data);
				
				redirect('everbright/oemployee_add', 'refresh');
				}    
}
/* Teacher Picture Edit */
	public function do_upload_edit_oemployee_picture(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "102400000",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['tid'] = $this->input->post('tid');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'image' == $this->main_model->store_oemployee_pic_data_update($data);
					redirect('everbright/oemployee', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}	
    public function oemployee($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $teacher_data = array(
			
				'serial' => $this->input->post('serial'),
				'name' => $this->input->post('name'),
				'designation' => $this->input->post('designation'),
				'contact' => $this->input->post('contact'),
				'education' => $this->input->post('education'),
				'join_date' => $this->input->post('join_date'),
            );
            $this->db->where('tid', $param2);
            $this->db->update('oemployee', $teacher_data);
			redirect('everbright/oemployee', 'refresh');
        }

        $page_data = array(
            'page_name' => 'oemployee',
            'page_title' => 'Others Employee Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function oemployee_add() {	

		
        $page_data = array(
            'page_name' => 'oemployee_add',
            'page_title' => 'Others Employee Info: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }
	
    public function oemployee_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'oemployee_edit',
            'page_title' => 'Others Employee Info: Edit',
            'sidebar' => 'homecontent_sidebar',
            'tid' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function oemployee_edit_picture($param1 = '') {
        $page_data = array(
            'page_name' => 'oemployee_edit_picture',
            'page_title' => 'Others Employee Info : Picture Edit',
            'sidebar' => 'homecontent_sidebar',
            'tid' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function oemployee_delete($tid)
		{				
			   $com_info=$this->db->delete('oemployee', array('tid' => $tid));
				if($com_info==TRUE)
				{  
			  $this->oemployee();
				}
		
		}
	/* Others Employee */
	
	
	
	
	/* Gallery */
	public function do_upload_gallery(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "768000",
                  'max_width'       => "1024000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['album'] = $this->input->post('album');
					$data['title'] = $this->input->post('title');
					
					$data['date'] = date('Y-m-d');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'image' == $this->main_model->store_pic_data_gallery($data);
					redirect('everbright/gallery_add', 'refresh');
				}
				else
				{
					$data['album'] = $this->input->post('album');
					$data['title'] = $this->input->post('title');
					$data['date'] = date('Y-m-d');
					'image' == $this->main_model->store_pic_data_teacher1($data);
				
				redirect('everbright/gallery_add', 'refresh');
				}    
}
	/* Gallery Picture Edit */
	public function do_upload_edit_gallery_picture(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "102400000",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['id'] = $this->input->post('id');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'image' == $this->main_model->store_gallery_picture_data_update($data);
					redirect('everbright/gallery', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
    public function gallery($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $gallery_data = array(
			
				'album' => $this->input->post('album'),
				'title' => $this->input->post('title'),
            );
            $this->db->where('id', $param2);
            $this->db->update('gallery', $gallery_data);
			redirect('everbright/gallery', 'refresh');
        }

        $page_data = array(
            'page_name' => 'gallery',
            'page_title' => 'Gallery Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function gallery_add() {	

		
        $page_data = array(
            'page_name' => 'gallery_add',
            'page_title' => 'Gallery Info: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }

    public function gallery_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'gallery_edit',
            'page_title' => 'Gallery Info: Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function gallery_edit_file($param1 = '') {
        $page_data = array(
            'page_name' => 'gallery_edit_picture',
            'page_title' => 'Gallery Picture: Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function gallery_delete($id)
		{				
			   $com_info=$this->db->delete('gallery', array('id' => $id));
				if($com_info==TRUE)
				{  
			  $this->gallery();
				}
		
		}
	/* Gallery */
	/* Digital Content */
	public function do_upload_digitalcontent(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|ppt|pptx",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['sclass'] = $this->input->post('sclass');
					$data['steacher'] = $this->input->post('steacher');
					$data['ssubject'] = $this->input->post('ssubject');
					$data['title'] = $this->input->post('title');
					$data['file_type'] = $this->input->post('file_type');
					$data['date'] = date('Y-m-d H:i:s');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'thumb_image' == $this->main_model->store_pic_data_digitalcontent($data);
					redirect('everbright/digitalcontent_add', 'refresh');
				}
				else
				{
					$data['sclass'] = $this->input->post('sclass');
					$data['steacher'] = $this->input->post('steacher');
					$data['ssubject'] = $this->input->post('ssubject');
					$data['title'] = $this->input->post('title');
					$data['file_type'] = $this->input->post('file_type');
					$data['date'] = date('Y-m-d H:i:s');
					'image' == $this->main_model->store_pic_data_digitalcontent1($data);
				
				redirect('everbright/digitalcontent_add', 'refresh');
				}    
}
	/* Digital Content File Edit */
	public function do_upload_edit_digitalcontent_file(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "7680000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['id'] = $this->input->post('id');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'thumb_image' == $this->main_model->store_digitalcontent_file_data_update($data);
					redirect('everbright/digitalcontent', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
    public function digitalcontent($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $digitalcontent_data = array(
			
				'sclass' => $this->input->post('sclass'),
				'steacher' => $this->input->post('steacher'),
				'ssubject' => $this->input->post('ssubject'),
				'title' => $this->input->post('title'),
				'file_type' => $this->input->post('file_type')
            );
            $this->db->where('id', $param2);
            $this->db->update('digital_content', $digitalcontent_data);
			redirect('everbright/digitalcontent', 'refresh');
        }

        $page_data = array(
            'page_name' => 'digitalcontent',
            'page_title' => 'Digital Content',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function digitalcontent_add() {	

		
        $page_data = array(
            'page_name' => 'digitalcontent_add',
            'page_title' => 'Digital Content Info: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }

    public function digitalcontent_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'digitalcontent_edit',
            'page_title' => 'Digital Content Info: Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function digitalcontent_edit_file($param1 = '') {
        $page_data = array(
            'page_name' => 'digitalcontent_edit_file',
            'page_title' => 'Digital Content Info: File Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function digitalcontent_delete($id)
		{				
			   $com_info=$this->db->delete('digital_content', array('id' => $id));
				if($com_info==TRUE)
				{  
			  $this->digitalcontent();
				}
		
		}
	/* Digital Content */
	/* Download */
	public function do_upload_download(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|ppt|pptx|bmp",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['title'] = $this->input->post('title');
					$data['page'] = $this->input->post('page');
					$data['date'] = date('Y-m-d H:i:s');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'thumb_image' == $this->main_model->store_pic_data_download($data);
					redirect('everbright/download_add', 'refresh');
				}
				else
				{
					$data['title'] = $this->input->post('title');
					$data['page'] = $this->input->post('page');
					$data['date'] = date('Y-m-d H:i:s');
					'image' == $this->main_model->store_pic_data_download1($data);
				
				redirect('everbright/download_add', 'refresh');
				}    
}
	/* Download File Edit */
	public function do_upload_edit_download_file(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "7680000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['id'] = $this->input->post('id');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'thumb_image' == $this->main_model->store_download_file_data_update($data);
					redirect('everbright/download', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
    public function download($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $download_data = array(
			
				'title' => $this->input->post('title'),
				'page' => $this->input->post('page')
            );
            $this->db->where('id', $param2);
            $this->db->update('download', $download_data);
			redirect('everbright/download', 'refresh');
        }

        $page_data = array(
            'page_name' => 'download',
            'page_title' => 'Download',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function download_add() {	

		
        $page_data = array(
            'page_name' => 'download_add',
            'page_title' => 'Download Info: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }

    public function download_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'download_edit',
            'page_title' => 'Download Info: Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function download_edit_file($param1 = '') {
        $page_data = array(
            'page_name' => 'download_edit_file',
            'page_title' => 'Download Info: File Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function download_delete($id)
		{				
			   $com_info=$this->db->delete('download', array('id' => $id));
				if($com_info==TRUE)
				{  
			  $this->download();
				}
		
		}
	/* Digital Content */
	
	
	/* Academic Calendar */
	public function do_upload_aplan(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|ppt|pptx|bmp|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['title'] = $this->input->post('title');
					$data['page'] = $this->input->post('page');
					$data['date'] = date('Y-m-d H:i:s');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'thumb_image' == $this->main_model->store_pic_data_aplan($data);
					redirect('everbright/aplan_add', 'refresh');
				}
				else
				{
					$data['title'] = $this->input->post('title');
					$data['page'] = $this->input->post('page');
					$data['date'] = date('Y-m-d H:i:s');
					'image' == $this->main_model->store_pic_data_aplan1($data);
				
				redirect('everbright/aplan_add', 'refresh');
				}    
}
	/* Download File Edit */
	public function do_upload_edit_aplan_file(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "7680000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['id'] = $this->input->post('id');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'thumb_image' == $this->main_model->store_aplan_file_data_update($data);
					redirect('everbright/aplan', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
    public function aplan($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $download_data = array(
			
				'title' => $this->input->post('title'),
				'page' => $this->input->post('page')
            );
            $this->db->where('id', $param2);
            $this->db->update('aplan', $download_data);
			redirect('everbright/aplan', 'refresh');
        }

        $page_data = array(
            'page_name' => 'aplan',
            'page_title' => 'Annual Plan',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function aplan_add() {	

		
        $page_data = array(
            'page_name' => 'aplan_add',
            'page_title' => 'Annual Plan Info: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }

    public function aplan_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'aplan_edit',
            'page_title' => 'Annual Plan Info: Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function aplan_edit_file($param1 = '') {
        $page_data = array(
            'page_name' => 'aplan_edit_file',
            'page_title' => 'Annual Plan Info: File Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function aplan_delete($id)
		{				
			   $com_info=$this->db->delete('aplan', array('id' => $id));
				if($com_info==TRUE)
				{  
			  $this->aplan();
				}
		
		}
	/* Annual Plan */
	
	
	
	
	/* Academic Calendar */
	public function do_upload_acalendar(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|ppt|pptx|bmp|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['title'] = $this->input->post('title');
					$data['page'] = $this->input->post('page');
					$data['date'] = date('Y-m-d H:i:s');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'thumb_image' == $this->main_model->store_pic_data_acalendar($data);
					redirect('everbright/acalendar_add', 'refresh');
				}
				else
				{
					$data['title'] = $this->input->post('title');
					$data['page'] = $this->input->post('page');
					$data['date'] = date('Y-m-d H:i:s');
					'image' == $this->main_model->store_pic_data_acalendar1($data);
				
				redirect('everbright/acalendar_add', 'refresh');
				}    
}
	/* Download File Edit */
	public function do_upload_edit_acalendar_file(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "7680000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['id'] = $this->input->post('id');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'thumb_image' == $this->main_model->store_acalendar_file_data_update($data);
					redirect('everbright/acalendar', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
    public function acalendar($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $download_data = array(
			
				'title' => $this->input->post('title'),
				'page' => $this->input->post('page')
            );
            $this->db->where('id', $param2);
            $this->db->update('acalendar', $download_data);
			redirect('everbright/acalendar', 'refresh');
        }

        $page_data = array(
            'page_name' => 'acalendar',
            'page_title' => 'Academic Calendar',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function acalendar_add() {	

		
        $page_data = array(
            'page_name' => 'acalendar_add',
            'page_title' => 'Academic Calendar Info: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }

    public function acalendar_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'acalendar_edit',
            'page_title' => 'Academic Calendar Info: Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function acalendar_edit_file($param1 = '') {
        $page_data = array(
            'page_name' => 'acalendar_edit_file',
            'page_title' => 'Academic Calendar Info: File Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function acalendar_delete($id)
		{				
			   $com_info=$this->db->delete('acalendar', array('id' => $id));
				if($com_info==TRUE)
				{  
			  $this->acalendar();
				}
		
		}
	/* Academic Calendar */
	
	
	
	/* Admission Info*/
	public function do_upload_ainfo(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|ppt|pptx|bmp|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{	
					$data['atype'] = $this->input->post('atype');
					$data['title'] = $this->input->post('title');
					$data['page'] = $this->input->post('page');
					$data['date'] = date('Y-m-d H:i:s');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'thumb_image' == $this->main_model->store_pic_data_ainfo($data);
					redirect('everbright/ainfo_add', 'refresh');
				}
				else
				{
					$data['atype'] = $this->input->post('atype');
					$data['title'] = $this->input->post('title');
					$data['page'] = $this->input->post('page');
					$data['date'] = date('Y-m-d H:i:s');
					'image' == $this->main_model->store_pic_data_ainfo1($data);
				
				redirect('everbright/ainfo_add', 'refresh');
				}    
}
	/* Download File Edit */
	public function do_upload_edit_ainfo_file(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "7680000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['id'] = $this->input->post('id');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'thumb_image' == $this->main_model->store_ainfo_file_data_update($data);
					redirect('everbright/ainfo', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
    public function ainfo($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $download_data = array(
			
				'atype' => $this->input->post('atype'),
				'title' => $this->input->post('title'),
				'page' => $this->input->post('page')
            );
            $this->db->where('id', $param2);
            $this->db->update('ainfo', $download_data);
			redirect('everbright/ainfo', 'refresh');
        }

        $page_data = array(
            'page_name' => 'ainfo',
            'page_title' => 'Admission Info',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function ainfo_add() {	

		
        $page_data = array(
            'page_name' => 'ainfo_add',
            'page_title' => 'Admission Info: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }

    public function ainfo_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'ainfo_edit',
            'page_title' => 'Admission Info: Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function ainfo_edit_file($param1 = '') {
        $page_data = array(
            'page_name' => 'ainfo_edit_file',
            'page_title' => 'Admission Info: File Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function ainfo_delete($id)
		{				
			   $com_info=$this->db->delete('ainfo', array('id' => $id));
				if($com_info==TRUE)
				{  
			  $this->ainfo();
				}
		
		}
	/* Admission Info*/
	
	
	/* Admission Info*/
	public function do_upload_einfo(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|ppt|pptx|bmp|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{	
					$data['atype'] = $this->input->post('atype');
					$data['title'] = $this->input->post('title');
					$data['page'] = $this->input->post('page');
					$data['date'] = date('Y-m-d H:i:s');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'thumb_image' == $this->main_model->store_pic_data_einfo($data);
					redirect('everbright/einfo_add', 'refresh');
				}
				else
				{
					$data['atype'] = $this->input->post('atype');
					$data['title'] = $this->input->post('title');
					$data['page'] = $this->input->post('page');
					$data['date'] = date('Y-m-d H:i:s');
					'image' == $this->main_model->store_pic_data_einfo1($data);
				
				redirect('everbright/einfo_add', 'refresh');
				}    
}
	/* Download File Edit */
	public function do_upload_edit_einfo_file(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "7680000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['id'] = $this->input->post('id');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'thumb_image' == $this->main_model->store_einfo_file_data_update($data);
					redirect('everbright/einfo', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
    public function einfo($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $download_data = array(
			
				'atype' => $this->input->post('atype'),
				'title' => $this->input->post('title'),
				'page' => $this->input->post('page')
            );
            $this->db->where('id', $param2);
            $this->db->update('einfo', $download_data);
			redirect('everbright/einfo', 'refresh');
        }

        $page_data = array(
            'page_name' => 'einfo',
            'page_title' => 'Exam Info',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function einfo_add() {	

		
        $page_data = array(
            'page_name' => 'einfo_add',
            'page_title' => 'Exam Info: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }

    public function einfo_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'einfo_edit',
            'page_title' => 'Exam Info: Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function einfo_edit_file($param1 = '') {
        $page_data = array(
            'page_name' => 'einfo_edit_file',
            'page_title' => 'Exam Info: File Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function einfo_delete($id)
		{				
			   $com_info=$this->db->delete('einfo', array('id' => $id));
				if($com_info==TRUE)
				{  
			  $this->einfo();
				}
		
		}
	/* Exam Info*/
	
	
	
	
	/* Download */
	public function do_upload_aresult(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|ppt|pptx|bmp|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "76800000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['title'] = $this->input->post('title');
					$data['page'] = $this->input->post('page');
					$data['date'] = date('Y-m-d H:i:s');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'thumb_image' == $this->main_model->store_pic_data_aresult($data);
					redirect('everbright/aresult_add', 'refresh');
				}
				else
				{
					$data['title'] = $this->input->post('title');
					$data['page'] = $this->input->post('page');
					$data['date'] = date('Y-m-d H:i:s');
					'image' == $this->main_model->store_pic_data_aresult1($data);
				
				redirect('everbright/aresult_add', 'refresh');
				}    
}
	/* Download File Edit */
	public function do_upload_edit_aresult_file(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "7680000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['id'] = $this->input->post('id');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'thumb_image' == $this->main_model->store_download_file_data_update($data);
					redirect('everbright/aresult', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
    public function aresult($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $download_data = array(
			
				'title' => $this->input->post('title'),
				'page' => $this->input->post('page')
            );
            $this->db->where('id', $param2);
            $this->db->update('aresult', $download_data);
			redirect('everbright/aresult', 'refresh');
        }

        $page_data = array(
            'page_name' => 'aresult',
            'page_title' => 'Academic Result',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function aresult_add() {	

		
        $page_data = array(
            'page_name' => 'aresult_add',
            'page_title' => 'Academic Result Info: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }

    public function aresult_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'aresult_edit',
            'page_title' => 'Academic Result Info: Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function aresult_edit_file($param1 = '') {
        $page_data = array(
            'page_name' => 'aresult_edit_file',
            'page_title' => 'Academic Result Info: File Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function aresult_delete($id)
		{				
			   $com_info=$this->db->delete('aresult', array('id' => $id));
				if($com_info==TRUE)
				{  
			  $this->aresult();
				}
		
		}
	/* Academic Result */
	
	
	/* Class Routine */
	public function do_upload_classroutine(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|ppt|pptx|bmp",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "7680000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['title'] = $this->input->post('title');
					$data['page'] = $this->input->post('page');
					$data['date'] = date('Y-m-d H:i:s');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'thumb_image' == $this->main_model->store_pic_data_classroutine($data);
					redirect('everbright/classroutine_add', 'refresh');
				}
				else
				{
					$data['title'] = $this->input->post('title');
					$data['page'] = $this->input->post('page');
					$data['date'] = date('Y-m-d H:i:s');
					'image' == $this->main_model->store_pic_data_classroutine1($data);
				
				redirect('everbright/classroutine_add', 'refresh');
				}    
}
	/* Download File Edit */
	public function do_upload_edit_classroutine_file(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "76800",
                  'max_width'       => "102400",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['id'] = $this->input->post('id');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'thumb_image' == $this->main_model->store_classroutine_file_data_update($data);
					redirect('everbright/classroutine', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
    public function classroutine($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $classroutine_data = array(
			
				'title' => $this->input->post('title'),
				'page' => $this->input->post('page')
            );
            $this->db->where('id', $param2);
            $this->db->update('classroutine', $classroutine_data);
			redirect('everbright/classroutine', 'refresh');
        }

        $page_data = array(
            'page_name' => 'classroutine',
            'page_title' => 'Class Routine',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function classroutine_add() {	

		
        $page_data = array(
            'page_name' => 'classroutine_add',
            'page_title' => 'Class Routine Info: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }

    public function classroutine_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'classroutine_edit',
            'page_title' => 'Class Routine Info: Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function classroutine_edit_file($param1 = '') {
        $page_data = array(
            'page_name' => 'classroutine_edit_file',
            'page_title' => 'Class Routine Info: File Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function classroutine_delete($id)
		{				
			   $com_info=$this->db->delete('classroutine', array('id' => $id));
				if($com_info==TRUE)
				{  
			  $this->classroutine();
				}
		
		}
	/* Class Routine */
	/* Institution */
	
	
	public function do_upload_institution(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "768000",
                  'max_width'       => "1024000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['id'] = $this->input->post('id');
					$data['ins_title'] = $this->input->post('ins_title');
					$data['ins_name'] = $this->input->post('ins_name');
					$data['eiin'] = $this->input->post('eiin');
					$data['date'] = date('Y-m-d H:i:s');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'image' == $this->main_model->store_pic_data_institution($data);
					redirect('everbright/institution_add', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->institution();
				}    
}

/* Home Content Picture Edit */
	public function do_upload_edit_institution_picture(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "76800",
                  'max_width'       => "102400",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['iid'] = $this->input->post('iid');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'logo' == $this->main_model->store_institution_pic_data_update($data);
					redirect('everbright/institution', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
	
    public function institution($param1 = '', $param2 = '') {
        
        /* edit */
        if ($param1 == 'edit') {
            $banner_data = array(
                
				'id' => $this->input->post('id'),
				'ins_title' => $this->input->post('ins_title'),
				'ins_name' => $this->input->post('ins_name'),
				'eiin' => $this->input->post('eiin')
				
            );
            $this->db->where('iid', $param2);
            $this->db->update('institution', $banner_data);
			redirect('everbright/institution', 'refresh');
        }

        $page_data = array(
            'page_name' => 'institution',
            'page_title' => 'Institution Info.',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
    public function institution_add() {	

		
        $page_data = array(
            'page_name' => 'institution_add',
            'page_title' => 'Institution: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
		
    }

    public function institution_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'institution_edit',
            'page_title' => 'Institution: Edit',
            'sidebar' => 'homecontent_sidebar',
            'iid' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function institution_edit_picture($param1 = '') {
        $page_data = array(
            'page_name' => 'institution_edit_picture',
            'page_title' => 'Institution : Picture Edit',
            'sidebar' => 'homecontent_sidebar',
            'iid' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function institution_delete($iid)
		{				
			   $com_info=$this->db->delete('institution', array('iid' => $iid));
				if($com_info==TRUE)
				{  
			  $this->institution();
				}
		
		}
	/* Institution */
	
	/* Teacher Designation */
    public function desig($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $desig_data = array(
                'name' => $this->input->post('name'),
                'updated_by' => $this->session->userdata('user_id'),
                'updated_at' => date('Y-m-d H:i:s')
            );
            $this->db->insert('designation', $desig_data);


            redirect('everbright/desig', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $desig_data = array(
                'name' => $this->input->post('name'),             
                'updated_at' => date('Y-m-d H:i:s')
            );
            $this->db->where('did', $param2);
            $this->db->update('designation', $desig_data);
			redirect('everbright/desig', 'refresh');
        }

        $page_data = array(
            'page_name' => 'desig',
            'page_title' => 'Designation Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function designation_add() {
        $page_data = array(
            'page_name' => 'designation_add',
            'page_title' => 'Designation: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function desig_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'desig_edit',
            'page_title' => 'Designation: Edit',
            'sidebar' => 'homecontent_sidebar',
            'did' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function desig_delete($did)
		{				
			   $com_info=$this->db->delete('designation', array('did' => $did));
				if($com_info==TRUE)
				{
				  
			  $this->desig();
				}
		
		}
    
	
	/* Teacher Designation */
	
	
	/* Google Map */
    public function googlemap($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $desig_data = array(
                'name' => $this->input->post('name'),
                'date' => date('Y-m-d')
            );
            $this->db->insert('googlemap', $desig_data);


            redirect('everbright/googlemap', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $desig_data = array(
                'name' => $this->input->post('name'),             
                'date' => date('Y-m-d')
            );
            $this->db->where('id', $param2);
            $this->db->update('googlemap', $desig_data);
			redirect('everbright/googlemap', 'refresh');
        }

        $page_data = array(
            'page_name' => 'googlemap',
            'page_title' => 'Google Map',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function googlemap_add() {
        $page_data = array(
            'page_name' => 'googlemap_add',
            'page_title' => 'Google Map: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function googlemap_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'googlemap_edit',
            'page_title' => 'Google Map: Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function googlemap_delete($id)
		{				
			   $com_info=$this->db->delete('googlemap', array('id' => $id));
				if($com_info==TRUE)
				{
				  
			  $this->googlemap();
				}
		
		}
    /* Google Map */
	
	/* Facebook */
    public function facebookpage($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $desig_data = array(
                'name' => $this->input->post('name'),
                'date' => date('Y-m-d')
            );
            $this->db->insert('facebookpage', $desig_data);


            redirect('everbright/facebookpage', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $desig_data = array(
                'name' => $this->input->post('name'),             
                'date' => date('Y-m-d')
            );
            $this->db->where('id', $param2);
            $this->db->update('facebookpage', $desig_data);
			redirect('everbright/facebookpage', 'refresh');
        }

        $page_data = array(
            'page_name' => 'facebookpage',
            'page_title' => 'Facebook Page',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function facebookpage_add() {
        $page_data = array(
            'page_name' => 'facebookpage_add',
            'page_title' => 'Facebook Page: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function facebookpage_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'facebookpage_edit',
            'page_title' => 'Facebook Page: Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function facebookpage_delete($id)
		{				
			   $com_info=$this->db->delete('facebookpage', array('id' => $id));
				if($com_info==TRUE)
				{
				  
			  $this->facebookpage();
				}
		
		}
	
	
	/* Album */
    public function album($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $album_data = array(
                'name' => $this->input->post('name'),
                'date' => date('Y-m-d')
            );
            $this->db->insert('album', $album_data);
            redirect('everbright/album', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $album_data = array(
                'name' => $this->input->post('name'),             
                'date' => date('Y-m-d')
            );
            $this->db->where('album_id', $param2);
            $this->db->update('album', $album_data);
			redirect('everbright/album', 'refresh');
        }

        $page_data = array(
            'page_name' => 'album',
            'page_title' => 'Album Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function album_add() {
        $page_data = array(
            'page_name' => 'album_add',
            'page_title' => 'Album: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function album_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'album_edit',
            'page_title' => 'Album: Edit',
            'sidebar' => 'homecontent_sidebar',
            'album_id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function album_delete($album_id)
		{				
			   $com_info=$this->db->delete('album', array('album_id' => $album_id));
				if($com_info==TRUE)
				{
				  
			  $this->album();
				}
		
		}
    
	
	/* Album */
	
	/* Album */
    public function individualsms($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $album_data = array(
                'mobile_number' => $this->input->post('mobile_number'),
				'sms' => $this->input->post('sms'),
                'date' => date('Y-m-d H:i:s')
            );
            $this->db->insert('individualsms', $album_data);
			
			
			if (true)
		{
			
		
		 $smds=$this->input->post('sms');
		
		
		 $msg=urlencode($smds);						
			 $gsm=$this->input->post('mobile_number');
			 
			 $url = "http://66.45.237.70/api.php?username=01912121010&password=Mizan24680@&number=".$gsm."&message=".$msg;
			
			$CI =& get_instance();			 
				$CI->load->library('curl');	 
				$CI->curl->add_session($url, 'get');
			 $response = $CI->curl->exec();
			if($CI->curl->info('http_code') == '200') 
			{				
			if($response == 'Message Send Successful.'){
				$smssent = true;
				}else{
				$smssent = false;
				}				
			}
			$CI->curl->close();
			
		}
			//////////////////////////////////////////////////////////
			if($smssent){
            redirect('everbright/individualsms', 'refresh');
			}else{
				 redirect('everbright/individualsms', 'refresh');
				}

        }

        /* edit */
        if ($param1 == 'edit') {
            $album_data = array(
                'name' => $this->input->post('name'),             
                'date' => date('Y-m-d')
            );
            $this->db->where('id', $param2);
            $this->db->update('individualsms', $album_data);
			redirect('everbright/individualsms', 'refresh');
        }

        $page_data = array(
            'page_name' => 'individualsms',
            'page_title' => 'Individual SMS Sent',
            'sidebar' => 'report_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function individualsms_add() {
        $page_data = array(
            'page_name' => 'individualsms_add',
            'page_title' => 'Individual SMS : Add',
            'sidebar' => 'report_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function individualsms_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'individualsms_edit',
            'page_title' => 'Individual SMS : Edit',
            'sidebar' => 'report_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function individualsms_delete($id)
		{				
			   $com_info=$this->db->delete('individualsms', array('id' => $id));
				if($com_info==TRUE)
				{
				  
			  $this->individualsms();
				}
		
		}
    
	
	/* Album */
	
	/* Album */
    public function teachersms($param1 = '', $param2 = '') {
        /* add */
	
		
        if ($param1 == 'add') { 
           $tid=$this->input->post('tid');
		  // print_r($tid);
		  // die();
			for($i=0; $i<sizeof($tid); $i++){

			$album_data = array(
					'tid' => $tid[$i],
					'sms' => $this->input->post('sms'),
					'date' => date('Y-m-d H:i:s')
						);
						
						
			$this->db->insert('teachersms', $album_data);
			
			
			
			if (true)
		{
			 //$msg = urlencode("Dear Officer, You've assigned a Ganashunani. Please Login to Our System & Take Necessary Actions.");
			 
			  $myid=$tid[$i];;
			 $query = $this->db->query("select * from teacher where tid='$myid'");
						$row = $query->row_array();
						if (isset($row))
						{
        					
        					
        
		 $smds=$this->input->post('sms');
		 
		 
		
		
		 $msg=urlencode($smds);						
			 $gsm=$row['contact'];
			 $url = "http://66.45.237.70/api.php?username=01912121010&password=Mizan24680@&number=".$gsm."&message=".$msg;
			 
			$CI =& get_instance();			 
				$CI->load->library('curl');	 
				$CI->curl->add_session($url, 'get');
			 $response = $CI->curl->exec();
			if($CI->curl->info('http_code') == '200') 
			{				
			if($response == 'Message Send Successful.'){
				$smssent = true;
				}else{
				$smssent = false;
				}				
			}
			$CI->curl->close();
			}
		}
			//////////////////////////////////////////////////////////
							
			}
			redirect('everbright/teachersms', 'refresh');
			}
		
			

        

        /* edit */
        if ($param1 == 'edit') {
            $album_data = array(
                'name' => $this->input->post('name'),             
                'date' => date('Y-m-d')
            );
            $this->db->where('id', $param2);
            $this->db->update('teachersms', $album_data);
			redirect('everbright/teachersms', 'refresh');
        }

        $page_data = array(
            'page_name' => 'teachersms',
            'page_title' => 'SMS Send to Teacher Group',
            'sidebar' => 'report_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function teachersms_add() {
        $page_data = array(
            'page_name' => 'teachersms_add',
            'page_title' => 'Teacher SMS : Add',
            'sidebar' => 'report_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function teachersms_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'teachersms_edit',
            'page_title' => 'Individual SMS : Edit',
            'sidebar' => 'report_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function teachersms_delete($id)
		{				
			   $com_info=$this->db->delete('teachersms', array('id' => $id));
				if($com_info==TRUE)
				{
				  
			  $this->teachersms();
				}
		
		}
    
	
	/* Album */
	
	/* Student SMS */
    public function studentsms($param1 = '', $param2 = '') {
        /* add */
	
		
        if ($param1 == 'add') { 
           $sID=$this->input->post('sID');

			for($i=0; $i<sizeof($sID); $i++){

			$album_data = array(
					'sID' => $sID[$i],
					'sms' => $this->input->post('sms'),
					'sclass' => $this->input->post('sclass'),
					'shift_name' => $this->input->post('shift_name'),
					'section_name' => $this->input->post('section_name'),
					'date' => date('Y-m-d H:i:s')
						);	
			$this->db->insert('studentsms', $album_data);
			if (true)
		{
			 //$msg = urlencode("Dear Officer, You've assigned a Ganashunani. Please Login to Our System & Take Necessary Actions.");
			 
			$myid=$sID[$i];
			
			$query = $this->db->query("select * from xpert_student where sID='$myid'");
						$row = $query->row_array();
						if (isset($row))
						{
        					
        					
        
		 $smds=$this->input->post('sms');
		 
		 
		
		
		 $msg=urlencode($smds);						
			$gsm=$row['mobile'];
			
			 $url = "http://66.45.237.70/api.php?username=01912121010&password=Mizan24680@&number=".$gsm."&message=".$msg;
			 
			$CI =& get_instance();			 
				$CI->load->library('curl');	 
				$CI->curl->add_session($url, 'get');
			 $response = $CI->curl->exec();
			if($CI->curl->info('http_code') == '200') 
			{				
			if($response == 'Message Send Successful.'){
				$smssent = true;
				}else{
				$smssent = false;
				}				
			}
			$CI->curl->close();
			}
		}
			//////////////////////////////////////////////////////////
							
			}
			redirect('everbright/studentsms', 'refresh');
			}
		
			

        

        /* edit */
        if ($param1 == 'edit') {
            $album_data = array(
                'name' => $this->input->post('name'),             
                'date' => date('Y-m-d')
            );
            $this->db->where('id', $param2);
            $this->db->update('studentsms', $album_data);
			redirect('everbright/studentsms', 'refresh');
        }

        $page_data = array(
            'page_name' => 'studentsms',
            'page_title' => 'SMS Send to Teacher Group',
            'sidebar' => 'report_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function studentsms_add() {
        $page_data = array(
            'page_name' => 'studentsms_add',
            'page_title' => 'Student SMS : Add',
            'sidebar' => 'report_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
	public function studentsmsadd() {
        $page_data = array(
            'page_name' => 'studentsms_add',
            'page_title' => 'Student SMS : Add',
            'sclass' => $this->input->post('sclass'),
			'shift_name' => $this->input->post('shift_name'),
			'section_name' => $this->input->post('section_name'),
            'sidebar' => 'report_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function studentsms_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'studentsms_edit',
            'page_title' => 'Student SMS : Edit',
            'sidebar' => 'report_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function studentsms_delete($id)
		{				
			   $com_info=$this->db->delete('studentsms', array('id' => $id));
				if($com_info==TRUE)
				{
				  
			  $this->studentsms();
				}
		
		}
    
	
	/* Album */
	
	
	/* Student SMS */
    public function studentattendance($param1 = '', $param2 = '') {
        /* add */
	
		
        if ($param1 == 'add') { 
           $sID=$this->input->post('sID');
		$attn=$this->input->post('attendance');
		$religion=$this->input->post('religion');
		$gender=$this->input->post('gender');
			for($i=0; $i<sizeof($sID); $i++){
			
			$album_data = array(
					'sID' => $sID[$i],
					'religion' => $religion[$i],
					'gender' => $gender[$i],
					'class_name' => $this->input->post('sclass'),
					'shift_name' => $this->input->post('shift_name'),
					'section_name' => $this->input->post('section_name'),
					'attendance' => $attn[$i],
					'date' => date('Y-m-d H:i:s')
						);	
			$this->db->insert('studentattendance', $album_data);
			
			if (true)
		{
			 //$msg = urlencode("Dear Officer, You've assigned a Ganashunani. Please Login to Our System & Take Necessary Actions.");
			 
			$myid=$sID[$i];
			
			$query = $this->db->query("select * from xpert_student where sID='$myid'");
						$row = $query->row_array();
						if (isset($row))
						{
        					
        					
        
		 $statusdt=$attn[$i];
		 
		 if($statusdt=='1'){
		 
			$smds="জনাব, আপনার সন্তান  আজ স্কুলে উপস্থিত হয়েছে।";
		 
		 } else {
			
			 $smds="জনাব, আপনার সন্তান  আজ স্কুলে অনুপস্থিত আছে।"; 
			 
		 }
		 
		 
		
		
		 $msg=urlencode($smds);						
			$gsm=$row['mobile'];
			
			 $url = "http://66.45.237.70/api.php?username=01912121010&password=Mizan24680@&number=".$gsm."&message=".$msg;
			 
			$CI =& get_instance();			 
				$CI->load->library('curl');	 
				$CI->curl->add_session($url, 'get');
			 $response = $CI->curl->exec();
			if($CI->curl->info('http_code') == '200') 
			{				
			if($response == 'Message Send Successful.'){
				$smssent = true;
				}else{
				$smssent = false;
				}				
			}
			$CI->curl->close();
			}
		}
			//////////////////////////////////////////////////////////
			}
			redirect('everbright/studentattendance', 'refresh');
			}

        /* edit */
        if ($param1 == 'edit') {
            $album_data = array(
                'name' => $this->input->post('name'),             
                'date' => date('Y-m-d')
            );
            $this->db->where('id', $param2);
            $this->db->update('studentattendance', $album_data);
			redirect('everbright/studentattendance', 'refresh');
        }

        $page_data = array(
            'page_name' => 'studentattendance',
            'page_title' => 'SMS Send to Teacher Group',
            'sidebar' => 'attendance_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function studentattendance_add() {
        $page_data = array(
            'page_name' => 'studentattendance_add',
            'page_title' => 'Student SMS : Add',
            'sidebar' => 'attendance_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
	public function studentattendanceadd() {
        $page_data = array(
            'page_name' => 'studentattendance_add',
            'page_title' => 'Student Attendanc : Add',
            'sclass' => $this->input->post('sclass'),
			'shift_name' => $this->input->post('shift_name'),
			'section_name' => $this->input->post('section_name'),
            'sidebar' => 'attendance_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function studentattendance_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'studentattendance_edit',
            'page_title' => 'Student SMS : Edit',
            'sidebar' => 'attendance_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function studentattendance_delete($id)
		{				
			   $com_info=$this->db->delete('studentattendance', array('id' => $id));
				if($com_info==TRUE)
				{
				  
			  $this->studentattendance();
				}
		
		}
    
	
	/* Album */
	
	public function attendance_report() {
        $page_data = array(
            'page_name' => 'attendance_report',
            'page_title' => 'Student Attendance Report',
            'sidebar' => 'attendance_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function attendancereport() {
        $page_data = array(
            'page_name' => 'attendance_report',
            'page_title' => 'Student Attendance Report',
            'from_date' => $this->input->post('from_date'),
            'to_date' => $this->input->post('to_date'),
			'sclass' => $this->input->post('sclass'),
			'shift_name' => $this->input->post('shift_name'),
			'section_name' => $this->input->post('section_name'),
            'sidebar' => 'attendance_sidebar'
        );
        $this->load->view('index', $page_data);
    }
	
	/* Album */
    public function vgallery($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $album_data = array(
                'vname' => $this->input->post('vname'),
				'vlink' => $this->input->post('vlink'),
                'date' => date('Y-m-d')
            );
            $this->db->insert('vgallery', $album_data);
            redirect('everbright/vgallery', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $album_data = array(
                'vname' => $this->input->post('vname'), 
'vlink' => $this->input->post('vlink'),				
                'date' => date('Y-m-d')
            );
            $this->db->where('id', $param2);
            $this->db->update('vgallery', $album_data);
			redirect('everbright/vgallery', 'refresh');
        }

        $page_data = array(
            'page_name' => 'vgallery',
            'page_title' => 'Video Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function vgallery_add() {
        $page_data = array(
            'page_name' => 'vgallery_add',
            'page_title' => 'Video : Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function vgallery_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'vgallery_edit',
            'page_title' => 'Video : Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function vgallery_delete($id)
		{				
			   $com_info=$this->db->delete('vgallery', array('id' => $id));
				if($com_info==TRUE)
				{
				  
			  $this->vgallery();
				}
		
		}
    
	
	/* Album */
	
	
	/* Result */
    public function result($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $result_data = array(
                'class' => $this->input->post('class'),
				'pass_year' => $this->input->post('pass_year'),
				'total_stu' => $this->input->post('total_stu'),
				'aplus' => $this->input->post('aplus'),
				'normala' => $this->input->post('normala'),
				'aminus' => $this->input->post('aminus'),
				'normalb' => $this->input->post('normalb'),
				'normalc' => $this->input->post('normalc'),
				'normald' => $this->input->post('normald'),
				'percentage' => $this->input->post('percentage'),
                'date' => date('Y-m-d')
            );
            $this->db->insert('result', $result_data);
            redirect('everbright/result', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $result_data = array(
                'class' => $this->input->post('class'),
				'pass_year' => $this->input->post('pass_year'),
				'total_stu' => $this->input->post('total_stu'),
				'aplus' => $this->input->post('aplus'),
				'normala' => $this->input->post('normala'),
				'aminus' => $this->input->post('aminus'),
				'normalb' => $this->input->post('normalb'),
				'normalc' => $this->input->post('normalc'),
				'normald' => $this->input->post('normald'),
				'percentage' => $this->input->post('percentage')
            );
            $this->db->where('id', $param2);
            $this->db->update('result', $result_data);
			redirect('everbright/result', 'refresh');
        }

        $page_data = array(
            'page_name' => 'result',
            'page_title' => 'Result Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function result_add() {
        $page_data = array(
            'page_name' => 'result_add',
            'page_title' => 'Result: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function result_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'result_edit',
            'page_title' => 'Result: Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function result_delete($id)
		{				
			   $com_info=$this->db->delete('result', array('id' => $id));
				if($com_info==TRUE)
				{
				  
			  $this->result();
				}
		
		}
    
	
	/* Album */
	/* Yearly Holiday */
    public function iholiday($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $result_data = array(
                'occasion' => $this->input->post('occasion'),
				'eng_date' => $this->input->post('eng_date'),
				'bangla_date' => $this->input->post('bangla_date'),
				'total_days' => $this->input->post('total_days'),
                'date' => date('Y-m-d')
            );
            $this->db->insert('iholiday', $result_data);
            redirect('everbright/iholiday', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $result_data = array(
                'occasion' => $this->input->post('occasion'),
				'eng_date' => $this->input->post('eng_date'),
				'bangla_date' => $this->input->post('bangla_date'),
				'total_days' => $this->input->post('total_days'),
            );
            $this->db->where('hid', $param2);
            $this->db->update('iholiday', $result_data);
			redirect('everbright/iholiday', 'refresh');
        }

        $page_data = array(
            'page_name' => 'iholiday',
            'page_title' => 'Yearly Holiday Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function iholiday_add() {
        $page_data = array(
            'page_name' => 'iholiday_add',
            'page_title' => 'Yearly Holiday: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function iholiday_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'iholiday_edit',
            'page_title' => 'Yearly Holiday: Edit',
            'sidebar' => 'homecontent_sidebar',
            'hid' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function iholiday_delete($hid)
		{				
			   $com_info=$this->db->delete('iholiday', array('hid' => $hid));
				if($com_info==TRUE)
				{
				  
			  $this->iholiday();
				}
		
		}
    
	
	/* Yearly Holiday */
	/* Department Teacher */
    public function deptteacher($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $deptteacher_data = array(
                'serial' => $this->input->post('serial'),
				'dept_name' => $this->input->post('dept_name'),
				'createp' => $this->input->post('createp'),
				'fillp' => $this->input->post('fillp'),
				'nullp' => $this->input->post('nullp'),
                'date' => date('Y-m-d')
            );
            $this->db->insert('dept_teacher', $deptteacher_data);
            redirect('everbright/deptteacher', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $deptteacher_data = array(
                'serial' => $this->input->post('serial'),
				'dept_name' => $this->input->post('dept_name'),
				'createp' => $this->input->post('createp'),
				'fillp' => $this->input->post('fillp'),
				'nullp' => $this->input->post('nullp')
            );
            $this->db->where('dtid', $param2);
            $this->db->update('dept_teacher', $deptteacher_data);
			redirect('everbright/deptteacher', 'refresh');
        }

        $page_data = array(
            'page_name' => 'deptteacher',
            'page_title' => 'Institution Teacher Summery',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function deptteacher_add() {
        $page_data = array(
            'page_name' => 'deptteacher_add',
            'page_title' => 'Institution Teacher: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function deptteacher_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'deptteacher_edit',
            'page_title' => 'Institution Teacher: Edit',
            'sidebar' => 'homecontent_sidebar',
            'dtid' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function deptteacher_delete($dtid)
		{				
			   $com_info=$this->db->delete('dept_teacher', array('dtid' => $dtid));
				if($com_info==TRUE)
				{
				  
			  $this->deptteacher();
				}
		
		}
    
	
	/* Department Teacher */
		/* Head Teacher */
    public function headteacher($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $headteacher_data = array(
                'sl' => $this->input->post('sl'), 
				'htname' => $this->input->post('htname'),
				'httime' => $this->input->post('httime')
            );
            $this->db->insert('headteacher', $headteacher_data);


            redirect('everbright/headteacher', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $headteacher_data = array(
                'sl' => $this->input->post('sl'), 
				'htname' => $this->input->post('htname'),
				'httime' => $this->input->post('httime'),				
                'date' => date('Y-m-d')
            );
            $this->db->where('id', $param2);
            $this->db->update('headteacher', $headteacher_data);
			redirect('everbright/headteacher', 'refresh');
        }

        $page_data = array(
            'page_name' => 'headteacher',
            'page_title' => 'Institution Head Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function headteacher_add() {
        $page_data = array(
            'page_name' => 'headteacher_add',
            'page_title' => 'Institution Head: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function headteacher_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'headteacher_edit',
            'page_title' => 'Institution Head: Edit',
            'sidebar' => 'homecontent_sidebar',
            'id' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function headteacher_delete($id)
		{				
			   $com_info=$this->db->delete('headteacher', array('id' => $id));
				if($com_info==TRUE)
				{
				  
			  $this->headteacher();
				}
		
		}
    
	
	/* Head Teacher */
	/* Digital Class */
    public function digitalclass($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $digitalclass_data = array(
                'six' => $this->input->post('six'),
				'seven' => $this->input->post('seven'),
				'eight' => $this->input->post('eight'),
				'nine' => $this->input->post('nine'),
				'ten' => $this->input->post('ten'),
                'date' => date('Y-m-d')
            );
            $this->db->insert('digital_class', $digitalclass_data);


            redirect('everbright/digitalclass', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $digitalclass_data = array(
                'six' => $this->input->post('six'),
				'seven' => $this->input->post('seven'),
				'eight' => $this->input->post('eight'),
				'nine' => $this->input->post('nine'),
				'ten' => $this->input->post('ten'),             
                'date' => date('Y-m-d')
            );
            $this->db->where('dcID', $param2);
            $this->db->update('digital_class', $digitalclass_data);
			redirect('everbright/digitalclass', 'refresh');
        }

        $page_data = array(
            'page_name' => 'digitalclass',
            'page_title' => 'Digital Class Info.',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function digitalclass_add() {
        $page_data = array(
            'page_name' => 'digitalclass_add',
            'page_title' => 'Digital Class: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function digitalclass_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'digitalclass_edit',
            'page_title' => 'Digital Class: Edit',
            'sidebar' => 'homecontent_sidebar',
            'dcID' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function digitalclass_delete($dcID)
		{				
			   $com_info=$this->db->delete('digital_class', array('dcID' => $dcID));
				if($com_info==TRUE)
				{
				  
			  $this->digitalclass();
				}
		
		}
    
	
	/* Digital Class */
	/* Teacher Attendance */
    public function teacherattandance($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $teacherattandance_data = array(
                'user_ID' => $this->input->post('user_ID'),
                'user_present' => $this->input->post('user_present'),
				'remark' => $this->input->post('remark'),
                'date' => date('Y-m-d H:i:s')
            );
            $this->db->insert('xpert_attendance', $teacherattandance_data);


            redirect('everbright/teacherattandance_add', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $desig_data = array(
                'name' => $this->input->post('name'),             
                'updated_at' => date('Y-m-d H:i:s')
            );
            $this->db->where('ad_ID', $param2);
            $this->db->update('xpert_attendance', $desig_data);
			redirect('everbright/teacherattandance', 'refresh');
        }

        $page_data = array(
            'page_name' => 'teacherattandance',
            'page_title' => 'Attandance Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function teacherattandance_add() {
        $page_data = array(
            'page_name' => 'teacherattandance_add',
            'page_title' => 'Attandance: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function teacherattandance_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'desig_edit',
            'page_title' => 'Attandance: Edit',
            'sidebar' => 'homecontent_sidebar',
            'ad_ID' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function teacherattandance_delete($ad_ID)
		{				
			   $com_info=$this->db->delete('xpert_attendance', array('ad_ID' => $ad_ID));
				if($com_info==TRUE)
				{
				  
			  $this->teacherattandance();
				}
		
		}
    
	
	/* Teacher Attendance */
	
	
	/* Other Employee Attendance */
    public function oeattandance($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $teacherattandance_data = array(
                'user_ID' => $this->input->post('user_ID'),
                'user_present' => $this->input->post('user_present'),
				'remark' => $this->input->post('remark'),
                'date' => date('Y-m-d H:i:s')
            );
            $this->db->insert('xpert_attendance1', $teacherattandance_data);


            redirect('everbright/oeattandance_add', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $desig_data = array(
                'name' => $this->input->post('name'),             
                'updated_at' => date('Y-m-d H:i:s')
            );
            $this->db->where('ad_ID', $param2);
            $this->db->update('xpert_attendance1', $desig_data);
			redirect('everbright/oeattandance', 'refresh');
        }

        $page_data = array(
            'page_name' => 'oeattandance',
            'page_title' => 'Attandance Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function oeattandance_add() {
        $page_data = array(
            'page_name' => 'oeattandance_add',
            'page_title' => 'Attandance: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function oeattandance_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'desig_edit',
            'page_title' => 'Attandance: Edit',
            'sidebar' => 'homecontent_sidebar',
            'ad_ID' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function oeattandance_delete($ad_ID)
		{				
			   $com_info=$this->db->delete('xpert_attendance1', array('ad_ID' => $ad_ID));
				if($com_info==TRUE)
				{
				  
			  $this->oeattandance();
				}
		
		}
    
	
	/* Teacher Attendance */
	
	
	/* Teacher Leave */
    public function teacherleave($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $teacherleave_data = array(
                'user_ID' => $this->input->post('user_ID'),
                'user_present' => $this->input->post('user_present'),
				'remark' => $this->input->post('remark'),
                'date' => date('Y-m-d H:i:s')
            );
            $this->db->insert('xpert_leave', $teacherleave_data);


            redirect('everbright/teacherleave_add', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $desig_data = array(
                'name' => $this->input->post('name'),             
                'updated_at' => date('Y-m-d H:i:s')
            );
            $this->db->where('ad_ID', $param2);
            $this->db->update('xpert_leave', $desig_data);
			redirect('everbright/teacherleave', 'refresh');
        }

        $page_data = array(
            'page_name' => 'teacherleave',
            'page_title' => 'Leave Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function teacherleave_add() {
        $page_data = array(
            'page_name' => 'teacherleave_add',
            'page_title' => 'Leave: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function teacherleave_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'desig_edit',
            'page_title' => 'Leave: Edit',
            'sidebar' => 'homecontent_sidebar',
            'ad_ID' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function teacherleave_delete($ad_ID)
		{				
			   $com_info=$this->db->delete('xpert_leave', array('ad_ID' => $ad_ID));
				if($com_info==TRUE)
				{
				  
			  $this->teacherleave();
				}
		
		}
    
	
	/* Teacher Leave */
	/* Student */
	public function do_upload_student(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|ppt|pptx|bmp",
                  'overwrite'       => TRUE,
                  'max_size'        => "20480000",  // Can be set to particular file size
                  'max_height'      => "7680000",
                  'max_width'       => "10240000",
				  'encrypt_name'	=> TRUE				  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['jbID'] = $this->input->post('jbID');
					$data['stID'] = $this->input->post('stID');
					$data['s_session'] = $this->input->post('s_session');
					$data['name'] = $this->input->post('name');
					$data['f_name'] = $this->input->post('f_name');
					$data['m_name'] = $this->input->post('m_name');
					$data['religion'] = $this->input->post('religion');
					$data['gender'] = $this->input->post('gender');
					$data['dob'] = $this->input->post('dob');
					$data['class_name'] = $this->input->post('class_name');
					$data['shift_name'] = $this->input->post('shift_name');
					$data['section_name'] = $this->input->post('section_name');
					$data['mobile'] = $this->input->post('mobile');
					$data['bg'] = $this->input->post('bg');
					$data['date'] = date('Y-m-d');
					$upload_data = $this->upload->data();
					$data['pic_file'] = $upload_data['file_name'];
				
					'thumb_image' == $this->main_model->store_pic_data_student($data);
					redirect('everbright/student_add', 'refresh');
				}
				else
				{
					$data['jbID'] = $this->input->post('jbID');
					$data['stID'] = $this->input->post('stID');
					$data['s_session'] = $this->input->post('s_session');
					$data['name'] = $this->input->post('name');
					$data['f_name'] = $this->input->post('f_name');
					$data['m_name'] = $this->input->post('m_name');
					$data['religion'] = $this->input->post('religion');
					$data['gender'] = $this->input->post('gender');
					$data['dob'] = $this->input->post('dob');
					$data['class_name'] = $this->input->post('class_name');
					$data['shift_name'] = $this->input->post('shift_name');
					$data['section_name'] = $this->input->post('section_name');
					$data['mobile'] = $this->input->post('mobile');
					$data['bg'] = $this->input->post('bg');
					$data['date'] = date('Y-m-d');
					'image' == $this->main_model->store_pic_data_student1($data);
				
				redirect('everbright/student_add', 'refresh');
				}    
}
	/* Download File Edit */
	public function do_upload_edit_student_file(){
     $config =  array(
                  'upload_path'     => "./uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|docx|xls|xlsx",
                  'overwrite'       => TRUE,
                  'max_size'        => "2048000",  // Can be set to particular file size
                  'max_height'      => "76800",
                  'max_width'       => "102400",
				  'encrypt_name'	=> TRUE  
                );    
				$this->load->library('upload', $config);
				if($this->upload->do_upload('pic_file'))
				{
					$data['sID'] = $this->input->post('sID');
					$upload_data = $this->upload->data();
				    $data['pic_file'] = $upload_data['file_name'];				
					'thumb_image' == $this->main_model->store_student_file_data_update($data);
					redirect('everbright/student', 'refresh');
				}
				else
				{
				$error = array('error' => $this->upload->display_errors());
				
				$this->load->view('index', $error);
				}    
}
    public function student($param1 = '', $param2 = '') {

        /* edit */
        if ($param1 == 'edit') {
            $student_data = array(
				
			'jbID' => $this->input->post('jbID'),
					'stID' => $this->input->post('stID'),
					's_session' => $this->input->post('s_session'),
					'name' => $this->input->post('name'),
					'f_name' => $this->input->post('f_name'),
					'm_name' => $this->input->post('m_name'),
					'religion' => $this->input->post('religion'),
					'gender' => $this->input->post('gender'),
					'dob' => $this->input->post('dob'),
					'class_name' => $this->input->post('class_name'),
					'shift_name' => $this->input->post('shift_name'),
					'section_name' => $this->input->post('section_name'),
					'mobile' => $this->input->post('mobile'),
					'bg' => $this->input->post('bg'),
			
			
            );
            $this->db->where('sid', $param2);
            $this->db->update('xpert_student', $student_data);
			
			redirect('everbright/student', 'refresh');
        }

        $page_data = array(
            'page_name' => 'student',
            'page_title' => 'Student Information',
            'sidebar' => 'student_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function student_add() {
        $page_data = array(
            'page_name' => 'student_add',
            'page_title' => 'Student: Add',
            'sidebar' => 'student_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function student_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'student_edit',
            'page_title' => 'Student: Edit',
            'sidebar' => 'student_sidebar',
            'sID' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function student_edit_picture($param1 = '') {
        $page_data = array(
            'page_name' => 'student_edit_picture',
            'page_title' => 'Student Info : Picture Edit',
            'sidebar' => 'homecontent_sidebar',
            'sID' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function student_delete($sID)
		{				
			   $com_info=$this->db->delete('xpert_student', array('sID' => $sID));
				if($com_info==TRUE)
				{
				  
			  $this->Student();
				}
		
		}
	/* Student*/
	/* Governing Body */
    public function governingbody($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $governingbody_data = array(
				'serial' => $this->input->post('serial'),
                'name' => $this->input->post('name'),
                'designation' => $this->input->post('designation'),
                'contact_no' => $this->input->post('contact_no'),
                'email' => $this->input->post('email'),
                'date' => date('Y-m-d H:i:s')
            );
            $this->db->insert('governingbody', $governingbody_data);


            redirect('everbright/governingbody_add', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $governingbody_data = array(
                'serial' => $this->input->post('serial'),
                'name' => $this->input->post('name'),
                'designation' => $this->input->post('designation'),
                'contact_no' => $this->input->post('contact_no'),
                'email' => $this->input->post('email')
            );
            $this->db->where('gid', $param2);
            $this->db->update('governingbody', $governingbody_data);
			
			redirect('everbright/governingbody', 'refresh');
        }

        $page_data = array(
            'page_name' => 'governingbody',
            'page_title' => 'Governing Body Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function governingbody_add() {
        $page_data = array(
            'page_name' => 'governingbody_add',
            'page_title' => 'Governing Body: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function governingbody_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'governingbody_edit',
            'page_title' => 'Governing Body: Edit',
            'sidebar' => 'homecontent_sidebar',
            'gid' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function governingbody_delete($gid)
		{				
			   $com_info=$this->db->delete('governingbody', array('gid' => $gid));
				if($com_info==TRUE)
				{
				  
			  $this->governingbody();
				}
		
		}
	/* Governing Body*/
	/*Important Link*/
    public function importantlink($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') { 
            $importantlink_data = array(
				'serial' => $this->input->post('serial'),
                'name' => $this->input->post('name'),
                'link' => $this->input->post('link'),
                'date' => date('Y-m-d H:i:s')
            );
            $this->db->insert('importantlink', $importantlink_data);


            redirect('everbright/importantlink_add', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $importantlink_data = array(
                'serial' => $this->input->post('serial'),
                'name' => $this->input->post('name'),
                'link' => $this->input->post('link')
            );
            $this->db->where('rid', $param2);
            $this->db->update('importantlink', $importantlink_data);
			
			redirect('everbright/importantlink', 'refresh');
        }

        $page_data = array(
            'page_name' => 'importantlink',
            'page_title' => 'Important Link Information',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function importantlink_add() {
        $page_data = array(
            'page_name' => 'importantlink_add',
            'page_title' => 'Important Link: Add',
            'sidebar' => 'homecontent_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function importantlink_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'importantlink_edit',
            'page_title' => 'Important Link: Edit',
            'sidebar' => 'homecontent_sidebar',
            'rid' => $param1
        );
        $this->load->view('index', $page_data);
    }
	public function importantlink_delete($rid)
		{				
			   $com_info=$this->db->delete('importantlink', array('rid' => $rid));
				if($com_info==TRUE)
				{				  
			  $this->importantlink();
				}
		}
	/*Important Link*/
    /* debit_note */

    public function debit($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') {
            $debit_data = array(
                'type' => 'Debit',
                'date' => $this->input->post('date'),
                'invoice_no' => $this->input->post('invoice_no'),
                'to' => $this->input->post('to'),
                'ATTN' => $this->input->post('ATTN'),
                'SHIPPER' => $this->input->post('SHIPPER'),
                'CNEE' => $this->input->post('CNEE'),
                'VOL' => $this->input->post('VOL'),
                'LCNO' => $this->input->post('LCNO'),
                'HBLNO' => $this->input->post('HBLNO'),
                'MBLNO' => $this->input->post('MBLNO'),
                'HAWABLNO' => $this->input->post('HAWABLNO'),
                'MAWBLNO' => $this->input->post('MAWBLNO'),
                'NOSOFCNTRS' => $this->input->post('NOSOFCNTRS'),
                'POL' => $this->input->post('POL'),
                'POD' => $this->input->post('POD'),
                'CARRIER' => $this->input->post('CARRIER'),
                'updated_by' => $this->session->userdata('user_id'),
                'created_at' => date('Y-m-d H:i:s')
            );
            $this->db->insert('debitcredit', $debit_data);
            $debitcredit_id = $this->db->insert_id();

            // freight_invoice
            $dc_amount = $this->input->post('dc_amount');
            if (!empty($dc_amount)) {
                foreach ($dc_amount as $a => $b) {
                    $dc_data = array(
                        'debitcredit_id' => $debitcredit_id,
                        'description' => $this->input->post('dc_description[' . $a . ']'),
                        'unit' => $this->input->post('dc_unit[' . $a . ']'),
                        'amount' => $this->input->post('dc_amount[' . $a . ']'),
                        'ex_rate' => $this->input->post('ex_rate[' . $a . ']'),
                        'updated_by' => $this->session->userdata('user_id'),
                        'created_at' => date('Y-m-d H:i:s')
                    );
                    $this->db->insert('debitcredit_invoice', $dc_data);
                }
            }

            redirect('everbright/debit', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $debit_data = array(
                'date' => $this->input->post('date'),
                'invoice_no' => $this->input->post('invoice_no'),
                'to' => $this->input->post('to'),
                'ATTN' => $this->input->post('ATTN'),
                'SHIPPER' => $this->input->post('SHIPPER'),
                'CNEE' => $this->input->post('CNEE'),
                'VOL' => $this->input->post('VOL'),
                'LCNO' => $this->input->post('LCNO'),
                'HBLNO' => $this->input->post('HBLNO'),
                'MBLNO' => $this->input->post('MBLNO'),
                'HAWABLNO' => $this->input->post('HAWABLNO'),
                'MAWBLNO' => $this->input->post('MAWBLNO'),
                'NOSOFCNTRS' => $this->input->post('NOSOFCNTRS'),
                'POL' => $this->input->post('POL'),
                'POD' => $this->input->post('POD'),
                'CARRIER' => $this->input->post('CARRIER'),
                'updated_by' => $this->session->userdata('user_id'),
                'updated_at' => date('Y-m-d H:i:s')
            );
            $this->db->where('debitcredit_id', $param2);
            $this->db->update('debitcredit', $debit_data);

            // freight_invoice
            $this->db->where('debitcredit_id', $param2);
            $this->db->delete('debitcredit_invoice');

            $dc_amount = $this->input->post('dc_amount');
            if (!empty($dc_amount)) {
                foreach ($dc_amount as $a => $b) {
                    $dc_data = array(
                        'debitcredit_id' => $param2,
                        'description' => $this->input->post('dc_description[' . $a . ']'),
                        'unit' => $this->input->post('dc_unit[' . $a . ']'),
                        'amount' => $this->input->post('dc_amount[' . $a . ']'),
                        'ex_rate' => $this->input->post('ex_rate[' . $a . ']'),
                        'updated_by' => $this->session->userdata('user_id'),
                        'created_at' => date('Y-m-d H:i:s')
                    );
                    $this->db->insert('debitcredit_invoice', $dc_data);
                }
            }

            redirect('everbright/debit', 'refresh');
        }

        $page_data = array(
            'page_name' => 'debit',
            'page_title' => 'Debit Note Information',
            'sidebar' => 'debitcredit_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function debit_add() {
        $page_data = array(
            'page_name' => 'debit_add',
            'page_title' => 'Debit Note: Add',
            'sidebar' => 'debitcredit_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function debit_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'debit_edit',
            'page_title' => 'Debit Note: Edit',
            'sidebar' => 'debitcredit_sidebar',
            'debitcredit_id' => $param1
        );
        $this->load->view('index', $page_data);
    }

    public function debit_view($param1 = '') {
        $page_data = array(
            'page_name' => 'debit_view',
            'page_title' => 'Debit Note: View',
            'sidebar' => 'debitcredit_sidebar',
            'debitcredit_id' => $param1
        );
        $this->load->view('index', $page_data);
    }

    /* credit_note */

    public function credit($param1 = '', $param2 = '') {
        /* add */
        if ($param1 == 'add') {
            $credit_data = array(
                'type' => 'Credit',
                'date' => $this->input->post('date'),
                'invoice_no' => $this->input->post('invoice_no'),
                'to' => $this->input->post('to'),
                'ATTN' => $this->input->post('ATTN'),
                'SHIPPER' => $this->input->post('SHIPPER'),
                'CNEE' => $this->input->post('CNEE'),
                'VOL' => $this->input->post('VOL'),
                'LCNO' => $this->input->post('LCNO'),
                'HBLNO' => $this->input->post('HBLNO'),
                'MBLNO' => $this->input->post('MBLNO'),
                'HAWABLNO' => $this->input->post('HAWABLNO'),
                'MAWBLNO' => $this->input->post('MAWBLNO'),
                'NOSOFCNTRS' => $this->input->post('NOSOFCNTRS'),
                'POL' => $this->input->post('POL'),
                'POD' => $this->input->post('POD'),
                'CARRIER' => $this->input->post('CARRIER'),
                'updated_by' => $this->session->userdata('user_id'),
                'created_at' => date('Y-m-d H:i:s')
            );
            $this->db->insert('debitcredit', $credit_data);
            $debitcredit_id = $this->db->insert_id();

            // freight_invoice
            $dc_amount = $this->input->post('dc_amount');
            if (!empty($dc_amount)) {
                foreach ($dc_amount as $a => $b) {
                    $dc_data = array(
                        'debitcredit_id' => $debitcredit_id,
                        'description' => $this->input->post('dc_description[' . $a . ']'),
                        'unit' => $this->input->post('dc_unit[' . $a . ']'),
                        'amount' => $this->input->post('dc_amount[' . $a . ']'),
                        'ex_rate' => $this->input->post('ex_rate[' . $a . ']'),
                        'updated_by' => $this->session->userdata('user_id'),
                        'created_at' => date('Y-m-d H:i:s')
                    );
                    $this->db->insert('debitcredit_invoice', $dc_data);
                }
            }

            redirect('everbright/credit', 'refresh');
        }

        /* edit */
        if ($param1 == 'edit') {
            $credit_data = array(
                'date' => $this->input->post('date'),
                'invoice_no' => $this->input->post('invoice_no'),
                'to' => $this->input->post('to'),
                'ATTN' => $this->input->post('ATTN'),
                'SHIPPER' => $this->input->post('SHIPPER'),
                'CNEE' => $this->input->post('CNEE'),
                'VOL' => $this->input->post('VOL'),
                'LCNO' => $this->input->post('LCNO'),
                'HBLNO' => $this->input->post('HBLNO'),
                'MBLNO' => $this->input->post('MBLNO'),
                'HAWABLNO' => $this->input->post('HAWABLNO'),
                'MAWBLNO' => $this->input->post('MAWBLNO'),
                'NOSOFCNTRS' => $this->input->post('NOSOFCNTRS'),
                'POL' => $this->input->post('POL'),
                'POD' => $this->input->post('POD'),
                'CARRIER' => $this->input->post('CARRIER'),
                'updated_by' => $this->session->userdata('user_id'),
                'updated_at' => date('Y-m-d H:i:s')
            );
            $this->db->where('debitcredit_id', $param2);
            $this->db->update('debitcredit', $credit_data);

            // freight_invoice
            $this->db->where('debitcredit_id', $param2);
            $this->db->delete('debitcredit_invoice');

            $dc_amount = $this->input->post('dc_amount');
            if (!empty($dc_amount)) {
                foreach ($dc_amount as $a => $b) {
                    $dc_data = array(
                        'debitcredit_id' => $param2,
                        'description' => $this->input->post('dc_description[' . $a . ']'),
                        'unit' => $this->input->post('dc_unit[' . $a . ']'),
                        'amount' => $this->input->post('dc_amount[' . $a . ']'),
                        'ex_rate' => $this->input->post('ex_rate[' . $a . ']'),
                        'updated_by' => $this->session->userdata('user_id'),
                        'created_at' => date('Y-m-d H:i:s')
                    );
                    $this->db->insert('debitcredit_invoice', $dc_data);
                }
            }

            redirect('everbright/credit', 'refresh');
        }

        $page_data = array(
            'page_name' => 'credit',
            'page_title' => 'Credit Note Information',
            'sidebar' => 'debitcredit_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function credit_add() {
        $page_data = array(
            'page_name' => 'credit_add',
            'page_title' => 'Credit Note: Add',
            'sidebar' => 'debitcredit_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function credit_edit($param1 = '') {
        $page_data = array(
            'page_name' => 'credit_edit',
            'page_title' => 'Credit Note: Edit',
            'sidebar' => 'debitcredit_sidebar',
            'debitcredit_id' => $param1
        );
        $this->load->view('index', $page_data);
    }

    public function credit_view($param1 = '') {
        $page_data = array(
            'page_name' => 'credit_view',
            'page_title' => 'Credit Note: View',
            'sidebar' => 'debitcredit_sidebar',
            'debitcredit_id' => $param1
        );
        $this->load->view('index', $page_data);
    }

    /* deliveryorder */

    public function deliveryorder() {
        $deliveryorder_data = array(
            'page_name' => 'deliveryorder',
            'page_title' => 'Delivery Order Information',
            'sidebar' => 'deliveryorder_sidebar'
        );
        $this->load->view('index', $deliveryorder_data);
    }

    public function getData() {
        $query = $this->db->get('customer');
        $data_array = $query->result_array();
        $data = array();
        foreach ($data_array as $value) {
            $data[$value->customer_id] = $value->name;
        }
        return $data;
    }

    public function deliveryorder_frame() {
		$this->gc->unset_delete();
        $output = $this->gc
                ->set_table('deliveryorder')
                ->set_subject('Delivery Order')
                
                ->columns('date', 'deliver_to', 'MBL_no', 'CNTR_no', 'Seal_No', 'GW', 'BE_AC')
                                
                ->set_relation('customer_id', 'customer', 'name')
                ->set_relation('customer_id2', 'customer', 'name')
                        
                ->unset_fields('deliveryorder_id', 'updated_by', 'created_at', 'updated_at')
                        
                ->field_type('PLTS_CTNS_PKGS', 'dropdown', array('PLTS' => 'PLTS', 'CTNS' => 'CTNS', 'PKGS' => 'PKGS'))
                ->field_type('updated_by', 'invisible')->field_type('created_at', 'invisible')->field_type('updated_at', 'invisible')
                
                ->required_fields('date', 'deliver_to')
                ->order_by('deliveryorder_id', 'desc')
                        
                ->display_as('customer_id', 'Customer Name(D/O)')->display_as('customer_id2', 'Customer Name(Mongla)')
                ->display_as('LC_no', 'L/C No')->display_as('POL_POD', 'POL/POD')
                ->display_as('MBL_no', 'MB/L No')->display_as('FVSL_VOY_no', 'FVSL & VOY No.')->display_as('BE_AC', 'B/E, A/C')->display_as('date2', 'Date')
                        
                ->add_action('NOC for D/O Consign', base_url() . 'assets/images/print.png', '', '', array($this, 'printc5'))
                ->add_action('NOC for D/O', base_url() . 'assets/images/print.png', '', '', array($this, 'printc4'))
                ->add_action('NOC', base_url() . 'assets/images/print.png', '', '', array($this, 'printc3'))
                ->add_action('Master Bill Surrender', base_url() . 'assets/images/print.png', '', '', array($this, 'printc2'))
                ->add_action('Delivery Order', base_url() . 'assets/images/print.png', '', '', array($this, 'deliveryorderview'))
                
                ->callback_before_insert(array($this, 'deliveryorder_callback_insert'))
                ->callback_before_update(array($this, 'deliveryorder_callback_update'))
                ->render();

        $this->load->view('frame/deliveryorder.php', $output);
    }

    function deliveryorder_callback_insert($post_array) {
        $post_array['updated_by'] = $this->session->userdata('user_id');
        $post_array['created_at'] = date('Y-m-d H:i:s');
        return $post_array;
    }

    function deliveryorder_callback_update($post_array, $primary_key) {
        $post_array['updated_by'] = $this->session->userdata('user_id');
        $post_array['updated_at'] = date('Y-m-d H:i:s');
        return $post_array;
    }

    function deliveryorderview($primary_key, $row) {
        return site_url('everbright/deliveryorder_view/' . $row->deliveryorder_id);
    }

    public function deliveryorder_view($param1 = '') {
        $deliveryorder_data = array(
            'page_name' => 'deliveryorder_view',
            'deliveryorder_id' => $param1
        );
        $this->load->view('frame/deliveryorder_view.php', $deliveryorder_data);
    }

    /* Statement */

    public function statement() {
        $statement_data = array(
            'page_name' => 'statement',
            'page_title' => 'Statement Information',
            'sidebar' => 'statement_sidebar'
        );
        $this->load->view('index', $statement_data);
    }

    public function statement_frame() {
		$this->gc->unset_delete();
        $output = $this->gc
                ->set_table('statement')
                ->set_subject('Statement')
                ->columns('date', 'job_no', 'master_bill', 'ETD', 'ETA', 'DrNoteRec', 'Ocean_Freight', 'ofex_rate', 'NOC_from', 'Debit_Note', 'ex_rate')
//        ->columns('date','Job_No','HBL','CNEE_Name','VOL','POL_POD','debit','master_bill','ETD','ETA', 'DrNoteRec', 'Ocean_Freight','NOC_from','Total','Debit_Note','ex_rate','Total_Costing','Profit')
                ->fields('date', 'job_no', 'master_bill', 'ETD', 'ETA', 'DrNoteRec', 'Ocean_Freight', 'ofex_rate', 'NOC_from', 'Debit_Note', 'ex_rate', 'updated_by', 'created_at', 'updated_at')
                ->unset_fields('statement_id', 'updated_by', 'created_at', 'updated_at')
                ->field_type('updated_by', 'invisible')->field_type('created_at', 'invisible')->field_type('updated_at', 'invisible')
                ->required_fields('date')
                ->order_by('statement_id', 'desc')
                ->set_relation('job_no','freight','job_no')
                ->display_as('POL_POD', 'POL/POD')->display_as('master_bill', 'Master B/L')->display_as('ofex_rate', 'Ocean Freight Ex. Rate')->display_as('ex_rate', 'Debit Note Ex. Rate')->display_as('freight_id','Job No')->display_as('DrNoteRec', 'Debit Note Receive')
//        ->callback_column('Total',array($this,'total_dr'))
                ->callback_column('Ocean_Freight', array($this, 'dollar'))
                ->callback_field('Ocean_Freight', array($this, 'oceanfreight_sign'))
                ->callback_column('NOC_from', array($this, 'taka'))
                ->callback_field('NOC_from', array($this, 'noc_sign'))
                ->callback_column('Debit_Note', array($this, 'dollar'))
                ->callback_field('Debit_Note', array($this, 'debit_sign'))
                ->callback_before_insert(array($this, 'statement_callback_insert'))
                ->callback_before_update(array($this, 'statement_callback_update'))
                 
                ->render();

        $this->load->view('frame/statement.php', $output);
    }
    /* function statement($primary_key, $row) {
        return site_url('everbright/statement_view_function/' . $row->arrivalNOC_id);
    }

    public function statement_view_function($param1 = '') {
        $statement_data = array(
            'page_name' => 'printc2_view',
            'arrivalNOC_id' => $param1
        );
        $this->load->view('frame/statement_view.php', $statement_data);
    }
*/
//    public function total_dr($value, $row) {
//        //$first = number_format($row->Ocean_Freight, 2, ',', '.');
////        $first = number_format((float)$row->Ocean_Freight,'2','.','');
////        $second = number_format((float)$row->NOC_from,'2','.','');
////        $result = $first*$second;
//        //$result1 = 55*5;
//        return number_format($row->Ocean_Freight*$row->NOC_from,2,'.',',');
//        //return $first;
//    }



    function oceanfreight_sign($value) {
        return '<input type="text" name="Ocean_Freight" value="' . $value . '" style="width:300px"> ( for U.S. only )';
    }

    function noc_sign($value) {
        return '<input type="text" name="NOC_from" value="' . $value . '" style="width:300px"> ( for BDT. only )';
    }

    function debit_sign($value) {
        return '<input type="text" name="Debit_Note" value="' . $value . '" style="width:300px"> ( for U.S. only )';
    }

    function dollar($value) {
        return '&#36; ' . $value;
    }

    function taka($value) {
        return '&#2547; ' . $value;
    }

    function statement_callback_insert($post_array) {
        $post_array['updated_by'] = $this->session->userdata('user_id');
        $post_array['created_at'] = date('Y-m-d H:i:s');
        return $post_array;
    }

    function statement_callback_update($post_array, $primary_key) {
        $post_array['updated_by'] = $this->session->userdata('user_id');
        $post_array['updated_at'] = date('Y-m-d H:i:s');
        return $post_array;
    }

    /* letter */

    public function letter() {
        $letter_data = array(
            'page_name' => 'letter',
            'page_title' => 'Letter Information',
            'sidebar' => 'letter_sidebar'
        );
        $this->load->view('index', $letter_data);
    }

    public function letter_frame() {
		$this->gc->unset_delete();
        $output = $this->gc
                ->set_table('letter')
                ->set_subject('Letter')
                ->columns('date', 'to', 'sub', 'HBL', 'MBL', 'port')
                ->fields('date', 'to', 'sub', 'HBL', 'MBL', 'CNTR_no', 'port', 'NP', 'updated_by', 'created_at', 'updated_at')
                ->unset_fields('letter_id', 'updated_by', 'created_at', 'updated_at')
                ->field_type('updated_by', 'invisible')->field_type('created_at', 'invisible')->field_type('updated_at', 'invisible')
                ->required_fields('date', 'to', 'sub')
                ->order_by('letter_id', 'desc')
                ->callback_before_insert(array($this, 'letter_callback_insert'))
                ->callback_before_update(array($this, 'letter_callback_update'))
                ->add_action('Print', base_url() . 'assets/images/print.png', '', '', array($this, 'letterview'))
				->add_action('Print 2', base_url() . 'assets/images/print.png', '', '', array($this, 'letterview2'))
                ->render();

        $this->load->view('frame/letter.php', $output);
    }

    function letter_callback_insert($post_array) {
        $post_array['updated_by'] = $this->session->userdata('user_id');
        $post_array['created_at'] = date('Y-m-d H:i:s');
        return $post_array;
    }

    function letter_callback_update($post_array, $primary_key) {
        $post_array['updated_by'] = $this->session->userdata('user_id');
        $post_array['updated_at'] = date('Y-m-d H:i:s');
        return $post_array;
    }

    function letterview($primary_key, $row) {
        return site_url('everbright/letter_view/' . $row->letter_id);
    }
    function letterview2($primary_key, $row) {
        return site_url('everbright/letter_view2/' . $row->letter_id);
    }
    public function letter_view($param1 = '') {
        $letter_data = array(
            'page_name' => 'letter_view',
            'letter_id' => $param1
        );
        $this->load->view('frame/letter_view.php', $letter_data);
    }
    public function letter_view2($param1 = '') {
        $letter_data = array(
            'page_name' => 'letter_view2',
            'letter_id' => $param1
        );
        $this->load->view('frame/letter_view2.php', $letter_data);
    }
    /* arrival_noc */
//    public function arrivalnoc() {
//        $arrivalnoc_data = array(
//            'page_name' => 'arrivalnoc',
//            'page_title' => 'Arrival NOC Information',
//            'sidebar' => 'arrivalnoc_sidebar'
//        );
//        $this->load->view('index', $arrivalnoc_data);
//    }

//    public function arrivalnoc_frame() {
//        $output = $this->gc
//                ->set_table('arrivalnoc')
//                ->set_subject('Arrival NOC')
//                ->add_action('NOC', base_url() . 'assets/images/print.png', '', '', array($this, 'printc3'))
//                 ->add_action('Master Bill Surrender', base_url() . 'assets/images/print.png', '', '', array($this, 'printc2'))
//                ->columns('date','serial_no','invoice_no', 'HBL_no', 'master_bill', 'VOL', 'LC_no', 'consignee_name')
//                ->fields('date','serial_no','invoice_no', 'HBL_no', 'master_bill', 'VOL', 'LC_no', 'consignee_name', 'POL_POD', 'ETA', 'updated_by', 'created_at', 'updated_at')
//                ->unset_fields('POL_POD', 'ETA','arrivalNOC_id', 'updated_by', 'created_at', 'updated_at')
//                ->field_type('updated_by', 'invisible')->field_type('created_at', 'invisible')->field_type('updated_at', 'invisible')
//                ->required_fields('date')
//                ->set_relation('serial_no', 'deliveryorder', 'serial_no')
//                ->order_by('arrivalNOC_id', 'desc')
//                ->display_as('master_bill', 'Master B/L')->display_as('serial_no', 'Delivery Order No')->display_as('LC_no', 'L/C No')->display_as('POL_POD', 'POL/POD')
//                ->callback_before_insert(array($this, 'arrivalnoc_callback_insert'))
//                ->callback_before_update(array($this, 'arrivalnoc_callback_update'))
//                
//                ->render();
//
//        $this->load->view('frame/arrivalnoc.php', $output);
//    }

    function printc2($primary_key, $row) {
        return site_url('everbright/print_c_2/' . $row->deliveryorder_id);
    }
    public function print_c_2($param1 = '') {
        $printc2_data = array(
            'page_name' => 'printc2_view',
            'deliveryorder_id' => $param1
        );
        $this->load->view('frame/printc2_view.php', $printc2_data);
    }

    function printc3($primary_key, $row) {
        return site_url('everbright/print_c_3/' . $row->deliveryorder_id);
    }
    public function print_c_3($param1 = '') {
        $printc3_data = array(
            'page_name' => 'printc3_view',
            'deliveryorder_id' => $param1
        );
        $this->load->view('frame/printc3_view.php', $printc3_data);
    }

    function printc4($primary_key, $row) {
        return site_url('everbright/print_c_4/' . $row->deliveryorder_id);
    }
    public function print_c_4($param1 = '') {
        $printc4_data = array(
            'page_name' => 'printc4_view',
            'deliveryorder_id' => $param1
        );
        $this->load->view('frame/printc4_view.php', $printc4_data);
    }
    
    function printc5($primary_key, $row) {
        return site_url('everbright/print_c_5/' . $row->deliveryorder_id);
    }
    public function print_c_5($param1 = '') {
        $printc5_data = array(
            'page_name' => 'printc5_view',
            'deliveryorder_id' => $param1
        );
        $this->load->view('frame/printc5_view.php', $printc5_data);
    }    
//    function arrivalnoc_callback_insert($post_array) {
//        $post_array['updated_by'] = $this->session->userdata('user_id');
//        $post_array['created_at'] = date('Y-m-d H:i:s');
//        return $post_array;
//    }
//
//    function arrivalnoc_callback_update($post_array, $primary_key) {
//        $post_array['updated_by'] = $this->session->userdata('user_id');
//        $post_array['updated_at'] = date('Y-m-d H:i:s');
//        return $post_array;
//    }

    public function receivepayment() {
        $page_data = array(
            'page_name' => 'receivepayment',
            'page_title' => 'Receive/Payment Information',
            'sidebar' => 'receivepayment_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    /* receive */

    public function receive() {
        $receive_data = array(
            'page_name' => 'receive',
            'page_title' => 'Receive Information',
            'sidebar' => 'receivepayment_sidebar'
        );
        $this->load->view('index', $receive_data);
    }

    public function receive_frame() {
		
        $output = $this->gc
                ->where('type', 'Inflow')
                ->set_table('receive_payment')
                ->set_subject('Receive')
                ->columns('date', 'particular', 'HBL_No', 'amount', 'method', 'bank_cnee', 'account_name', 'account_no', 'cheque_no', 'remark')
                ->fields('date', 'type', 'particular', 'HBL_No', 'amount', 'method','bank_cnee', 'account_name', 'account_no', 'cheque_no', 'remark', 'updated_by', 'created_at', 'updated_at')
                ->unset_fields('receive_payment_id', 'updated_by', 'created_at', 'updated_at')
                ->field_type('type', 'invisible')->field_type('updated_by', 'invisible')->field_type('created_at', 'invisible')->field_type('updated_at', 'invisible')
                ->required_fields('date', 'particular', 'amount')
                ->order_by('receive_payment_id', 'desc')
                ->display_as('particular', 'CNEE Name')->display_as('amount', 'Deposit Tk.')->display_as('bank_cnee', 'Bank Name/CNEE')->display_as('account_name', 'Name of Account')
                ->add_action('Print', base_url() . 'assets/images/print.png', '', '', array($this, 'receiveview'))
                ->callback_before_insert(array($this, 'receive_callback_insert'))
                ->callback_before_update(array($this, 'receive_callback_update'))
                ->render();

        $this->load->view('frame/receive.php', $output);
    }

    function receive_callback_insert($post_array) {
        $post_array['type'] = 'Inflow';
        $post_array['updated_by'] = $this->session->userdata('user_id');
        $post_array['created_at'] = date('Y-m-d H:i:s');
        return $post_array;
    }

    function receive_callback_update($post_array, $primary_key) {
        $post_array['updated_by'] = $this->session->userdata('user_id');
        $post_array['updated_at'] = date('Y-m-d H:i:s');
        return $post_array;
    }
    function receiveview($primary_key, $row) {
        return site_url('everbright/receive_view/' . $row->receive_payment_id);
    }
    public function receive_view($param1 = '') {
        $data = array(
            'page_name' => 'receive_view',
            'receive_payment_id' => $param1
        );
        $this->load->view('frame/receive_view', $data);
    }    

    /* payment */
    public function payment() {
        $payment_data = array(
            'page_name' => 'payment',
            'page_title' => 'Payment Information',
            'sidebar' => 'receivepayment_sidebar'
        );
        $this->load->view('index', $payment_data);
    }

    public function payment_frame() {
		
        $output = $this->gc
                ->where('type', 'Outflow')
                ->set_table('receive_payment')
                ->set_subject('Payment')
                ->columns('date', 'particular', 'HBL_No', 'amount', 'method', 'bank_cnee', 'account_name', 'account_no', 'cheque_no', 'remark')
                ->fields('date', 'type', 'particular', 'HBL_No', 'amount', 'method', 'bank_cnee', 'account_name', 'account_no', 'cheque_no', 'remark', 'updated_by', 'created_at', 'updated_at')
                ->unset_fields('receive_payment_id', 'updated_by', 'created_at', 'updated_at')
                ->field_type('type', 'invisible')->field_type('updated_by', 'invisible')->field_type('created_at', 'invisible')->field_type('updated_at', 'invisible')
                ->required_fields('date', 'particular', 'amount')
                ->order_by('receive_payment_id', 'desc')
                ->display_as('particular', 'CNEE Name')->display_as('amount', 'Payment Tk.')->display_as('bank_cnee', 'Bank Name/CNEE')->display_as('account_name', 'Name of Account')
                ->add_action('Print', base_url() . 'assets/images/print.png', '', '', array($this, 'paymentview'))
                ->callback_before_insert(array($this, 'payment_callback_insert'))
                ->callback_before_update(array($this, 'payment_callback_update'))
                ->render();

        $this->load->view('frame/payment.php', $output);
    }

    function payment_callback_insert($post_array) {
        $post_array['type'] = 'Outflow';
        $post_array['updated_by'] = $this->session->userdata('user_id');
        $post_array['created_at'] = date('Y-m-d H:i:s');
        return $post_array;
    }

    function payment_callback_update($post_array, $primary_key) {
        $post_array['updated_by'] = $this->session->userdata('user_id');
        $post_array['updated_at'] = date('Y-m-d H:i:s');
        return $post_array;
    }
    function paymentview($primary_key, $row) {
        return site_url('everbright/payment_view/' . $row->receive_payment_id);
    }
    public function payment_view($param1 = '') {
        $data = array(
            'page_name' => 'payment_view',
            'receive_payment_id' => $param1
        );
        $this->load->view('frame/payment_view', $data);
    } 
    
    /* setup */
    public function setup() {
        $page_data = array(
            'page_name' => 'setup',
            'page_title' => 'Setup Information',
            'sidebar' => 'setup_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    /* company */

    public function company() {
        $page_data = array(
            'page_name' => 'company',
            'page_title' => 'Company Information',
            'sidebar' => 'setup_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function company_frame() {
		$this->gc->unset_delete();
        $output = $this->gc
                ->set_table('company')
                ->set_subject('Company')
                ->columns('name', 'phone', 'email', 'address')
                ->fields('name', 'phone', 'email', 'address', 'updated_by', 'updated_at')
                ->unset_fields('company_id', 'updated_by', 'updated_at')
                ->field_type('updated_by', 'invisible')->field_type('updated_at', 'invisible')
                ->required_fields('name', 'address')
                ->unset_add()->unset_delete()
                ->callback_before_update(array($this, 'company_callback_update'))
                ->render();

        $this->load->view('frame/company.php', $output);
    }

    function company_callback_update($post_array, $primary_key) {
        $post_array['updated_by'] = $this->session->userdata('user_id');
        $post_array['updated_at'] = date('Y-m-d H:i:s');
        return $post_array;
    }

    /* admin */

    public function admin() {
        $page_data = array(
            'page_name' => 'admin',
            'page_title' => 'Admin Information',
            'sidebar' => 'setup_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    /* admin_frame */

    public function admin_frame() {
		$this->gc->unset_delete();
        $output = $this->gc
                ->set_table('user')
                ->set_subject('Admin')
                ->columns('name', 'phone', 'email', 'birthday', 'gender', 'work', 'education', 'address', 'type', 'status')
                ->fields('name', 'phone', 'email', 'password', 'birthday', 'gender', 'work', 'education', 'address', 'type', 'status', 'updated_by', 'created_at', 'updated_at')
                ->unset_fields('id', 'updated_by', 'created_at', 'updated_at')
                ->change_field_type('password', 'password')->field_type('updated_by', 'invisible')->field_type('created_at', 'invisible')->field_type('updated_at', 'invisible')
                ->required_fields('name', 'phone', 'password', 'type', 'status')
                ->order_by('id', 'desc')
                ->callback_before_insert(array($this, 'admin_callback_insert'))
                ->callback_before_update(array($this, 'admin_callback_update'))
                ->unset_read()
                ->render();

        $this->load->view('frame/admin.php', $output);
    }

    function admin_callback_insert($post_array) {
        $post_array['updated_by'] = $this->session->userdata('user_id');
        $post_array['created_at'] = date('Y-m-d H:i:s');
        return $post_array;
    }

    function admin_callback_update($post_array, $primary_key) {
        $post_array['updated_by'] = $this->session->userdata('user_id');
        $post_array['updated_at'] = date('Y-m-d H:i:s');
        return $post_array;
    }

    /* report */

    public function report() {
        $page_data = array(
            'page_name' => 'report',
            'page_title' => 'Report',
            'sidebar' => 'report_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    /* Report: Arrival NOC */

    public function arrivalnoc_report() {
        $page_data = array(
            'page_name' => 'report_arrivalnoc',
            'page_title' => 'Arrival NOC Report',
            'sidebar' => 'report_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function arrivalnocreport() {
        $page_data = array(
            'page_name' => 'report_arrivalnoc',
            'page_title' => 'Arrival NOC Report',
            'from_date' => $this->input->post('from_date'),
            'to_date' => $this->input->post('to_date'),
            'sidebar' => 'report_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    /* Report: Statement */

    public function statement_report() {
        $page_data = array(
            'page_name' => 'report_statement',
            'page_title' => 'Statement Report',
            'sidebar' => 'report_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function statementreport() {
        $page_data = array(
            'page_name' => 'report_statementreport_statement',
            'page_title' => 'Statement Report',
            'from_date' => $this->input->post('from_date'),
            'to_date' => $this->input->post('to_date'),
            'sidebar' => 'report_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    /* Report: Profit & Loss */    
    public function pl_report() {
        $page_data = array(
            'page_name' => 'report_pl',
            'page_title' => 'Profit & Loss',
            'sidebar' => 'report_sidebar'
        );
        $this->load->view('index', $page_data);
    } 
    public function plreport() {
        $page_data = array(
            'page_name' => 'report_pl',
            'page_title' => 'Profit & Loss',
            'invoice_no' => $this->input->post('invoice_no'),
            'sidebar' => 'report_sidebar'
        );
        $this->load->view('index', $page_data);
    }
    
    /* Report: Receive & Payment */

    public function receivepayment_report() {
        $page_data = array(
            'page_name' => 'report_receivepayment',
            'page_title' => 'Receive & Payment Report',
            'sidebar' => 'report_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function receivepaymentreport() {
        $page_data = array(
            'page_name' => 'report_receivepayment',
            'page_title' => 'Receive & Payment Report',
            'from_date' => $this->input->post('from_date'),
            'to_date' => $this->input->post('to_date'),
            'sidebar' => 'report_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function customer() {
        $page_data = array(
            'page_name' => 'customer',
            'page_title' => 'Customer Information',
            'sidebar' => 'setup_sidebar'
        );
        $this->load->view('index', $page_data);
    }

    public function customer_frame() {
        $output = $this->gc
                ->set_table('customer')
                ->set_subject('Customer')
                ->required_fields('name')
                ->render();

        $this->load->view('frame/customer', $output);
    }

}