1 | <?php |
---|
2 | // +-------------------------------------------------+ |
---|
3 | // © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) |
---|
4 | // +-------------------------------------------------+ |
---|
5 | // $Id: export.php,v 1.14 2015-04-03 11:16:22 jpermanne Exp $ |
---|
6 | |
---|
7 | //Interface de lancement de l'import |
---|
8 | $base_path="../.."; |
---|
9 | $base_auth="ADMINISTRATION_AUTH|CATALOGAGE_AUTH"; |
---|
10 | |
---|
11 | $base_title="\$msg[admin_convert_export_titre]"; |
---|
12 | require($base_path."/includes/init.inc.php"); |
---|
13 | |
---|
14 | require_once("$include_path/parser.inc.php"); |
---|
15 | require_once("$include_path/templates/export_form.tpl.php"); |
---|
16 | require_once($class_path."/export_param.class.php"); |
---|
17 | |
---|
18 | |
---|
19 | function _item_($param) { |
---|
20 | global $catalog; |
---|
21 | global $n_typ_total; |
---|
22 | $t['NAME']=$param['EXPORTNAME']; |
---|
23 | $t['INDEX']=$n_typ_total; |
---|
24 | $n_typ_total++; |
---|
25 | if ($param['EXPORT']=="yes") $catalog[]=$t; |
---|
26 | } |
---|
27 | |
---|
28 | //Lecture des différents exports possibles |
---|
29 | $catalog=array(); |
---|
30 | $n_typ_total=0; |
---|
31 | if (file_exists("imports/catalog_subst.xml")) |
---|
32 | $fic_catal = "imports/catalog_subst.xml"; |
---|
33 | else |
---|
34 | $fic_catal = "imports/catalog.xml"; |
---|
35 | |
---|
36 | _parser_($fic_catal, array("ITEM" => "_item_"), "CATALOG"); |
---|
37 | |
---|
38 | //Création de la liste des types d'import |
---|
39 | $export_type="<select name=\"export_type\">\n"; |
---|
40 | for ($i=0; $i<count($catalog); $i++) { |
---|
41 | $export_type.="<option value=\"".$catalog[$i]['INDEX']."\">".$catalog[$i]['NAME']."</option>\n"; |
---|
42 | } |
---|
43 | $export_type.="</select>"; |
---|
44 | |
---|
45 | $form=str_replace("!!export_type!!",$export_type,$form); |
---|
46 | |
---|
47 | //Filtres |
---|
48 | |
---|
49 | //Propriétaires |
---|
50 | $requete="select idlender,lender_libelle from lenders"; |
---|
51 | $lenders="<select name=\"lender\" onChange=\"show_list(this);\">\n"; |
---|
52 | $lenders.="<option value=\"x\">".$msg['admin_convert_propri']."</option>\n"; |
---|
53 | $resultat=pmb_mysql_query($requete); |
---|
54 | while (list($idlender,$lender_libelle)=pmb_mysql_fetch_row($resultat)) { |
---|
55 | $lenders.="<option value=\"$idlender\">".$lender_libelle."</option>\n"; |
---|
56 | } |
---|
57 | $lenders.="</select>\n"; |
---|
58 | $form=str_replace("!!lenders!!",$lenders,$form); |
---|
59 | |
---|
60 | //Types de documents |
---|
61 | $requete="select idlender, lender_libelle from lenders"; |
---|
62 | $resultat=pmb_mysql_query($requete); |
---|
63 | while (list($id_lender,$lender_libelle)=pmb_mysql_fetch_row($resultat)) { |
---|
64 | //Récupération des codes exemplaires du proptiétaire |
---|
65 | $requete="select idtyp_doc, concat(tdoc_libelle) as lib from docs_type, exemplaires, lenders where idtyp_doc=expl_typdoc and expl_owner=$id_lender and (idlender=tdoc_owner or tdoc_owner=0) group by expl_typdoc"; |
---|
66 | $typ_doc_lists.="<div id=\"dtypdoc$id_lender\" style=\"display:none\">"; |
---|
67 | $typ_doc_lists.=gen_liste($requete,"idtyp_doc","lib","typdoc".$id_lender."[]","","","","","","",1); |
---|
68 | $typ_doc_lists.="</div>"; |
---|
69 | } |
---|
70 | //Tous les types |
---|
71 | $requete="select idtyp_doc, concat(tdoc_libelle) as lib from docs_type order by lib"; |
---|
72 | $typ_doc_lists.="<div id=\"dtypdocx\" style=\"display:block\">"; |
---|
73 | $typ_doc_lists.=gen_liste($requete,"idtyp_doc","lib","typdocx[]","","","","","","",1); |
---|
74 | $typ_doc_lists.="</div>"; |
---|
75 | $form=str_replace("!!typ_doc_lists!!",$typ_doc_lists,$form); |
---|
76 | |
---|
77 | //Status |
---|
78 | $requete="select idlender, lender_libelle from lenders"; |
---|
79 | $resultat=pmb_mysql_query($requete); |
---|
80 | while (list($id_lender,$lender_libelle)=pmb_mysql_fetch_row($resultat)) { |
---|
81 | //Récupération des codes exemplaires du propriétaire ayant le statut |
---|
82 | $requete="select idstatut, concat(statut_libelle) as lib from docs_statut, exemplaires, lenders where idstatut=expl_statut and expl_owner=$id_lender and (idlender=statusdoc_owner or statusdoc_owner=0) group by expl_statut"; |
---|
83 | $statut_lists.="<div id=\"dstatut$id_lender\" style=\"display:none\">"; |
---|
84 | $statut_lists.=gen_liste($requete,"idstatut","lib","statut".$id_lender."[]","","","","","","",1); |
---|
85 | $statut_lists.="</div>"; |
---|
86 | } |
---|
87 | //Tous les status |
---|
88 | $requete="select idstatut, concat(statut_libelle) as lib from docs_statut order by lib"; |
---|
89 | $statut_lists.="<div id=\"dstatutx\" style=\"display:block\">"; |
---|
90 | $statut_lists.=gen_liste($requete,"idstatut","lib","statutx[]","","","","","","",1); |
---|
91 | $statut_lists.="</div>"; |
---|
92 | $form=str_replace("!!statut_lists!!",$statut_lists,$form); |
---|
93 | |
---|
94 | $param = new export_param(EXP_DEFAULT_GESTION); |
---|
95 | $form=str_replace("!!form_param!!",$param->check_default_param(),$form); |
---|
96 | echo pmb_bidi($form); |
---|
97 | |
---|
98 | print "</body></html>"; |
---|