num_bannette = $num_bannette+0; $this->fetch_data(); } public function fetch_data() { global $msg,$dbh,$charset; $this->descriptors=array(); // les descripteurs... $rqt = "select num_noeud from bannettes_descriptors where num_bannette = '".$this->num_bannette."' order by bannette_descriptor_order"; $res = pmb_mysql_query($rqt); if(pmb_mysql_num_rows($res)){ while($row = pmb_mysql_fetch_object($res)){ $this->descriptors[] = $row->num_noeud; } } } public function get_form(){ global $msg, $charset,$lang; global $dsi_desc_field; global $dsi_desc_first_desc,$dsi_desc_other_desc; $categs = ""; if(count($this->descriptors)){ for ($i=0 ; $idescriptors) ; $i++){ if($i==0) $categ=$dsi_desc_first_desc; else $categ = $dsi_desc_other_desc; //on y va $categ = str_replace('!!icateg!!', $i, $categ); $categ = str_replace('!!categ_id!!', $this->descriptors[$i], $categ); $categorie = new categories($this->descriptors[$i],$lang); $categ = str_replace('!!categ_libelle!!', htmlentities($categorie->libelle_categorie,ENT_QUOTES, $charset), $categ); $categs.=$categ; } $categs = str_replace("!!max_categ!!",count($this->descriptors),$categs); }else{ $categs=$dsi_desc_first_desc; $categs = str_replace('!!icateg!!', 0, $categs) ; $categs = str_replace('!!categ_id!!', "", $categs); $categs = str_replace('!!categ_libelle!!', "", $categs); $categs = str_replace('!!max_categ!!', 1, $categs); } return str_replace("!!cms_categs!!",$categs,$dsi_desc_field); } public function set_properties_from_form() { global $max_categ; $this->descriptors=array(); for ($i=0 ; $i<$max_categ ; $i++){ $categ_id = 'f_categ_id'.$i; global ${$categ_id}; if(${$categ_id} > 0){ $this->descriptors[] = ${$categ_id}; } } } public function save() { static::delete($this->num_bannette); for($i=0 ; $idescriptors) ; $i++){ $rqt = "insert into bannettes_descriptors set num_bannette = '".$this->num_bannette."', num_noeud = '".$this->descriptors[$i]."', bannette_descriptor_order='".$i."'"; pmb_mysql_query($rqt); } } public static function delete($num_bannette=0) { $num_bannette += 0; $del = "delete from bannettes_descriptors where num_bannette = '".$num_bannette."'"; pmb_mysql_query($del); } }// end class