Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/10/2011, 19:49
bigwhite
 
Fecha de Ingreso: agosto-2009
Mensajes: 247
Antigüedad: 15 años, 3 meses
Puntos: 10
Respuesta: CRUD generador para CI

Esta generando algo asi:

Código PHP:
        
/* Model by MyCRUDgen   */        
class Blogs_m extends MY_Model /// _M
    
        
public function __construct()
        {
          
parent::__construct();
        }
        
        
/*                                           
        * Below all is generated by MyCRUDgen v0.1  
        * @author: Bozzolo Pablo (2011)
        */                                       
        
        
        /*
        * (C)reate
        */
        
public function createBlog($id_user_blogger=null,$id_user_reviewer=null,$url=null,$name=null,$img=null,$keywords=null,$date_creation_blog=null,$date_submision=null,$date_aproval=null,$approval=null,$rss=null,$pagerank=null,$alexa=null,$freq=null,$price=null,$date_system=null)
        {
          
$ay = array($id_user_blogger=>'id_user_blogger',$id_user_reviewer=>'id_user_reviewer',$url=>'url',$name=>'name',$img=>'img',$keywords=>'keywords',$date_creation_blog=>'date_creation_blog',$date_submision=>'date_submision',$date_aproval=>'date_aproval',$approval=>'approval',$rss=>'rss',$pagerank=>'pagerank',$alexa=>'alexa',$freq=>'freq',$price=>'price',$date_system=>'date_system'); 
            
          
$this->db->insert('blogs',$ay);
          return 
$this->db->affected_rows();
           }
        
        
// Simple Insert: array $data -> blogs
        
public function insertBlog($data)
        {      
          
$this->db->insert('blogs'$data);
          return 
$this->db->affected_rows();
        }
        
        
/* 
        * D(elete)
        */
        
