<?php

/**
 * @filename test.php 
 * @encoding UTF-8 
 * @author 邱伟平 
 * @copyright 连云港龙泽商务有限公司 
 * @datetime 2013-11-6  9:51:12
 * @version 1.0
 * @Description
 * 测试
 */
class Test extends CI_Controller {

    function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->model('model_cmf');
    }

    /*
     * 登录 测试
     */

    public function index() {
        $this->load->library('grocery_CRUD');
        $crud = new grocery_CRUD();
        $crud->set_theme('datatables');
        $table_name = "cms_user";
        $this->model_cmf->setDisplayTag($crud, $table_name);
        $crud->unset_add();
        $crud->unset_read();
        $crud->unset_edit();
        $crud->unset_delete();
        $crud->unset_export();
        $crud->unset_print();

        $crud->columns('email', 'name');

        $crud->add_action('登录', '', 'test/login');

        $output = $crud->render();
        $this->load->view('crud.php', $output);
    }

    /*
     * 登录
     */

    public function login($user_id) {
        $sql = "select * from cms_user where id = ".$user_id;
        $user = $this->db->query($sql)->row();
        $this->session->set_userdata("current_user",$user);
        lz_log($user);
        
        redirect('admin', 'refresh');
    }
    
    public function  info(){
        
        redirect('http://www.baidu.com', 'refresh');
    }

}

/* End of file : user.php */
