function convert_batch_to_php_array_assoc($notices_to_convert, $target_charset = 'iso-8859-1') { global $charset; if (!$notices_to_convert) { //Rien à faire? On fait rien return; } $xmlexport = new export($notices_to_convert); $current_notice_id = $xmlexport->notice_list[$xmlexport->current_notice]; $parametres = array(); if (is_array($this->params['include_links'])) { $parametres = $this->params['include_links']; } else { if ($this->params["include_links"]) { $parametres["genere_lien"] = 1; //Notices liées, relations entre notices $parametres["mere"] = 1; //Exporter les liens vers les notices mères $parametres["notice_mere"] = 0; //Exporter aussi les notices mères liées $parametres["fille"] = 1; //Exporter les liens vers les notices filles $parametres["notice_fille"] = 0; //Exporter aussi les notices filles liées $parametres["art_link"] = 1; //Exporter les liens vers les articles pour les notices de pério $parametres["notice_art"] = 0; //Exporter aussi les articles pour les notices de pério $parametres["bulletinage"] = 0; //Exporter le bulletinage pour les notices de pério $parametres["bull_link"] = 1; //Exporter les liens vers les bulletins pour les notices d'article $parametres["perio_link"] = 1; //Exporter les liens vers les périodiques pour les notices d'articles $parametres["notice_perio"] = 0; //Exporter aussi les périodiques pour les notices d'articles } } if ($this->params["include_authorite_ids"]) { $parametres["include_authorite_ids"] = true; } $parametres["docnum"] = 1; $keep_expl = isset($this->params["include_items"]) && $this->params["include_items"]; while ($xmlexport->get_next_notice("", array(), array(), $keep_expl, $parametres)) { $xmlexport->to_raw_array(); if ($current_notice_id != -1) { $xmlexport_notice = $xmlexport->notice; $aresult = array(); $headers = array(); if (isset($xmlexport_notice['rs']["value"])) { $headers["rs"] = $xmlexport_notice['rs']["value"]; } if (isset($xmlexport_notice['dt']["value"])) { $headers["dt"] = $xmlexport_notice['dt']["value"]; } if (isset($xmlexport_notice['bl']["value"])) { $headers["bl"] = $xmlexport_notice['bl']["value"]; } if (isset($xmlexport_notice['hl']["value"])) { $headers["hl"] = $xmlexport_notice['hl']["value"]; } if (isset($xmlexport_notice['el']["value"])) { $headers["el"] = $xmlexport_notice['el']["value"]; } if (isset($xmlexport_notice['ru']["value"])) { $headers["ru"] = $xmlexport_notice['ru']["value"]; } $aresult["id"] = $current_notice_id; $aresult["header"] = $headers; $aresult["f"] = array(); foreach ($xmlexport_notice['f'] as &$af) { if (!isset($af["c"])) { continue; } if (!isset($aresult["f"][$af["c"]])) { $aresult["f"][$af["c"]] = array(); } $arf = array(); $arf["ind"] = isset($af["ind"]) ? $af["ind"] : ""; $arf["id"] = isset($af["id"]) ? $af["id"] : ""; if (isset($af["s"])) { foreach ($af["s"] as &$as) { //La classe export exporte ses données dans la charset de la base. //Convertissons si besoin $value = $as["value"]; if ($charset != 'utf-8' && $target_charset == 'utf-8') { $value = utf8_encode($value); } else { if ($charset == 'utf-8' && $target_charset != 'utf-8') { $value = utf8_decode($value); } } if (isset($arf[$as["c"]]) && !is_array($arf[$as["c"]])) { $arf[$as["c"]] = array($arf[$as["c"]]); } if (isset($arf[$as["c"]]) && is_array($arf[$as["c"]])) { $arf[$as["c"]][] = $value; } else { $arf[$as["c"]] = $value; } } } else { if (isset($af["value"])) { $arf["value"] = $af["value"]; } } $aresult["f"][$af["c"]][] = $arf; } $this->results[$current_notice_id] = $aresult; $current_notice_id = $xmlexport->notice_list[$xmlexport->current_notice]; } } }