yourphp的edit,updata,dele

时间:2014-05-28 03:50:25   收藏:0   阅读:334

参考文件Yourphp\Lib\Action\User\PostAction.class.php

bubuko.com,布布扣
public function add()
    {
        $form=new Form();
        $form->isadmin=0;
        $form->doThumb  = $this->Role[$this->_groupid][allowattachment] ? 1 : 0;
        $form->doAttach = $this->Role[$this->_groupid][allowattachment] ? 1 : 0;;
        $this->assign ( form, $form );
        $module = $this->module[$this->moduleid][name]; 
        $template =  file_exists(TMPL_PATH.User/.$this->sysConfig[DEFAULT_THEME]./.$module._edit.html) ? $module.:edit : Post:edit;
        $this->display ( $template);
    }


    public function edit()
    {
        if(!$this->_userid){
            $this->error(L(nologin));
        }
        $id = intval($_REQUEST [id]);        
        $vo = $this->dao->getById ( $id );
         $form=new Form($vo);
        $form->isadmin=0;
        $form->doAttach= $this->Role[$this->_groupid][allowattachment] ? 1 : 0;;
        $form->doThumb  = $this->Role[$this->_groupid][allowattachment] ? 1 : 0;
        $this->assign ( vo, $vo );        
        $this->assign ( form, $form );
        $module = $this->module[$this->moduleid][name]; 
        $template =  file_exists(TMPL_PATH.User/.$this->sysConfig[DEFAULT_THEME]./.$module._edit.html) ? $module.:edit : Post:edit;
        $this->display ( $template);
    }

    /**
     * 录入
     *
     */
    public function insert()
    {
        if($this->moduleid!=6 && !in_array($this->_groupid,explode(,,$this->categorys[$_POST[catid]][postgroup]))) $this->error (L(add_no_postgroup));
        $c=A(Admin/Content);
        $_POST[ip] = get_client_ip();
        $userid = $this->_userid;
        $username =  $this->_username ?  $this->_username : get_safe_replace($_POST[username]);
        $c->insert($this->module[$this->moduleid][name],$this->fields,$userid, $username,$this->_groupid);
    }

    function update()
    {  
        if(!$this->_userid){
            $this->error(L(nologin));
        }
        if($this->moduleid!=6 && !in_array($this->_groupid,explode(,,$this->categorys[$_POST[catid]][postgroup]))) $this->error (L(add_no_postgroup));

        $c=A(Admin/Content);
        $c->update($this->module[$this->moduleid][name],$this->fields);
    }
bubuko.com,布布扣

 

yourphp的edit,updata,dele,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!