zoukankan      html  css  js  c++  java
  • yourphp的edit,updata,dele

    参考文件YourphpLibActionUserPostAction.class.php

    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);
        }
    $date['beizhu']= $_POST['beizhu'];
    $r = $m->where('id='.$id)->save($date);
  • 相关阅读:
    About Face 摘录
    断言的使用
    C#中值传递和引用传递
    C++技巧之断言Assert
    About Face 一 目标导向设计
    About Face 二 设计行为与形态
    C++中引用传递与指针传递区别
    一个新的时代SoLoMo
    离散数学笔记算法部分
    汪教授的离散数学20110308 谓词与量词2
  • 原文地址:https://www.cnblogs.com/wesky/p/3753588.html
Copyright © 2011-2022 走看看