public function deleteBlog($id_blog){
          
$this->db->delete('blogs', array($id_blog=>'id_blog');       
        return 
$this->db->affected_rows();
        }        
        
        
/* 
        * D(elete) generico
        */
        
public function blogDelete($where){
          
        foreach (
$where as $key => $value){
          
$this->db->where($key,$value);
        }                        
       
        return 
$this->db->affected_rows();
        }        
                            
        
/*          
        *  R(read) : get() generico
        */
        
public function blogGet($perpage=50,$start=0,$fields=null,$where=null){         
          if (!
is_null($fields)){
            
$this->db->select($fields);  
          }          
          
          foreach (
$where as $key => $value){
            
$this->db->where($key,$value);
          }    
          
          
$this->db->limit($perpage,$start);
          
$this->db->get('blogs');
      
          return 
$query->result();      
        }        
        
          
/*          
          *  R(read) : get__ by Id
          */
          
public function getIdUserBlogger($id_blog,$where){      
            
$this->db->select('id_user_blogger');
            
            foreach (
$where as $key => $value){
              
$this->db->where($key,$value);
            }                    
            
            
$query $this->db->get('blogs');      
            return 
$query->row();
          }        
          
          
/*          
          *  R(read) : get__ by Id
          */
          
public function getIdUserReviewer($id_blog,$where){      
            
$this->db->select('id_user_reviewer');
            
            foreach (
$where as $key => $value){
              
$this->db->where($key,$value);
            }                    
            
            
$query $this->db->get('blogs');      
            return 
$query->row();
          }        
          
          
/*          
          *  R(read) : get__ by Id
          */
          
public function getUrl($id_blog,$where){      
            
$this->db->select('url');
            
            foreach (
$where as $key => $value){
              
$this->db->where($key,$value);
            }                    
            
            
$query $this->db->get('blogs');      
            return 
$query->row();
          }        
          
          
/*          
          *  R(read) : get__ by Id
          */
          
public function getName($id_blog,$where){      
            
$this->db->select('name');
            
            foreach (
$where as $key => $value){
              
$this->db->where($key,$value);
            }                    
            
            
$query $this->db->get('blogs');      
            return 
$query->row();
          }        
          
          
/*          
          *  R(read) : get__ by Id
          */
          
public function getImg($id_blog,$where){      
            
$this->db->select('img');
            
            foreach (
$where as $key => $value){
              
$this->db->where($key,$value);
            }                    
            
            
$query $this->db->get('blogs');      
            return 
$query->row();
          }        
          
          
/*          
          *  R(read) : get__ by Id
          */
          
public function getKeywords($id_blog,$where){      
            
$this->db->select('keywords');
            
            foreach (
$where as $key => $value){
              
$this->db->where($key,$value);
            }                    
            
            
$query $this->db->get('blogs');      
            return 
$query->row();
          }        
          
          
/*          
          *  R(read) : get__ by Id
          */
          
public function getDateCreationBlog($id_blog,$where){      
            
$this->db->select('date_creation_blog');
            
            foreach (
$where as $key => $value){
              
$this->db->where($key,$value);
            }                    
            
            
$query $this->db->get('blogs');      
            return 
$query->row();
          }        
          
          
/*          
          *  R(read) : get__ by Id
          */
          
public function getDateSubmision($id_blog,$where){      
            
$this->db->select('date_submision');
            
            foreach (
$where as $key => $value){
              
$this->db->where($key,$value);
            }                    
            
            
$query $this->db->get('blogs');      
            return 
$query->row();
          }        
          
          
/*          
          *  R(read) : get__ by Id
          */
          
public function getDateAproval($id_blog,$where){      
            
$this->db->select('date_aproval');
            
            foreach (
$where as $key => $value){
              
$this->db->where($key,$value);
            }                    
            
            
$query $this->db->get('blogs');      
            return 
$query->row();
          }        
          
          
/*          
          *  R(read) : get__ by Id
          */
          
public function getApproval($id_blog,$where){      
            
$this->db->select('approval');
            
            foreach (
$where as $key => $value){
              
$this->db->where($key,$value);
            }                    
            
            
$query $this->db->get('blogs');      
            return 
$query->row();
          }        
          
          ...

                
          
/*          
          *  R(read) : get__ by Id
          */
          
public function getAlexa($id_blog,$where){      
            
$this->db->select('alexa');
            
            foreach (
$where as $key => $value){
              
$this->db->where($key,$value);
            }                    
            
            
$query $this->db->get('blogs');      
            return 
$query->row();
          }        
          
          
/*          
          *  R(read) : get__ by Id
          */
          
public function getFreq($id_blog,$where){      
            
$this->db->select('freq');
            
            foreach (
$where as $key => $value){
              
$this->db->where($key,$value);
            }                    
            
            
$query $this->db->get('blogs');      
            return 
$query->row();
          }        
          
          
/*          
          *  R(read) : get__ by Id
          */
          
public function getPrice($id_blog,$where){      
            
$this->db->select('price');
            
            foreach (
$where as $key => $value){
              
$this->db->where($key,$value);
            }                    
            
            
$query $this->db->get('blogs');      
            return 
$query->row();
          }        
          
          
/*          
          *  R(read) : get__ by Id
          */
          
public function getDateSystem($id_blog,$where){      
            
$this->db->select('date_system');
            
            foreach (
$where as $key => $value){
              
$this->db->where($key,$value);
            }                    
            
            
$query $this->db->get('blogs');      
            return 
$query->row();
          }        
          
          
/*          
          *  U(update) : generico
          *
          *  $data  = array de datos a actualizar
          *  $where = array de condiciones del WHERE
          *
          *  Ejemplo:
          *
          *  $userdata =array('id'=>55,'username'=>'pa','correo'=>'boc@...');          
          *  userUpdate($userdata,array('username'=>'pablo990','role>'=>2));
          */
          
public function blogUpdate($data,$where){           
            foreach (
$where as $key => $value){
              
$this->db->where('$key','$value');
            }
            
$this->db->update('blogs'$data); 
          }
        
          
/*          
          *  U(update) : update by id 
          */
             
public function updateIdUserBlogger($id_blog,$id_user_blogger){
              
$this->db->where('id'$id);
              
$this->db->update('blogs',array('id_user_blogger',$id_user_blogger));
      
              return 
$this->db->affected_rows();
          }        
          
        ....
          
          
/*          
          *  U(update) : update by id 
          */
             
public function updateUrl($id_blog,$url){
              
$this->db->where('id'$id);
              
$this->db->update('blogs',array('url',$url));
      
              return 
$this->db->affected_rows();
          }        
          
          
/*          
          *  U(update) : update by id 
          */
             
public function updateName($id_blog,$name){
              
$this->db->where('id'$id);
              
$this->db->update('blogs',array('name',$name));
      
              return 
$this->db->affected_rows();
          }        
          
          
/*          
          *  U(update) : update by id 
          */
             
public function updateImg($id_blog,$img){
              
$this->db->where('id'$id);
              
$this->db->update('blogs',array('img',$img));
      
              return 
$this->db->affected_rows();
          }        
          
          
/*          
          *  U(update) : update by id 
          */
             
public function updateKeywords($id_blog,$keywords){
              
$this->db->where('id'$id);
              
$this->db->update('blogs',array('keywords',$keywords));
      
              return 
$this->db->affected_rows();
          }        
          
                   
    ....
        ....    
          
          
/*          
          *  U(update) : update by id 
          */
             
public function updateDateSystem($id_blog,$date_system){
              
$this->db->where('id'$id);
              
$this->db->update('blogs',array('date_system',$date_system));
      
              return 
$this->db->affected_rows();
          }        
          
// end model class 
__________________
The best powerful search engine for MSN messenger profiles I know is msn profile viewer. It's really good either if you have an e-mail address or not. Try it!