fetch_datas(); } protected function fetch_datas(){ global $dbh; $query = "select id_ontology from ontologies order by ontology_name"; $result = pmb_mysql_query($query,$dbh); if(pmb_mysql_num_rows($result)){ while($row = pmb_mysql_fetch_object($result)){ $this->ontologies[$row->id_ontology] = new ontology($row->id_ontology); } } } public function get_modelling_menu(){ global $msg, $charset; $menu = ""; foreach($this->ontologies as $ontology){ $menu.=" get_id())."> ".htmlentities($ontology->get_name(),ENT_QUOTES,$charset)." "; } return $menu; } public function admin_proceed($action,$id){ switch($action){ case 'add' : $ontology = new ontology(); print $ontology->get_form(); break; case 'edit' : print $this->ontologies[$id]->get_form(); break; case "delete" : if(is_object($this->ontologies[$id])){ if($this->ontologies[$id]->delete()){ unset($this->ontologies[$id]); }else{ //loupé } } print $this->get_list(); break; case 'save' : if(!isset($this->ontologies[$id])){ $ontology = new ontology($id); $ontology->get_values_from_form(); $this->ontologies[$ontology->save()] = $ontology; }else{ $this->ontologies[$id]->get_values_from_form(); $this->ontologies[$id]->save(); } default : print $this->get_list(); break; } } public function get_list(){ global $msg,$charset,$ontologies_list,$ontologies_list_item; $list = $ontologies_list; $parity=1; $items = ""; foreach($this->ontologies as $ontology){ if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='$pair_impair'\" onclick=\"document.location='./modelling.php?categ=ontologies&sub=general&act=edit&ontology_id=".$ontology->get_id()."';\" "; $item = str_replace("!!tr_javascript!!",$tr_javascript,$ontologies_list_item); $item = str_replace("!!label!!",htmlentities($ontology->get_name(),ENT_QUOTES,$charset),$item); $item = str_replace("!!description!!",$ontology->get_description(),$item); $item = str_replace("!!id!!",$ontology->get_id(),$item); $items.=$item; } $list = str_replace("!!items!!",$items,$list); return $list; } public function get_semantic_menu(){ global $charset, $ontology_id; $menu=""; foreach($this->ontologies as $ontology){ $menu.="