Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (15)
Showing
with 155 additions and 776 deletions
'110215' =>
['Label' => $this->_('Evolution du moteur de recherche'),
'Desc' => $this->_('Indexation plus large des titres, auteurs, sujets... pour améliorer la pertinence de la recherche. Introduction de la recherche par expression, en mettant plusieurs mots entre "". Nécessite un export total du SIGB'),
'Image' => '',
'Video' => '',
'Category' => $this->_('Moteur de recherche'),
'Right' => function($feature_description, $user) {return true;},
'Wiki' => 'https://wiki.bokeh-library-portal.org/index.php?title=Indexation_et_Recherche#Pond.C3.A9ration_et_classement_des_r.C3.A9sultats',
'Test' => '',
'Date' => '2022-02-24'],
\ No newline at end of file
'154000' =>
['Label' => $this->_('Zotero : configuration des types de documents, imports multiples'),
'Desc' => $this->_('Vous pouvez maintenant configurer la correspondance entre les types de documents Bokeh et Zotero. Sur le résultat de recherche, possibilité d\'importer plusieurs notices à la fois'),
'Image' => '',
'Video' => 'https://www.youtube.com/watch?v=p1FcWUVWpCQ',
'Category' => $this->_('Zotero'),
'Right' => function($feature_description, $user) {return true;},
'Wiki' => 'https://wiki.bokeh-library-portal.org/index.php?title=Zotero',
'Test' => '',
'Date' => '2022-04-01'],
\ No newline at end of file
- fonctionnalité #110215 : Moteur de recherche : Indexation plus large des titres, auteurs, sujets... pour améliorer la pertinence de la recherche. Introduction de la recherche par expression, en mettant plusieurs mots entre "". Nécessite un export total du SIGB
\ No newline at end of file
- fonctionnalité #154000 : Zotero : Possibilité de configurer les types de documents pour Zotero
\ No newline at end of file
- fonctionnalité #156528 : Magasin de thèmes : Déplacement du bouton "inspector gadget" en haut du composant jumbotron.
\ No newline at end of file
......@@ -4,11 +4,10 @@ Class_ScriptLoader::getInstance()
->addSearchInputToContent($this->_('Filtrer les types de documents'));
$description = (new Class_TableDescription('type_docs'))
->addColumn($this->_('Libellé'), 'label')
->addColumn($this->_('Famille'), 'libelle_famille')
->addColumn($this->_('Type de document Bokeh'), 'label')
->addColumn($this->_('Famille serveur de cache'), 'libelle_famille')
->addColumn($this->_('Type de document Zotero'), 'display_label_zotero')
->addRowAction(function($model) { return $this->renderPluginsActions($model); });
echo $this->renderTable($description,
$this->type_docs);
?>
......@@ -149,7 +149,7 @@ class RechercheController extends ZendAfi_Controller_Action {
return $this->_redirect('opac/recherche/simple');
}
$notice_meta = Class_Notice_MetaData::newFor($notice);
$notice_meta = new Class_Notice_MetaData($notice);
$notice_meta->injectIntoScriptLoader(Class_ScriptLoader::getInstance());
$this->_addInspectorGadgetForRecord($notice);
......
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZoteroController extends ZendAfi_Controller_Action {
use Trait_Yaz;
public function exportAction() : self {
session_write_close();
if (!$this->_getParam('id')){
$this->getResponse()->setHeader('Content-Type', 'text/xml;charset=utf-8');
$this->getHelper('ViewRenderer')->setNoRender();
echo '<?xml version="1.0" encoding="utf-8"?>'
.'<formats>'
. ((new Class_AdminVar_Zotero)->isRis() ? '<format name="ris" type="text/plain" />'
: '<format name="marcxml" type="application/xml" />')
.'</formats>';
return $this;
}
$id_notice = $this->_getParam('id') ;
if (!$notice = Class_Notice::find($id_notice))
return $this;
if ((new Class_AdminVar_Zotero)->isMarcXML())
return $this->marcxml($notice);
return $this->ris($notice) ;
}
public function ris(Class_Notice $notice) : self {
$this->getResponse()->setHeader('Content-Type', 'text/plain;charset=utf-8');
$this->getHelper('ViewRenderer')->setNoRender();
$builder = new Class_Notice_MetaData($notice);
echo $builder->generateRisContent();
return $this;
}
public function marcxml(Class_Notice $notice) : self {
$this->getResponse()->setHeader('Content-Type', 'text/xml;charset=utf-8');
$this->getHelper('ViewRenderer')->setNoRender();
$marc= static::getYaz()->marcToMarcXml($notice->getUnimarc());
echo implode(BR, $marc);
return $this;
}
}
......@@ -6,9 +6,6 @@
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title><?php echo $this->escape($this->titre); ?></title>
<?php $current_profil = Class_Profil::getCurrentProfil(); ?>
<meta name="description" content="<?php echo $current_profil->getCommentaire();?>" />
<meta name="keywords" content="<?php echo $current_profil->getRefTags();?>" />
<meta content="all" name="robots" />
<meta content="10 days" name="revisit-after" />
<meta content="width=device-width, initial-scale=1, maximun-scale=1" name="viewport" />
......
<?php
echo $this->tagZotero([ $this->notice ]);
echo $this->renderRecord($this->notice);
......@@ -34,15 +34,12 @@ if($_SESSION["passe"] == "catalogueur")
<a href="<?php print(URL_BASE . "index.php?action=logout");?>" target="_top"><img src="<?php print(URL_IMG); ?>deconnexion.gif" style="cursor:pointer;margin-top:5px;margin-left:10px" title="Se déconnecter" border="0"></a>
<div class="menu_section">Recherches</div>
<?php
ligneMenu("Recherche de notices","recherche_recherche.php");
ligneMenu("Accès notices par identifiants","recherche_identifiants.php");
?>
<div class="menu_section">Autorités et codifications</div>
<?php
ligneMenu("Auteurs","codif_auteur.php");
ligneMenu("Matières","codif_matiere.php");
ligneMenu("Indices Dewey","codif_dewey.php");
ligneMenu("Indices PCDM4","codif_pcdm4.php");
?>
<div class="menu_section">Statistiques</div>
<?php
......@@ -83,11 +80,9 @@ else
?>
<div class="menu_section">Recherches</div>
<?php
ligneMenu("Recherche de notices","recherche_recherche.php");
ligneMenu("Accès notices par identifiants","recherche_identifiants.php");
ligneMenu("Nuages de tags Auteurs","recherche_tags_auteurs.php");
ligneMenu("Nuages de tags tous mots","recherche_tags.php");
ligneMenu("Recherche guidée","recherche_guide.php?mode=INTRO");
?>
<div class="menu_section">Configurations</div>
<?php
......@@ -106,8 +101,6 @@ else
ligneMenu("Emplacements", '../cosmozend/cosmo/emplacement');
ligneMenu("Auteurs","codif_auteur.php");
ligneMenu("Matières","codif_matiere.php");
ligneMenu("Indices Dewey","codif_dewey.php");
ligneMenu("Indices PCDM4","codif_pcdm4.php");
ligneMenu("Facettes dynamiques","../cosmozend/cosmo/facets/index");
?>
<div class="menu_section">Statistiques</div>
......@@ -143,4 +136,4 @@ function ligneMenu( $texte, $url,$confirmation=false)
print($texte);
print('</a></div>');
}
?>
\ No newline at end of file
?>
<?PHP
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class dewey {
public function getIndicesSanslibelle($indice, $limite) {
global $sql;
$liste = [];
if ($indice)
$where = "and id_dewey like '$indice%'";
$handle = $sql->prepareListe("Select id_dewey from codif_dewey Where LENGTH(id_dewey)=$limite and libelle ='' ".$where." order by id_dewey");
while ($indice = $sql->fetchNext($handle,true))
$liste[] = $this->formatIndice($indice);
return $liste;
}
static function getIndices($pere) {
global $sql;
if ($pere == "root")
return $sql->fetchAll("select * from codif_dewey where LENGTH(id_dewey)=1 order by id_dewey");
$long = strlen($pere)+1;
$req = "select * from codif_dewey where id_dewey like '$pere%' and LENGTH(id_dewey)=$long order by id_dewey";
return $sql->fetchAll($req);
}
static function formatIndice($indice) {
if(strlen($indice)< 4)
return $indice;
$new = '';
while(strlen($indice) > 3) {
$new .= substr($indice,0,3) . ".";
$indice = substr($indice, 3, strlen($indice));
}
return $new . $indice;
}
static function filtreIndice($indice) {
$indice = trim($indice);
if(strlen($indice) > 18)
return false;
if(substr($indice,1,1) == ".")
return ''; // si c'est de la pcdm4 on dégage
$new = '';
for($i=0; $i < strlen($indice); $i++) {
$car = $indice[$i];
if ($car >= "0" and $car <= "9")
$new .= $car;
}
return $new;
}
static function getLibelle($indice) {
global $sql;
$libelle = $sql->fetchOne("select libelle from codif_dewey where id_dewey='$indice'");
if(!$libelle)
$libelle = dewey::formatIndice($indice) . " - intitulé non renseigné";
return $libelle;
}
public function ecrire($indice, $libelle) {
global $sql;
$indice = trim($indice);
$indice = str_replace(".", "", $indice);
$libelle = trim(str_replace("'", "''", $libelle));
if($indice == "")
return false;
$controle = $sql->fetchOne("select count(*) from codif_dewey where id_dewey='$indice'");
if (0 == $controle) {
$sql->execute("insert into codif_dewey (id_dewey,libelle) Values('$indice','$libelle')");
return 1;
}
// Maj du libelle
$sql->execute("Update codif_dewey set libelle='$libelle' Where id_dewey='$indice'");
// Maj des mots-recherche pour le nouveau libelle
$this->majFulltext($indice);
return 1;
}
public function majFulltext($indice) {
global $sql;
require_once("classe_indexation.php");
$ix = new indexation();
$indice = trim($indice);
$indice = str_replace(".","",$indice);
$code = "+D".$indice;
$liste = $sql->prepareListe("select id_notice,facettes from notices where match(facettes) against('".$code."' IN BOOLEAN MODE)");
if(!$liste)
return;
while($ligne = $sql->fetchNext($liste))
$this->_updateRecord($ligne, $ix);
}
protected function _updateRecord($ligne, $ix) {
global $sql;
$id_notice = $ligne["id_notice"];
$facets = explode(" ", $ligne["facettes"]);
foreach ($faces as $facet) {
if (!$facet)
continue;
$code = substr($facet, 0, 1);
$map = ['D' => 'dewey', 'P' => 'pcdm4'];
if (!array_key_exists($code, $map))
continue;
$value = substr($facet, 1);
if ($libelle = $sql->fetchOne("select libelle from codif_". $map[$code] . " where id_" . $map[$code] . "='" . $value ."'"))
$fulltext .= ' ' . $libelle;
}
$fulltext = $ix->getFulltext($fulltext);
$sql->execute("update notices set dewey='$fulltext' where id_notice=$id_notice");
}
}
?>
\ No newline at end of file
......@@ -20,16 +20,16 @@
*/
class indexation extends Class_Indexation {
protected static $phonetixCache = [];
protected static $phonetixCache = [];
public function phonetix($sIn) {
if (strlen($sIn)<4 || is_numeric($sIn))
return false;
public function phonetix(string $sIn) : string {
if (strlen($sIn)<4 || is_numeric($sIn))
return '';
return isset(static::$phonetixCache[$sIn])
? static::$phonetixCache[$sIn]
: static::$phonetixCache[$sIn] = $this->phonetixCompute($sIn);
}
return isset(static::$phonetixCache[$sIn])
? static::$phonetixCache[$sIn]
: static::$phonetixCache[$sIn] = $this->phonetixCompute($sIn);
}
}
?>
\ No newline at end of file
?>
......@@ -99,6 +99,7 @@ class notice_archive_calice
$notice["collation"] = $this->getCollation();
$notice["notes"] = $this->getNotes();
$notice["exportable"] = true;
$notice['other_terms'] = [];
// clefs d'index
$notice["alpha_titre"]=$this->indexation->codeAlphaTitre($notice["titre_princ"]." ".$notice["tome_alpha"]);
......@@ -211,11 +212,9 @@ class notice_archive_calice
// ----------------------------------------------------------------
// Collection
// ----------------------------------------------------------------
public function getCollection()
{
return trim($this->champs[7]);
}
public function getCollection() : array {
return [trim($this->champs[7])];
}
// ----------------------------------------------------------------
// Notes
// ----------------------------------------------------------------
......
......@@ -110,7 +110,7 @@ class notice_ascii
$notice["titres"]="";
$notice["auteurs"]=$this->enreg["auteurs"];
$notice["editeur"]=$this->enreg["editeur"];
$notice["collection"]=$this->enreg["collection"];
$notice["collection"] = [$this->enreg["collection"]];
$notice["matieres"]=$this->enreg["matieres"];
$notice["tome_alpha"] = $this->enreg["tome_alpha"];
$notice["annee"] = $this->enreg["annee"];
......@@ -119,6 +119,7 @@ class notice_ascii
$notice["data"] = $this->enreg["data"];
$notice["warnings"]=array();
$notice["id_commerciale"] = '';
$notice['other_terms'] = [];
if($this->enreg["isbn"])
{
......@@ -191,4 +192,4 @@ class notice_ascii
return $this->erreur;
}
}
?>
\ No newline at end of file
?>
......@@ -91,6 +91,7 @@ class notice_avenio {
$notice['titre_princ'] = $notice['titres'][0];
$notice['auteurs'] = $this->getAuteurs();
$notice['auteurs_renvois'] = [];
$notice['other_terms'] = [];
$notice['editeur'] = $this->getEditeur();
$notice['lieu_edition'] = $this->getLieuEdition();
$notice['collection'] = $this->getCollection();
......@@ -210,8 +211,8 @@ class notice_avenio {
}
public function getCollection(){
return trim($this->champs[10]);
public function getCollection() : array {
return [trim($this->champs[10])];
}
......
......@@ -574,7 +574,7 @@ class notice_integration {
$this->traiteFacettes();
$notice = Class_Notice::newInstance($this->noticeToDBEnreg());
$notice->save();
(new Class_Notice_Indexation($notice))->indexAndSave();
$this->statut = static::RECORD_INSERT;
return $notice->getId();
......@@ -585,15 +585,8 @@ class notice_integration {
$record = ['type_doc' => $this->notice['type_doc'],
'alpha_titre' => $this->notice['alpha_titre'],
'alpha_auteur' => $this->notice['alpha_auteur'],
'titres' => $this->indexation->getfullText(array_merge($this->notice['titres'],
[$this->notice['clef_chapeau'],
$this->notice['tome_alpha']])),
'auteurs' => $this->indexation->getfullText($this->_getFulltextAuthors()),
'other_terms'=> $this->indexation->getfulltext($this->notice['other_terms']),
'editeur' => $this->indexation->getfullText($this->notice['editeur']),
'collection' => $this->indexation->getfullText($this->notice['collection']),
'matieres' => $this->indexation->getfullText($this->_getFulltextSubjects()),
'dewey' => $this->indexation->getfullText($this->notice['full_dewey']),
'matieres' => $this->indexation->getFulltext($this->_getFulltextSubjects()),
'dewey' => $this->indexation->getFulltext($this->notice['full_dewey']),
'file_content' => $this->notice['file_content'],
'facettes' => $this->notice['facettes'],
'isbn' => $this->notice['isbn'],
......@@ -621,31 +614,9 @@ class notice_integration {
}
protected function _getFulltextAuthors() {
if (!$this->notice['auteurs'])
return $this->notice["200_f"];
return array_merge($this->notice["auteurs"],
$this->notice["auteurs_renvois"],
$this->_getCodifAuteurRenvois());
}
protected function _getCodifAuteurRenvois() {
$see_also = [];
foreach($this->notice['auteurs'] as $author) {
if (($codif = $this->_getCodifAuthorFor($author))
&& $codif->hasMotsRenvois())
$see_also[] = $codif->getMotsRenvois();
}
return $see_also;
}
protected function _getFulltextSubjects() {
protected function _getFulltextSubjects() : array {
if (!$this->notice['matieres'])
return ;
return [];
return array_merge($this->notice["matieres"],
$this->notice["matieres_renvois"],
......@@ -653,7 +624,7 @@ class notice_integration {
}
protected function _getCodifSubjectsRenvois() {
protected function _getCodifSubjectsRenvois() : array {
$see_also = [];
foreach($this->notice['matieres'] as $subject) {
......@@ -923,7 +894,7 @@ class notice_integration {
}
public function traiteFacettes($id_notice=null) {
public function traiteFacettes($id_notice=null) : self {
$facettes = [];
// Tags
......@@ -937,7 +908,7 @@ class notice_integration {
}
// Dewey
$this->notice["full_dewey"] = '';
$this->notice["full_dewey"] = [];
if($this->notice["dewey"])
{
foreach($this->notice["dewey"] as $indice)
......@@ -949,7 +920,7 @@ class notice_integration {
}
$this->notice["full_dewey"] .= $dewey->getLibelle()." ";
$this->notice["full_dewey"] [] = $dewey->getLibelle();
$facettes[]= $dewey->asFacet();
}
}
......@@ -973,7 +944,7 @@ class notice_integration {
if (empty($thesaurus))
continue;
if ($thesaurus->getLibelle())
$this->notice["full_dewey"] .= $thesaurus->getLibelle().' ';
$this->notice["full_dewey"] [] = $thesaurus->getLibelle();
$facettes[]= $thesaurus->asFacet();
}
}
......@@ -1008,7 +979,7 @@ class notice_integration {
}
$facettes[] = $centre_interet->asFacet();
$this->notice["full_dewey"] .= $interet." ";
$this->notice["full_dewey"] [] = $interet;
}
}
......@@ -1031,7 +1002,7 @@ class notice_integration {
{
$facettes[]= Class_CodifGenre::CODE_FACETTE . $genre;
if ($codif_genre = Class_CodifGenre::find($genre))
$this->notice["full_dewey"] .= ' ' . $codif_genre->getLibelle();
$this->notice["full_dewey"] [] = $codif_genre->getLibelle();
}
}
......@@ -1043,13 +1014,14 @@ class notice_integration {
// Maj enreg facette
$this->notice["facettes"] = trim(implode(' ', array_unique($facettes)));
return $this;
}
protected function _processPCDM4($indice) {
$pcdm4 = Class_CodifPcdm4::getOrCreate($indice);
$this->notice["full_dewey"] .= $pcdm4->getLibelle()." ";
$this->notice["full_dewey"] [] = $pcdm4->getLibelle();
return $pcdm4->getFacetCode();
}
......
......@@ -21,8 +21,6 @@
require_once 'classe_profil_donnees.php';
require_once 'classe_iso2709.php';
require_once 'classe_dewey.php';
require_once 'classe_pcdm4.php';
require_once 'classe_indexation.php';
require_once("Class/Isbn.php");
require_once 'classe_codif_cache.php';
......@@ -43,8 +41,6 @@ class notice_unimarc extends iso2709_record {
const FIELD_RECORDISNEW = 4;
const FIELD_INTERESTZONE = 6;
static protected $CHAR_NSB, $CHAR_NSE;
private $id_profil; // Id du profil de données pour le fichier chargé
private $profil_unimarc; // Instance du profil unimarc pour optimiser
private $type_doc_force; // Type de document forcé dans maj_auto
......@@ -69,7 +65,6 @@ class notice_unimarc extends iso2709_record {
$this->copyright = explode(';', $data);
$this->controle_codes_barres = getVariable('controle_codes_barres');
$this->ean345 = getVariable('ean_345');
$this->_setNonSortingCharacters();
// Règles sections, genres, emplacements
$this->_codif_rules = new Class_Codification_RulesHelper();
......@@ -77,18 +72,6 @@ class notice_unimarc extends iso2709_record {
}
protected function _setNonSortingCharacters(){
if (($intbib = Class_IntBib::find($this->_id_bib))
&& $intbib->isCommFlora()) {
static::$CHAR_NSB = chr(0xc2) . chr(0x98); // NON SORTING BLOCK BEGIN
static::$CHAR_NSE = chr(0xc2) . chr(0x9c); // NON SORTING BLOCK END
return;
}
static::$CHAR_NSB = chr(0xc2) . chr(0x88); // NON SORTING BLOCK BEGIN
static::$CHAR_NSE = chr(0xc2) . chr(0x89); // NON SORTING BLOCK END
}
public function setCodificationRules($codification_rules) {
$this->_codif_rules = $codification_rules;
return $this;
......@@ -217,19 +200,8 @@ class notice_unimarc extends iso2709_record {
$notice["titre_princ"] = $this->getTitrePrincipal();
$notice["alpha_titre"] = $this->indexation->codeAlphaTitre($notice["titre_princ"]." ".$notice["tome_alpha"]);
$notice["id_commerciale"] = $this->getIdCommerciale($notice["alpha_titre"]);
$notice["titres"] = $this->getTitres();
$notice["auteurs"] = $this->getAuteurs();
$notice["auteurs_renvois"] = $this->getAuteursRenvois();
// si pas d'auteur on prend le 200$f
if(!$notice["auteurs"]) {
$notice["200_f"] = $this->get200f();
$notice["alpha_auteur"] = '';
} else {
$notice["alpha_auteur"] = $this->indexation->alphaMaj($notice["auteurs"][0]);
}
$notice["other_terms"] = $this->getOtherIndexedTerms();
$notice["editeur"] = $this->getEditeur();
$notice["collection"] = $this->getCollection();
$notice["auteurs"] = (new Class_Notice_Authors($this))->getAllAuthors();
$notice["alpha_auteur"] = $this->indexation->alphaMaj($notice["auteurs"][0] ?? '');
$notice["matieres"] = $this->getMatieresLabels();
$notice["matieres_renvois"] = $this->getMatieresRenvois();
$notice["annee"] = $this->getAnnee();
......@@ -422,11 +394,11 @@ class notice_unimarc extends iso2709_record {
switch($this->profil["id_article_periodique"])
{
case Class_IntProfilDonnees::SERIAL_FORMAT_PERGAME:
$titre = array_map([$this, 'filtreTitre'], $this->get_subfield("461","t"));
$numero = $this->get_subfield("461","v");
$notice["clef_chapeau"] = $this->indexation->codeAlphaTitre($titre[0]);
$titre = (new Class_Notice_Titles($this))->getTitleSerial();
$numero = $this->get_subfield("461", "v");
$notice["clef_chapeau"] = $this->indexation->codeAlphaTitre($titre);
$notice["clef_numero"] = $this->indexation->alphaMaj($numero[0]);
$notice["titre_numero"] = $titre[0]." n° ".$numero[0];
$notice["titre_numero"] = $titre . ' n° ' . $numero[0];
break;
case Class_IntProfilDonnees::SERIAL_FORMAT_ALOES_INDEXPRESS:
......@@ -477,15 +449,7 @@ class notice_unimarc extends iso2709_record {
public function getTitrePrincipal() {
$titres_field = $this->get_subfield('200');
if (!$titres_field)
return '';
$titre = implode(' ',array_unique($this->get_subfield('200','a')));
$titre = $this->filtreTitre($titre);
return $titre;
return (new Class_Notice_Titles($this))->getMainTitle();
}
......@@ -1261,51 +1225,12 @@ class notice_unimarc extends iso2709_record {
public function getTitres() {
$zones = getVariable('unimarc_zone_titre');
$zones = explode(';', trim($zones));
$titre = [];
foreach($zones as $elem) {
$zone = substr($elem, 0, 3);
$champ = substr($elem, -1, 1);
$data = $this->get_subfield($zone);
foreach($data as $items) {
$sous_champs = $this->decoupe_bloc_champ($items);
foreach($sous_champs as $item) {
if($item["code"] == $champ) {
$item = trim($item['valeur']);
if($item)
$titre[] = $this->filtreTitre($item);
}
}
}
}
return($titre);
}
/** first one only */
public function getComplementTitre() {
if (!$titre = $this->get_subfield('200', 'e'))
return '';
return $this->filtreTitre($titre[0]);
return (new Class_Notice_Titles($this))->getTitles();
}
private function filtreTitre($valeur) {
$titre = trim($valeur);
$titre = str_replace(['[', '<', static::$CHAR_NSB, static::$CHAR_NSE], '', $titre);
$titre = str_replace([']', '>'], ' ', $titre);
if (substr($titre, 0, 1) == '?') {
$deb = substr($titre, 0, 6);
$titre = str_replace('?', '', $deb) . substr($titre, 6);
}
$titre = trim($titre);
if(in_array(substr($titre, -1, 1), ['/', ';', ',', '.', ':', '-']))
$titre = substr($titre, 0, strlen($titre) - 1);
return trim($titre);
public function getComplementTitre() : string {
return (new Class_Notice_Titles($this))->getTitleSupplement();
}
......@@ -1338,88 +1263,25 @@ class notice_unimarc extends iso2709_record {
}
public function getAuteurs() {
$auteur = [];
foreach ($this->_getAuthorFields() as $zone) {
$data = $this->get_subfield($zone);
foreach ($data as $items) {
$sous_champs = $this->decoupe_bloc_champ($items);
$nom = $prenom = '';
$mappings = ['a' => function ($value) use (&$nom) {$nom = $value;},
'b' => function ($value) use (&$prenom) {$prenom = $value;}];
foreach ($sous_champs as $item) {
if (array_key_exists($item['code'], $mappings))
$mappings[$item['code']](trim($item['valeur']));
}
$nm = $nom . '|' . $prenom;
if ((strlen($nm) > 2 or $this->indexation->isMotInclu($nom))
and striPos($nm, "ANONYME") === false) // On elimine les auteurs avec 1 seule lettre
{
$auteur[] = $nm;
}
}
}
return $auteur;
}
public function getAuteurPrincipal() {
if (!$auteurs = $this->getAuteurs())
public function getAuteurPrincipal() : string {
if (!$auteurs = (new Class_Notice_Authors($this))->getAllAuthors())
return '';
return trim(str_replace('|', ' ', $auteurs[0]));
}
public function getAuteurClefAlpha() {
if (!$auteurs = $this->getAuteurs())
public function getAuteurClefAlpha() : string {
if (!$auteurs = (new Class_Notice_Authors($this))->getAllAuthors())
return '';
list($nom, $prenom) = explode('|', $auteurs[0]);
return trim($nom . substr($prenom, 0, 1));
}
public function getAuteursRenvois() {
$auteur = [];
foreach($this->_getAuthorFields() as $zone) {
$data = $this->get_subfield($zone);
foreach($data as $items) {
$sous_champs = $this->decoupe_bloc_champ($items);
foreach($sous_champs as $item) {
if($item['code'] == '8') {
$nom = trim($item["valeur"]);
if (strlen($nom)>1)
$auteur[] = $nom;
}
}
}
}
return $auteur;
}
protected function _getAuthorFields() {
return ['700','710','720','730','701','702','711','712','721','722'];
}
public function get200f() {
return $this->get_subfield('200', 'f');
}
public function getDewey() {
$data = $this->get_subfield('676');
$dewey = [];
foreach ($data as $items) {
$sous_champs = $this->decoupe_bloc_champ($items);
foreach ($sous_champs as $item)
if (($item['code'] == 'a')
&& ($indice = dewey::filtreIndice($item['valeur'])))
$dewey[] = $indice;
}
return $dewey;
public function getDewey() : array {
return array_filter(
array_map([Class_CodifDewey::class, 'filtreIndice'],
$this->get_subfield('676', 'a')));
}
......@@ -1429,31 +1291,15 @@ class notice_unimarc extends iso2709_record {
}
public function processPcdm4($subfields) {
$indice = '';
foreach($subfields as $item) {
if ($item['code'] == 'a'
&& $indice = Class_CodifPcdm4::filtreIndice($item['valeur'])) {
return $indice;
}
}
return null;
}
public function getPcdm4() {
if ($indice = $this->_getPergamePcdm4())
return $indice;
$data = array_merge($this->get_subfield('686'), $this->get_subfield('676'));
$pcdm4 = array_filter( array_map([$this, '_getPcdm4DataField'], $data));
return implode(" ",$pcdm4);
}
protected function _getPcdm4DataField($item){
return $this->processPcdm4($this->decoupe_bloc_champ($item));
return implode(' ',
array_filter(
array_map([Class_CodifPcdm4::class, 'filtreIndice'],
[...$this->get_subfield('686', 'a'),
...$this->get_subfield('676', 'a')])));
}
......@@ -1482,7 +1328,7 @@ class notice_unimarc extends iso2709_record {
}
public function getEditeur() {
public function getEditeur() : string {
return (new Class_Notice_Editeur($this))->getFirstEditeur();
}
......@@ -1564,14 +1410,6 @@ class notice_unimarc extends iso2709_record {
}
public function getCollection() {
$data = $this->get_subfield(225, 'a');
if(!count($data))
$data = $this->get_subfield(410, 't');
return $data;
}
public function getLangues() {
$data = $this->get_subfield(101);
$langues = [];
......
<?PHP
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
///////////////////////////////////////////////////////////////////
//
// GESTION DES INDICES DEWEY
//
////////////////////////////////////////////////////////////////////
include("_init_frame.php");
require_once("classe_dewey.php");
$dewey = new dewey();
extract($_POST);
?>
<script>
function give_libelle(sIndice,sValeur)
{
if(sValeur == "") return;
oChampRetour=document.getElementById("indice_a_ecrire");
oChampRetour.value=oChampRetour.value + sIndice + "#" + sValeur + ";";
}
function give_suppression()
{
oChampRetour=document.getElementById("indice_a_ecrire");
chaine="";
for (var i=0;i<document.getElementsByName("selection").length;i++)
{
if (document.getElementsByName("selection")[i].checked==true)
{
if(chaine > '') chaine=chaine+";";
chaine=chaine+document.getElementsByName("selection")[i].id;
}
}
oChampRetour.value=oChampRetour.value=chaine;
}
</script>
<?PHP
// ----------------------------------------------------------------
// ACCUEIL
// ----------------------------------------------------------------
if($_REQUEST["action"]=="")
{
print('<h1>Gestion des indices Dewey</h1>');
$nb=$sql->fetchOne("Select count(*) from codif_dewey");
$nb1=$sql->fetchOne("Select count(*) from codif_dewey where libelle=''" );
print('<span class="orange"><b>La base contient '.number_format($nb, 0, ',', ' ').' fiches Dewey</b></span>'.BR);
print('<span class="orange"><b>Libellés non renseignés : '.number_format($nb1, 0, ',', ' ').'</b></span>'.BR.BR);
print('<div class="liste" style="width:700px">');
$url="codif_dewey.php?action=NOLIB";
print('<form id="nolib" method="post" action="'.$url.'">');
print('<table width="60%" cellspacing="0">');
print('<tr><th align="left" width="50%">Indices sans libellés</th>');
print('<th align="right"><input type="submit" class="bouton" value="Lancer">&nbsp;&nbsp;&nbsp;</th>');
print('</tr>');
print('<tr>');
print('<td align="right">Nombre de décimales:&nbsp;</td>');
print('<td><input type ="text" name="nbdec" value="3" size="3" align="left"></td>');
print('</tr>');
print('</table></form>'.BR);
$url="codif_dewey.php?action=MAJ";
print('<form id="suppression" method="post" action="'.$url.'">');
print('<table width="60%" cellspacing="0">');
print('<tr><th align="left" width="50%">Modification de libellés</th>');
print('<th align="right"><input type="submit" class="bouton" value="Lancer">&nbsp;&nbsp;&nbsp;</th>');
print('</tr>');
print('<tr>');
print('<td align="right">Nombre de décimales:&nbsp;</td>');
print('<td><input type ="text" name="nbdec" value="3" size="3" align="left"></td>');
print('</tr>');
print('<tr>');
print('<td align="right">Indices commencent par:&nbsp;</td>');
print('<td><input type ="text" name="commencepar" value="" size="7" align="left"></td>');
print('</tr>');
print('</table></form>'.BR);
$url="codif_dewey.php?action=SUPPRESSION";
print('<form id="suppression" method="post" action="'.$url.'">');
print('<table width="60%" cellspacing="0">');
print('<tr><th align="left" width="50%">Suppression d\'indices</th>');
print('<th align="right"><input type="submit" class="bouton" value="Lancer">&nbsp;&nbsp;&nbsp;</th>');
print('</tr>');
print('<tr>');
print('<td align="right">Nombre de décimales:&nbsp;</td>');
print('<td><input type ="text" name="nbdec" value="3" size="3" align="left"></td>');
print('</tr>');
print('<tr>');
print('<td align="right">Indices commencent par:&nbsp;</td>');
print('<td><input type ="text" name="commencepar" value="" size="7" align="left"></td>');
print('</tr>');
print('</table></form>'.BR);
$url="codif_dewey.php?action=CONSOLIDATION";
print('<form id="consolidation" method="post" action="'.$url.'">');
print('<table width="60%" cellspacing="0">');
print('<tr><th align="left" width="70%">Consolidation par une liste d\'indices</th>');
print('<th align="right"><input type="submit" class="bouton" value="Lancer">&nbsp;&nbsp;&nbsp;</th>');
print('</tr>');
print('<tr>');
print('<td colspan="2" align="center"><input type ="checkbox" name="remplacer">Remplacer les libellés présents dans la base</td>');
print('</tr>');
print('</table></form>'.BR);
$url="codif_dewey.php?action=NIVEAUX";
print('<form id="niveaux" method="post" action="'.$url.'">');
print('<table width="60%" cellspacing="0">');
print('<tr><th align="left" width="70%">Création des niveaux intermédiaires</th>');
print('<th align="right"><input type="submit" class="bouton" value="Lancer">&nbsp;&nbsp;&nbsp;</th>');
print('</tr>');
print('<tr>');
print('<td colspan="2">Cette fonction créee les niveaux intermédiaires pour un bon fonctionnement de la recherche guidée</td>');
print('</tr>');
print('</table></form>'.BR);
}
// ----------------------------------------------------------------
// CONSOLIDATION PAR LISTE
// ----------------------------------------------------------------
if($_REQUEST["action"]=="CONSOLIDATION")
{
print('<h1>Consolidation par une liste d\'indices</h1>');
print('<div align="center">');
print('<h3>Collez votre liste dans le champ ci-dessous, puis validez</h3>');
print('<p align="left">NB : Les lignes doivent être séparées par des retours-chariot et l\'indice doit être séparé du libellé par une tabulation.</p>');
$url="codif_dewey.php?action=ECRIRE_LISTE&remplacer=".$_REQUEST["remplacer"];
print('<tr><form id="consolidation" method="post" action="'.$url.'">');
print('<br><textarea name="liste_indice" cols="70" rows="20"></textarea>');
print('<br><br><input type="submit" class="bouton" value="Valider la liste">');
print('</form>');
}
// ----------------------------------------------------------------
// CONSOLIDATION PAR LISTE => ECRITURE
// ----------------------------------------------------------------
if($_REQUEST["action"]=="ECRIRE_LISTE")
{
extract($_POST);
print('<h1>Ecriture des indices</h1>');
print('<div>');
if(trim($liste_indice) > "" )
{
$indices=explode(chr(13).chr(10), $liste_indice);
$majs=0; $pas_traites=0; $creations=0;
for($i=0; $i<count($indices); $i++)
{
$elem=explode(chr(9),$indices[$i]);
$indice=$elem[0]; $libelle=$elem[1];
$indice=trim(str_replace(".","",$indice));
if(!$indice) continue;
$controle=$sql->fetchOne("select count(*) from codif_dewey where id_dewey='$indice'");
if($controle)
{
if($_REQUEST["remplacer"] == "on")
{
$mode="Remplacement";
$majs+=$dewey->ecrire($indice,$libelle);
}
else {$mode="Pas de traitement car existe déjà"; $pas_traites++;}
}
else {$mode="Création"; $creations++; $sql->insert("codif_dewey",array("id_dewey"=>$indice,"libelle"=>$libelle));}
print('<span class="violet" style="margin-left:20px"><b>'.$indice.' : </b></span><span>'.$mode.'</span>'.BR);
}
print('<br><h3>Traitement terminé avec succès</h3>');
print('<h3>'.$creations." fiche(s) créée(s) - ".$majs." fiche(s) modifiée(s) - ".$pas_traites." fiche(s) non traitée(s)</h3>");
}
}
// ----------------------------------------------------------------
// MISES A JOUR DE LIBELLES
// ----------------------------------------------------------------
if($_REQUEST["action"]=="MAJ")
{
print('<h1>Mise à jour des libellés</h1>');
print('<div align="center">');
print('<h3>Modifiez les libellés puis validez en bas de la page</h3>');
$url="codif_dewey.php?action=ECRIRE";
print('<form method="POST" action="'.$url.'">');
print('<input type="hidden" id="indice_a_ecrire" name="indice_a_ecrire">');
print('<table>');
$req="Select id_dewey,libelle from codif_dewey ";
if($nbdec >0) $where=" Where LENGTH(id_dewey)<= $nbdec";
if($commencepar > "")
{
if( $where > "" ) $where .=" and "; else $where = " Where ";
$where.="id_dewey like '$commencepar%'";
}
$req.= $where." order by id_dewey";
$result=$sql->prepareListe($req);
if($result)
{
While($ret=$sql->fetchNext($result))
{
print('<tr><td>'.$dewey->formatIndice($ret["id_dewey"]).'</td><td><input type="text" size="70" onblur="give_libelle(\''.$ret["id_dewey"].'\',this.value)" value="'.$ret["libelle"].'"></td></tr>');
}
}
print('</table>');
print('<br><input type="submit" class="bouton" value="Valider les libellés">');
print('</form');
}
// ----------------------------------------------------------------
// SUPPRESSION INDICES
// ----------------------------------------------------------------
if($_REQUEST["action"]=="SUPPRESSION")
{
print('<h1>Suppression d\'indices</h1>');
print('<div align="center">');
print('<h3>Cochez les indices à supprimer puis validez en bas de la page</h3>');
$url="codif_dewey.php?action=DELETE";
print('<form method="POST" action="'.$url.'">');
print('<input type="hidden" id="indice_a_ecrire" name="indice_a_ecrire">');
print('<table>');
$req="Select id_dewey,libelle from codif_dewey";
if($nbdec >0) $where=" Where LENGTH(id_dewey)<= $nbdec";
if($commencepar > "")
{
if( $where > "" ) $where .=" and "; else $where = " Where ";
$where.="id_dewey like '$commencepar%' order by id_dewey";
}
$req.= $where;
$result=$sql->prepareListe($req);
if($result)
{
While($ret=$sql->fetchNext($result))
{
print('<tr>');
$coche='<input type="checkbox" name="selection" id="'.$ret["id_dewey"].'">';
print('<td>'.$coche.'</td><td>'.$dewey->formatIndice($ret["id_dewey"]).'</td><td>'.$ret["libelle"].'</td></tr>');
}
}
print('</table>');
print('<br><input type="submit" class="bouton" value="Supprimer les indices cochés" onclick="give_suppression(); return true;">');
print('</form');
}
// ----------------------------------------------------------------
// TRAITEMENT DES SUPPRESSIONS
// ----------------------------------------------------------------
if($_REQUEST["action"]=="DELETE")
{
print('<h1>Suppression d\'indices</h1>');
print('<div>');
$indice=explode(";",$indice_a_ecrire);
for($i=0; $i<count($indice); $i++)
{
print("Suppression : ".$dewey->formatIndice($indice[$i])."<br>");
$indice[$i]=str_replace(".","",$indice[$i]);
$req="Delete From codif_dewey Where id_dewey ='".$indice[$i]."'";
$sql->execute($req);
$dewey->majFulltext($indice[$i]);
}
print('<br><h3>Traitement terminé avec succès</h3>');
}
// ----------------------------------------------------------------
// INDICES SANS LIBELLE
// ----------------------------------------------------------------
if($_REQUEST["action"]=="NOLIB")
{
print('<h1>Indices Dewey sans libellés</h1>');
print('<div align="center">');
print('<h3>Renseignez les libellés puis validez en bas de la page</h3>');
$url="codif_dewey.php?action=ECRIRE";
print('<form method="POST" action="'.$url.'">');
print('<input type="hidden" id="indice_a_ecrire" name="indice_a_ecrire">');
print('<table>');
$ret=$dewey->getIndicesSanslibelle("",$nbdec);
for($i=0; $i<count($ret); $i++)
{
print('<tr><td>'.$ret[$i].'</td><td><input type="text" size="70" onblur="give_libelle(\''.$ret[$i].'\',this.value)"></td></tr>');
}
print('</table>');
print('<br><input type="submit" class="bouton" value="Valider les libellés">');
print('</form');
}
// ----------------------------------------------------------------
// ECRITURE DES LIBELLES
// ----------------------------------------------------------------
if($_REQUEST["action"]=="ECRIRE")
{
print('<h1>Mise à jour des Indices Dewey</h1>');
if(trim($indice_a_ecrire)=="")
{
print('<br><h3>Aucun indice n\'a été modifié</h3>');
}
else
{
$nb=0;
$liste=explode(";",$indice_a_ecrire);
for($i=0; $i<count($liste); $i++)
{
$elem=explode("#",$liste[$i]);
print($elem[0]." - " .$elem[1]."<br>");
$nb+=$dewey->ecrire($elem[0],$elem[1]);
}
print("<br><h3>".$nb. " indice(s) ont été mis à jour avec succès.</h3>");
}
}
// ----------------------------------------------------------------
// CREATION DES NIVEAUX INTERMEDIAIRES
// ----------------------------------------------------------------
if($_REQUEST["action"]=="NIVEAUX")
{
echo '<h1>Création des niveaux intermédiaires</h1>';
$indices=fetchAll("select id_dewey from codif_dewey order by id_dewey");
echo '<div>';
$creation=0;
foreach($indices as $ligne)
{
$id_dewey=substr($ligne["id_dewey"],0,7);
for($i=strlen($id_dewey)-1; $i>1; $i--)
{
$id=substr($id_dewey,0,$i);
$controle=fetchOne("select count(*) from codif_dewey where id_dewey='$id'");
if(strlen($id)>6) continue;
if($controle>0) continue;
sqlExecute("insert into codif_dewey(id_dewey) values('$id')");
$creation++;
echo $id.BR;
}
}
echo '</div>';
echo '<h3>'.$creation.' indices à créer</h3>'.BR.BR;
}
?>
</center></div>
</body>
</html>