SQL = newClass("sql"); } ////////////////////////////////////// //////INHERANT SQL //RECUPERATION DE LA CLE PRIMAIRE public function GetColName($Show_alias = true){ if($Show_alias) return $this->GetTblName(false).".".$this->PrimaryKey; return $this->PrimaryKey; } //RECUPERATION DE LA TABLE public function getTblName($Show_db = true,$Show_prefix = true,$Show_module = true){ $this->TblName = ''; if($Show_db) { $this->TblName.=$this->DbName.'.'; } if($Show_prefix){ $this->TblName.= $this->Appli_prefix ; } if($Show_module){ $this->TblName.=$this->ModulePrefixe; } $this->TblName.= get_class_lower($this); return $this->TblName; } public function Init(){ $this->LoadInTbl(); /*if(db_num_rows($this->CurrentSearch)==1){ }elseif(db_num_rows($this->CurrentSearch)>1){ }*/ } public function LoadInTbl(){ $temp = &Sql::Query("SELECT * FROM ".$this->GetTblName(true,false)." WHERE ".$this->GetColName(false)." = ".$this->getId()); $this->CurrentSearch=$temp->GetRes(); if($this->CurrentSearch){ $this->DATA = db_fetch_array($this->CurrentSearch); }else{ return false; } return true; } //public function __call($Methode,$Arguments){ // echobr("Impossible d'appeller la methode ".$Methode." dans l'objet ".get_class($this)); // exit(); //} function __set($var,$value){ echobr("Set ".$var." à ".$value); $this->{$var} = $value; } function __get($var){ echobr("Get ".$var); return $this->{$var}; } public function GetIdDefaut(){ return 1; } //Methode par defaut de recherche public function Search($W = array(), $T = array(), $O = array(), $L = array() , $G = array()){ $temp = &Sql::SelectConstruct($this,$W,$T,$O,$L,$G); $this->CurrentSearch = $temp->GetRes(); return $temp; } //METHODE¨PAR DEFAUT } ?>