<?php
class Landingcontentmultistyle_Model extends CI_Model{
        
        function insert($arr)
        {
                






                $this->db->insert('landing_content_multistylepage', $arr);
                return $this->db->insert_id();
                
        }
        
        function update($id, $arr)
        {
        
                $this->db->where('id', $id);
                $this->db->update('landing_content_multistylepage', $arr);
        
        }
        
        function get()
        {       

                    // $this->db->select('landing_content_multistylepage.id,landing_content_multistylepage.main_id,landing_main.title as main_title,landing_content_multistylepage.submenu_id,landing_submenu.title as submenu_title,landing_content_multistylepage.title,landing_content_multistylepage.partaimage1,landing_content_multistylepage.partaimage2,landing_content_multistylepage.partbtext,landing_content_multistylepage.partcimage,landing_content_multistylepage.partcpart2,landing_content_multistylepage.partdpart1,landing_content_multistylepage.partetext,landing_content_multistylepage.partftext,landing_content_multistylepage.partfimage,landing_content_multistylepage.partdimage, landing_content_multistylepage.displayorder, landing_content_multistylepage.updated,landing_main.displayorder as maindisplayorder, landing_submenu.displayorder as submenudisplayorder ');

            $this->db->select('landing_content_multistylepage.id,landing_content_multistylepage.main_id,landing_content_multistylepage.landingpage,landing_content_multistylepage.mainweb,landing_main.title as main_title,landing_content_multistylepage.submenu_id,landing_submenu.title as submenu_title,landing_content_multistylepage.h1,landing_content_multistylepage.h2,landing_content_multistylepage.meta_title,landing_content_multistylepage.meta_keyword,landing_content_multistylepage.meta_description,landing_content_multistylepage.partdimage, landing_content_multistylepage.displayorder, landing_content_multistylepage.updated,landing_main.displayorder as maindisplayorder, landing_submenu.displayorder as submenudisplayorder ');
                    
                    $this->db->order_by("maindisplayorder", "asc");
                    $this->db->order_by("submenudisplayorder", "asc");
                    $this->db->order_by("displayorder","asc");
                    $this->db->from('landing_content_multistylepage');
                    $this->db->join('landing_main', 'landing_content_multistylepage.main_id = landing_main.id');
                    $this->db->join('landing_submenu', 'landing_content_multistylepage.submenu_id = landing_submenu.id');
                    $this->db->where('deleted', 0);
                    $query=$this->db->get();

                return $query->result();
        }
        function getsubmenu($id){
            $this->db->select('id as submenu_id, title as name');
            $this->db->where('main_id', $id);
                $query = $this->db->get('landing_submenu');
                return $query->result();
        }
        function get_id($id){
                $this->db->where('id', $id);
                $query = $this->db->get('landing_content_multistylepage');
                return $query->result();
        }
        
        function get_lang($lang)
        {
                
                $this->db->where('lang', $lang);
                $query = $this->db->get('landing_content_multistylepage');
                return $query->result();
                
        }

        function get_sample_page(){
                $this->db->where('id', 1);
                $query = $this->db->get('samplelanding_content_multistylepage');
                return $query->result();
        }
        
        function delete($id)
        {
                $arr['deleted']=1;
                $this->db->where('id', $id);
                $this->db->update('landing_content_multistylepage', $arr);
        }
        function findpage($page){
        	//echo "search h1";
        	//echo $page;
        	 $this->db->where('h1', urldecode($page));
        	 $this->db->from('landing_content_multistylepage');
        	$query = $this->db->get();
			$ret = $query->row();
			return $ret->id;
        }

        function countNumOfLandingContent(){
            $this->db->select('landing_content_multistylepage.id');
            $this->db->from('landing_content_multistylepage');
            $this->db->join('landing_main', 'landing_content_multistylepage.main_id = landing_main.id');
            $this->db->join('landing_submenu', 'landing_content_multistylepage.submenu_id = landing_submenu.id');
            $this->db->where('deleted', 0);
            $this->db->where('landingpage', 1);
            $query=$this->db->get();
            $num=$query->num_rows();

            return $num;
        }
        function countNumOfMainContent(){
            $this->db->select('landing_content_multistylepage.id');
            $this->db->from('landing_content_multistylepage');
            $this->db->join('landing_main', 'landing_content_multistylepage.main_id = landing_main.id');
            $this->db->join('landing_submenu', 'landing_content_multistylepage.submenu_id = landing_submenu.id');
            $this->db->where('deleted', 0);
            $this->db->where('mainweb', 1);
            $query=$this->db->get();
            $num=$query->num_rows();

            return $num;
        }




        
}

?>