'authors', AUT_TABLE_CATEG => 'categ', AUT_TABLE_PUBLISHERS=> 'publishers', AUT_TABLE_COLLECTIONS => 'collection', AUT_TABLE_SUB_COLLECTIONS => 'sub_collections', AUT_TABLE_SERIES => 'series', AUT_TABLE_TITRES_UNIFORMES => 'titres_uniformes', AUT_TABLE_INDEXINT => 'indexint' ); // définition de la classe de gestion des liens entre autorités class aut_link { function aut_link($aut_table,$id) { $this->aut_table = $aut_table; $this->id = $id; $this->getdata(); } function getdata() { global $dbh,$msg; global $aut_table_name_list; $this->aut_table_name = $aut_table_name_list[$this->aut_table]; $this->aut_list=array(); $rqt="select * from aut_link where (aut_link_from='".$this->aut_table."' and aut_link_from_num='".$this->id."') or ( aut_link_to='".$this->aut_table."' and aut_link_to_num='".$this->id."' and aut_link_reciproc=1) order by aut_link_type "; $aut_res=mysql_query($rqt, $dbh); $i=0; while($row = mysql_fetch_object($aut_res)){ $i++; if($row->aut_link_to==$this->aut_table && $row->aut_link_to_num==$this->id ) { $this->aut_list[$i]["to"]=$row->aut_link_from; $this->aut_list[$i]["to_num"]=$row->aut_link_from_num; $this->aut_list[$i]["reciproc"]=1; } else{ $this->aut_list[$i]["to"]=$row->aut_link_to; $this->aut_list[$i]["to_num"]=$row->aut_link_to_num; $this->aut_list[$i]["reciproc"]=0; } $this->aut_list[$i]["type"]=$row->aut_link_type; //$this->aut_list[$i]["reciproc"]=$row->aut_link_reciproc; $this->aut_list[$i]["comment"]=$row->aut_link_comment; switch($this->aut_list[$i]["to"]){ case AUT_TABLE_AUTHORS : $auteur = new auteur($this->aut_list[$i]["to_num"]); $this->aut_list[$i]["isbd_entry"]=$auteur->isbd_entry; $this->aut_list[$i]["libelle"]="[".$msg["author"]."] ".$auteur->isbd_entry; break; case AUT_TABLE_CATEG : $categ = new category($this->aut_list[$i]["to_num"]); $this->aut_list[$i]["isbd_entry"]=$categ->libelle; $this->aut_list[$i]["libelle"]="[".$msg[110]."] ".$categ->libelle; break; case AUT_TABLE_PUBLISHERS : $ed = new publisher($this->aut_list[$i]["to_num"]) ; $this->aut_list[$i]["isbd_entry"]=$ed->isbd_entry; $this->aut_list[$i]["libelle"]="[".$msg["collection_tpl_publisher"]."] ".$ed->isbd_entry; break; case AUT_TABLE_COLLECTIONS : $subcollection = new collection($this->aut_list[$i]["to_num"]); $this->aut_list[$i]["isbd_entry"]=$subcollection->isbd_entry; $this->aut_list[$i]["libelle"]="[".$msg["coll_search"]."] ".$subcollection->isbd_entry; break; case AUT_TABLE_SUB_COLLECTIONS : $collection = new subcollection($this->aut_list[$i]["to_num"]); $this->aut_list[$i]["isbd_entry"]=$collection->isbd_entry; $this->aut_list[$i]["libelle"]="[".$msg["subcoll_search"]."] ".$collection->isbd_entry; break; case AUT_TABLE_SERIES : $serie = new serie($this->aut_list[$i]["to_num"]); $this->aut_list[$i]["name"]=$serie->name; $this->aut_list[$i]["libelle"]="[".$msg["serie_query"]."] ".$serie->name; break; case AUT_TABLE_TITRES_UNIFORMES : $tu = new titre_uniforme($this->aut_list[$i]["to_num"]); $this->aut_list[$i]["isbd_entry"]=$tu->name; $this->aut_list[$i]["libelle"]="[".$msg["titre_uniforme_search"]."] ".$tu->name; break; case AUT_TABLE_INDEXINT : $indexint = new indexint($this->aut_list[$i]["to_num"]); $this->aut_list[$i]["isbd_entry"]=$indexint->display; $this->aut_list[$i]["libelle"]="[".$msg["indexint_search"]."] ".$indexint->display; break; } } } function get_display($caller="categ_form") { global $msg; if(!count($this->aut_list)) return""; $aut_link_table_select[AUT_TABLE_AUTHORS]='./index.php?lvl=author_see&id=!!to_num!!'; $aut_link_table_select[AUT_TABLE_CATEG]='./index.php?lvl=categ_see&id=!!to_num!!'; $aut_link_table_select[AUT_TABLE_PUBLISHERS]='./index.php?lvl=publisher_see&id=!!to_num!!'; $aut_link_table_select[AUT_TABLE_COLLECTIONS]='./index.php?lvl=coll_see&id=!!to_num!!'; $aut_link_table_select[AUT_TABLE_SUB_COLLECTIONS]='./index.php?lvl=subcoll_see&id=!!to_num!!'; $aut_link_table_select[AUT_TABLE_SERIES]='./index.php?lvl=serie_see&id=!!to_num!!'; $aut_link_table_select[AUT_TABLE_TITRES_UNIFORMES]='./index.php?lvl=titre_uniforme_see&id=!!to_num!!'; $aut_link_table_select[AUT_TABLE_INDEXINT]='./index.php?lvl=indexint_see&id=!!to_num!!'; $marc_table=new marc_list("relationtype_aut"); $liste_type_relation = $marc_table->table; $marc_tableup=new marc_list("relationtype_autup"); $liste_type_relationup = $marc_tableup->table; $aff="
"; foreach ($this->aut_list as $aut) { //print"
";print_r($aut);print"
"; if($aut["reciproc"]) $aff.=$liste_type_relationup[$aut["type"]]." : "; else $aff.=$liste_type_relation[$aut["type"]]." : "; $link=str_replace("!!to_num!!",$aut["to_num"],$aut_link_table_select[$aut["to"]]); $aff.=" ".$aut["libelle"].""; if($aut["comment"]) { $aff.=" (".$aut["comment"].")"; } $aff.="
"; } return $aff; } // fin class }