id=$id*1; $this->id_parent=0; $query = "select * from notices_relations where relation_type='".$pmb_nomenclature_record_children_link."' and num_notice = ".$this->id; $result = pmb_mysql_query($query,$dbh); if(pmb_mysql_num_rows($result)){ if($row = pmb_mysql_fetch_object($result)){ $this->id_parent=$row->linked_notice; $this->nomenclature_record = new nomenclature_record_child_ui($this->id); } } if(!$this->id_parent){ $this->nomenclature_record = new nomenclature_record_formations_ui($this->id); } } // end of member function __construct public function create_record_child($id_parent){ $this->nomenclature_record = new nomenclature_record_child_ui(); return $this->nomenclature_record->create_record_child($id_parent); } public function get_form(){ $args = "num_record:".$this->id.""; if($this->id_parent){ $args.=",child_detail :\"".addslashes(encoding_normalize::json_encode($this->nomenclature_record->record_child->get_data()))."\""; }else{ $args.=",record_formations :\"".addslashes(encoding_normalize::json_encode($this->nomenclature_record->record_formations->get_data()))."\""; } $div = nomenclature_datastore::get_form(); return $div."
"; } public function save_form(){ if(!$this->id)return; // pas id de notice $this->nomenclature_record->save_form(); } public function delete(){ if(!$this->id)return; // pas id de notice $this->nomenclature_record->delete(); } public function get_isbd(){ return $this->nomenclature_record->get_isbd(); } public static function get_index($id) { global $dbh; global $pmb_nomenclature_record_children_link; $query = "select linked_notice from notices_relations where relation_type='".$pmb_nomenclature_record_children_link."' and num_notice = ".$id; $result = pmb_mysql_query($query,$dbh); if(pmb_mysql_num_rows($result)){ return nomenclature_record_child_ui::get_index($id); }else{ return nomenclature_record_formations_ui::get_index($id); } } } // end of nomenclature_record_formations