<?php defined('BASEPATH') OR exit('No direct script access allowed');

class OverseasContent extends CI_Model {

    function __construct()
    {
        parent::__construct();
    }
    
    function getOverseascontents($param_var)
    {
        $this->db->from('nchmcblog_oversea');
        
        // $this->db->order_by('rank');
        // $query = $this->db->get();
        // return $query->result();
        $this->db->select('news_id, cp_subject, cp_content, ep_date');
        $this->db->where(array('cp_subject' => $param_var,'ep_web'=>1,'show' => 1));
        // $this->db->where(array('id' => 1));
        // $this->db->order_by('rank');
        $query = $this->db->get()->row();
        return $query;
    }
    // function getCoursecontentsAll()
    // {
    //     $this->db->from('content');
    //     $this->db->where(array('ep_web'=>3));
    //     $this->db->order_by('rank');
    //     // $this->db->from('album');
    //     // $this->db->where(array('show' => 1));
    //     // $this->db->order_by('rank');
    //     $query = $this->db->get();
    //     return $query->result();
    // }
    function buildTopMenuItem()
    {
        $menu = array();
        
        $result = $this->getSectionAll();
        foreach ($result as $row)
        {
            $menu[] = array(
                'name_zh' => $row->cp_name,
                'name_cn' => $row->sp_name,
                'name_en' => $row->ep_name,
                'link' => $row->link
            );
        }
        return $menu;
        
    }
}