<?php
/**
 * Hotels
 * @package     ci-hotel
 * @author      Teruki Hosokawa <hosotk@gmail.com>
 * @licence     New BSD Licence
 */
class Index extends Controller {
    
    public function __construct()
    {
        parent::Controller();
        
        $this->load->helper(array('url'));
        // DBをチェックし、エラーならばインストーラに飛ばす
        if ($this->db->table_exists('system') == false)
        {
            redirect('install/index');
        }
    }
    
    public function index()
    {
        // breadcrumb [admin] -> [hotel]
        
        $this->load->helper(array('url'));
        
        //$this->db->order_by('ordering ASC');
        $this->db->where('status', 1);
        $query = $this->db->get('hotels');
        $data['hotels'] = $query->result_array();
        $this->load->vars($data);
        
        $this->load->view('index/index');
    }
}
