2010年4月12日 星期一

weblink - modify web link

class weblink extends controller{

    function weblink()
    {
        parent::controller();
        $this->culogin->onlogin();
        $this->load->model("weblink_sql","WLINK",TRUE);
    }

    function index()
    {
        $data["atts"] = array("width" => "1024");
        $data["query"] = $this->WLINK->select();
        $frame["body"] = $this->load->view("showlink",$data,TRUE);
        $this->_MainFrame($frame);
    }

    function insert_link_form(){
        $data["row"] = array();
        $data["action"] = "insert_link";
        $frame["body"] = $this->load->view("edit_form",$data,TRUE);
        $this->_MainFrame($frame);
    }

    function edit_form($id){
        $query = $this->WLINK->select($id);
        $data["action"] = "update_link/".$id;
        $data["row"] = $query->row();
        $frame["body"] = $this->load->view("edit_form",$data,TRUE);
        $this->_MainFrame($frame);
    }

    function delete_form($id){
        $query = $this->WLINK->select($id);
        $data["row"] = $query->row();
        $frame["body"] = $this->load->view("delete_form",$data,TRUE);
        $this->_MainFrame($frame);
    }

    function insert_link(){
        $this->WLINK->insert();
        $this->_Redirect();
    }

    function update_link($id){
        $this->WLINK->update($id);
        $this->_Redirect();
    }

    function delete_link($id){
        $this->WLINK->delete($id);
        $this->_Redirect();
    }

    function _Redirect(){
        redirect("weblink","location");
    }

    function _MainFrame($frame = ""){
        $frame["submenu"] = $this->load->view("submenu","",TRUE);
        $frame["leftmenu"] ="";
        $this->cuciload->view("mainframework",$frame);
    }
}



沒有留言:

張貼留言