public static function limitstring($string, $max = 50, $ends = "[...]") { if (pmb_strlen($string) > $max) { $string = pmb_substr($string, 0, $max - pmb_strlen($ends)) . $ends; } return $string; }
function recurse_analyse() { global $msg; global $charset; global $opac_default_operator; $s = "new_word"; $end = false; while (!$end) { switch ($s) { //Début d'un nouveau terme case "new_word": if ($this->current_car > pmb_strlen($this->input) - 1) { $end = true; if ($this->parenthesis) { $this->error = 1; $this->error_message = $msg["aq_missing_term_and_p"]; break; } if ($this->guillemet) { $this->error = 1; $this->error_message = $msg["aq_missing_term_and_g"]; break; } break; } $cprec = pmb_getcar($this->current_car - 1, $this->input); $c = pmb_getcar($this->current_car, $this->input); $this->current_car++; //Si terme précédé par un opérateur (+, -, ~) et pas d'opérateur et pas de guillemet ouvert et pas de commence par : //affectation opérateur. Néanmoins, si c'est le premier terme on n'en tient pas compte if (($c == "+" || $c == "-" && $cprec == " " || $c == "~") && $this->operator == "" && !$this->guillemet && !$this->neg && !$this->start_with) { if ($c == "+" && count($this->tree)) { if ($opac_default_operator == 1) { $this->operator = "or"; } else { $this->operator = "and"; } } else { if ($c == "-" && $cprec == " " && count($this->tree)) { $this->operator = "and"; $this->neg = 1; } else { if ($c == "-" && $cprec == " " && !count($this->tree) || $c == "~") { $this->neg = 1; } } } //Après l'opérateur, on continue à chercher le début du terme $s = "new_word"; break; } //Si terme précédé par un opérateur et qu'il y a déjà un opérateur ou un commence par et qu'on est pas //dans des guillemets alors erreur ! if (($c == "+" || $c == "-" && $cprec == " " || $c == "~") && !$this->guillemet && ($this->operator != "" || $this->neg || $this->start_with)) { if (!$this->start_with) { if ($c == "~" && $this->operator == "and") { if (!$this->neg) { $message_op = $msg["aq_and_not_error"]; } else { $message_op = $msg["aq_minus_error"]; } } else { if (($c == "+" || $c == "-" && $cprec == " ") && $this->neg && !$this->operator) { $message_op = sprintf($msg["aq_neg_error"], $c); } else { $message_op = $msg["aq_only_one"]; } } } else { $message_op = $msg["aq_start_with_error"]; } $end = true; $this->error_message = $message_op; $this->error = 1; break; } //Si terme précédé par "commence par" et qu'on est pas dans les guillemets alors opérateur commence par activé if ($c == "_" && !$this->guillemet) { $this->start_with = 1; break; } //Si premier guillemet => terme litéral if ($c == "\"" && $this->guillemet == 0) { $this->guillemet = 1; $this->literal = 1; //Après le guillemets, on continue à chercher le début du terme break; } //Si guillement et guillemet déjà ouvert => annulation du terme litéral if ($c == "\"" && $this->guillemet == 1) { $this->guillemet = 0; $this->literal = 0; //Après le guillemets, on continue à chercher le début du terme break; } //Si il y a un espace et pas dans les guillemets, on en tient pas compte if ($c == " " && !$this->guillemet) { break; } //Si une parentèse ouverte, alors analyse de la sous expression if ($c == "(" && !$this->guillemet) { $sub_a = new analyse_query($this->input, $this->current_car, 1, $this->search_linked_words, $this->keep_empty, $this->stemming); //Si erreur dans sous expression, erreur ! if ($sub_a->error) { $this->error = 1; //Mise à jour du caractère courant où s'est produit l'erreur $this->current_car = $sub_a->current_car; $this->error_message = $sub_a->error_message; $end = true; break; } else { //Si pas d'erreur, stockage du résultat dans terme $this->term = $sub_a->tree; //Si il n'y a pas d'opérateur et que ce n'est pas le premier terme, //opérateur par défaut //if ((!$this->operator)&&(count($this->tree))) $this->operator="or"; if (!$this->operator && count($this->tree)) { if ($opac_default_operator == 1) { $this->operator = "and"; } else { $this->operator = "or"; } } $this->current_car = $sub_a->current_car; //Début Attente du prochain terme $s = "space_first"; break; } } //Si parentèse fermante et parentèse déjà ouverte alors on s'en va if ($c == ")" && $this->parenthesis && !$this->guillemet) { $end = true; break; } //Si aucun des cas précédents, c'est le début du terme $this->term .= $c; //Si il n'y a pas d'opérateur et que ce n'est pas le premier terme, //opérateur par défaut //if ((!$this->operator)&&(count($this->tree))) $this->operator="or"; if (!$this->operator && count($this->tree)) { if ($opac_default_operator == 1) { $this->operator = "and"; } else { $this->operator = "or"; } } //Lecture du terme $s = "stockage_car"; break; //Lecture d'un terme //Lecture d'un terme case "stockage_car": if ($this->current_car > pmb_strlen($this->input) - 1) { //Si on lit une sous expression et qu'on arrive à la fin avant la parentèse fermante //alors erreur //sinon, passage à l'état attente du prochain terme (pourquoi me direz-vous alors qu'on arrive à la fin ? parceque ce cas est géré en space_first) if ($this->guillemet) { $this->error_message = $msg["aq_missing_g"]; $end = true; $this->error = 1; break; } if ($this->parenthesis) { $this->error_message = $msg["aq_missing_p"]; $end = true; $this->error = 1; break; } $s = "space_first"; } //Lecture caractère $cprec = pmb_getcar($this->current_car - 1, $this->input); $c = pmb_getcar($this->current_car, $this->input); $this->current_car++; //Si espace et terme litéral : l'espace fait partie du terme if (($c == " " || $c == "+" || $c == "-" && $cprec == " ") && $this->guillemet == 1) { $this->term .= $c; break; } //Si espace et terme non litéral : espace = séparateur de terme => passage à Début Attente du prochain terme if (($c == " " || $c == "+" || $c == "-" && $cprec == " ") && $this->guillemet == 0) { $s = "space_first"; $this->current_car--; break; } //Si guillemet et terme litéral : guillemet = fin du terme => passage à Début Attente du prochain terme if ($c == "\"" && $this->guillemet == 1) { $s = "space_first"; $this->guillemet = 0; break; } //Si parentèse fermante et sous-expression et que l'on est pas dans un terme litéral, //alors fin de sous expression à analyser => passage à Début Attente du prochain terme if ($c == ")" && $this->parenthesis == 1 && $this->guillemet == 0) { $s = "space_first"; $this->current_car--; break; } //Si aucun des cas précédent, ajout du caractère au terme... et on recommence $this->term .= $c; break; //Début Attente du prochain terme après la fin d'un terme //A ce niveau, on s'attend à un caractère séparateur et si on le trouve, on enregistre le terme dans l'arbre //Ensuite on passe à l'état attente du prochain terme ("space_wait") qui saute tous les caractères vides avant de renvoyer à new_word //Début Attente du prochain terme après la fin d'un terme //A ce niveau, on s'attend à un caractère séparateur et si on le trouve, on enregistre le terme dans l'arbre //Ensuite on passe à l'état attente du prochain terme ("space_wait") qui saute tous les caractères vides avant de renvoyer à new_word case "space_first": if ($this->current_car > pmb_strlen($this->input) - 1) { //Si fin de chaine et parentèse ouverte => erreur if ($this->parenthesis) { $end = true; $this->error_message = $msg["aq_missing_p"]; $this->error = 1; break; } //Sinon c'est la fin de l'analyse : on enregistre le dernier terme et on s'arrête $end = true; if (is_array($this->term)) { $t = new term("", $this->literal, $this->neg, $this->start_with, $this->operator, $this->term); } else { $t = new term($this->term, $this->literal, $this->neg, $this->start_with, $this->operator, null); } $this->store_in_tree($t, $this->search_linked_words); break; } //Lecture du prochain caractère $cprec = pmb_getcar($this->current_car - 1, $this->input); $c = pmb_getcar($this->current_car, $this->input); $this->current_car++; //Si parentèse fermante et sous expression en cours d'analyse => fin d'analyse de la sous expression if ($c == ")" && $this->parenthesis) { $end = true; //Enregistrement du dernier terme if (is_array($this->term)) { $t = new term("", $this->literal, $this->neg, $this->start_with, $this->operator, $this->term); } else { $t = new term($this->term, $this->literal, $this->neg, $this->start_with, $this->operator, null); } $this->store_in_tree($t, $this->search_linked_words); break; } //Sinon, si ce n'est pas un espace, alors erreur (ce n'est pas le séparateur attendu) if ($c != " " && $c != "+" && ($c != "-" && $cprec != " ")) { $end = true; $this->error_message = $msg["aq_missing_space"]; $this->error = 1; break; } //Si tout va bien, on attend le prochain terme if ($c != " ") { $this->current_car--; } $s = "space_wait"; break; //Attente du prochain terme : on saute tous les espaces avant de renvoyer à la lecture du nouveau terme ! //Attente du prochain terme : on saute tous les espaces avant de renvoyer à la lecture du nouveau terme ! case "space_wait": if ($this->current_car > pmb_strlen($this->input) - 1) { //Si prentèse ouverte et fin de la chaine => erreur if ($this->parenthesis) { $end = true; $this->error_message = $msg["aq_missing_p"]; $this->error = 1; break; } //Sinon, si fin de la chaine, enregistrement du terme précédent et fin d'analyse if (is_array($this->term)) { $t = new term("", $this->literal, $this->neg, $this->start_with, $this->operator, $this->term); } else { $t = new term($this->term, $this->literal, $this->neg, $this->start_with, $this->operator, null); } $this->store_in_tree($t, $this->search_linked_words); $end = true; break; } //Lecture du caractère suivant $c = pmb_getcar($this->current_car, $this->input); $this->current_car++; //Si ) et sous expression en cours d'analyse, fin de l'analyse de la sous expression if ($c == ")" && $this->parenthesis == 1) { //Enregistrement du terme et fin d'analyse if (is_array($this->term)) { $t = new term("", $this->literal, $this->neg, $this->start_with, $this->operator, $this->term); } else { $t = new term($this->term, $this->literal, $this->neg, $this->start_with, $this->operator, null); } $this->store_in_tree($t, $this->search_linked_words); $end = true; break; } //Si le caractère n'est pas un espace, alors c'est le début du prochain terme if ($c != " ") { $this->current_car--; //Enregistrement du dernier terme if (is_array($this->term)) { $t = new term("", $this->literal, $this->neg, $this->start_with, $this->operator, $this->term); } else { $t = new term($this->term, $this->literal, $this->neg, $this->start_with, $this->operator, null); } $this->store_in_tree($t, $this->search_linked_words); //Remise à zéro des indicateurs $this->operator = ""; $this->term = ""; $this->neg = 0; $this->literal = 0; $this->start_with = 0; //Passage à nouveau terme $s = "new_word"; break; } //Sinon on reste en attente break; } } if ($this->error) { $this->input_html = pmb_substr($this->input, 0, $this->current_car - 1) . "!!red!!" . pmb_substr($this->input, $this->current_car - 1, 1) . "!!s_red!!" . pmb_substr($this->input, $this->current_car); } else { $this->input_html = $this->input; } if (!$this->error && !count($this->tree)) { $this->error = 1; $this->error_message = $msg["aq_no_term"]; } $this->input_html = htmlentities($this->input_html, ENT_QUOTES, $charset); $this->input_html = str_replace("!!red!!", "<font color='#DD0000'><b><u>", $this->input_html); $this->input_html = str_replace("!!s_red!!", "</u></b></font>", $this->input_html); }
function aff_ellipse($param) { // $param[0] = chaine de caractère à réduire // $param[1] = nb de caractères max à afficher // $param[2] = chaine de remplacement // $param[3] = Tronquer sur nb de mots au lieu du nombre de caractères if ($param[3]) { $array_words = explode(" ", $param[0]); if (count($array_words) <= $param[1]) { return $param[0]; } else { array_splice($array_words, $param[1]); return implode(" ", $array_words) . $param[2]; } } else { if (pmb_strlen($param[0]) <= $param[1]) { return $param[0]; } else { return pmb_substr_replace($param[0], $param[2], $param[1]); } } }
//Congrès print pmb_bidi("<h3><span>" . $msg["congres_see_title"] . " {$renvoi}</span></h3>\n"); } else { print pmb_bidi("<h3><span>" . $msg["author_see_title"] . " {$renvoi}</span></h3>\n"); } print "<div id='aut_details_container'>\n"; print "<div id='aut_see'>\n"; print pmb_bidi($ourAuteur->print_resume()); // récupération des formes rejetées pour affichage $requete = "select distinct author_id as aut from authors where author_id {$clause_auteurs} and author_id!={$id} "; $res = mysql_query($requete, $dbh); while ($obj = mysql_fetch_object($res)) { $objRenvoi = new auteur($obj->aut); pmb_strlen($renvoi) ? $renvoi .= ', (' . $objRenvoi->isbd_entry . ")" : ($renvoi = $objRenvoi->isbd_entry); } if (pmb_strlen($renvoi)) { print pmb_bidi("<font class=number_results>{$renvoi}</font><br />\n"); } $aut_link = new aut_link(AUT_TABLE_AUTHORS, $id); print pmb_bidi($aut_link->get_display()); print "</div><!-- fermeture #aut_see -->\n"; // affichage des notices associées print "<div id='aut_details_liste'>\n"; if ($ourAuteur->type == 72) { //Congrès print pmb_bidi("<h3>{$msg['documents_disponibles_meme_congres']}"); } else { print pmb_bidi("<h3>{$msg['documents_disponibles_meme_auteur']}"); } print "</h3>\n"; //droits d'acces emprunteur/notice
function compose_label($titre1, $titre2) { $therme1 = $therme2 = ""; for ($i = 0; $i < pmb_strlen($titre1); $i++) { $therme1 = pmb_substr($titre1, 0, $i + 1); $therme2 = pmb_substr($titre2, 0, $i + 1); if ($therme1 != $therme2) { break; } } $label = pmb_substr($therme1, 0, 5) . " - " . pmb_substr($therme2, 0, 5); return $label; }
function test_other_query($n_res = 0, $n_gen = 0, $n_tit = 0, $n_mat = 0, $query, $operator = TRUE, $force_regexp = FALSE) { // fonction d'analyse d'une recherche sur titre // la fonction retourne un tableau : $query_result = array('type' => 0, 'restr' => '', 'order' => '', 'display', 'nbr_rows' => 0); // $query_result['type'] = type de la requête : // 0 : rien (problème) // 1: match/against // 2: regexp // 3: regexp pure sans traitement // $query_result['restr'] = critères de restriction // $query_result['order'] = critères de tri // $query_result['nbr_rows'] = nombre de lignes qui matchent // $query_result['display'] = affichage en clair de la requête utilisateur // si operator TRUE La recherche est booléenne AND // si operator FALSE La recherche est booléenne OR // si force_regexp : la recherche est forcée en mode regexp $stopwords = FALSE; global $dbh; // initialisation opérateur $operator ? $dopt = 'AND' : ($dopt = 'OR'); $query = pmb_strtolower($query); // espaces en début et fin $query = pmb_preg_replace('/^\\s+|\\s+$/', '', $query); // espaces en double $query = pmb_preg_replace('/\\s+/', ' ', $query); // contrôle de la requete if (!$query) { return $query_result; } // déterminer si la requête est une regexp // si c'est le cas, on utilise la saisie utilisateur sans modification // (on part du principe qu'il sait ce qu'il fait) if (pmb_preg_match('/\\^|\\$|\\[|\\]|\\.|\\*|\\{|\\}|\\|/', $query)) { // regexp pure : pas de modif de la saisie utilisateur $query_result['type'] = 3; if ($n_res) { $query_result['restr'] = "n_resume REGEXP '{$query}' OR n_contenu REGEXP '{$query}' "; } else { $query_result['restr'] = ""; } if ($n_gen) { if ($query_result['restr']) { $query_result['restr'] .= " OR "; } $query_result['restr'] .= " n_gen REGEXP '{$query}'"; } if ($n_tit) { if ($query_result['restr']) { $query_result['restr'] .= " OR "; } $query_result['restr'] .= " tit1 REGEXP '{$query}' OR tit2 REGEXP '{$query}' OR tit3 REGEXP '{$query}' OR tit4 REGEXP '{$query}' OR index_serie REGEXP '{$query}' "; } if ($n_mat) { if ($query_result['restr']) { $query_result['restr'] .= " OR "; } $query_result['restr'] .= " index_l REGEXP '{$query}' "; } $query_result['order'] = "index_serie ASC, tnvol ASC, index_sew ASC"; $query_result['display'] = $query; } else { // nettoyage de la chaîne $query = pmb_preg_replace("/[\\(\\)\\,\\;\\'\\!\\-\\+]/", ' ', $query); // on supprime les mots vides $query = strip_empty_words($query); // contrôle de la requete if (!$query) { return $query_result; } // la saisie est splitée en un tableau $tab = pmb_split('/\\s+/', $query); // on cherche à détecter les mots de moins de 4 caractères (stop words) // si il y des mots remplissant cette condition, c'est la méthode regexp qui sera employée foreach ($tab as $dummykey => $word) { if (pmb_strlen($word) < 4) { $stopwords = TRUE; break; } } if ($stopwords || $force_regexp) { // méthode REGEXP $query_result['type'] = 2; // constitution du membre restricteur // premier mot if ($n_res) { $query_result['restr'] = "( n_resume REGEXP '{$tab[0]}' OR n_contenu REGEXP '{$tab[0]}' "; } else { $query_result['restr'] = ""; } if ($n_gen) { if ($query_result['restr']) { $query_result['restr'] .= " OR n_gen REGEXP '{$tab[0]}'"; } else { $query_result['restr'] = "( n_gen REGEXP '{$tab[0]}'"; } } if ($n_tit) { if ($query_result['restr']) { $query_result['restr'] .= " OR tit1 REGEXP '{$tab[0]}' OR tit2 REGEXP '{$tab[0]}' OR tit3 REGEXP '{$tab[0]}' OR tit4 REGEXP '{$tab[0]}' OR index_serie REGEXP '{$tab[0]}'"; } else { $query_result['restr'] = "( tit1 REGEXP '{$tab[0]}' OR tit2 REGEXP '{$tab[0]}' OR tit3 REGEXP '{$tab[0]}' OR tit4 REGEXP '{$tab[0]}' OR index_serie REGEXP '{$tab[0]}' "; } } if ($n_mat) { if ($query_result['restr']) { $query_result['restr'] .= " OR index_l REGEXP '{$tab[0]}' "; } else { $query_result['restr'] = "( index_l REGEXP '{$tab[0]}' "; } } $query_result['restr'] .= ") "; //$query_result['restr'] = "(n_resume REGEXP '${tab[0]}'"; //$query_result['restr'] .= " OR n_contenu REGEXP '$tab[0]')"; $query_result['display'] = $tab[0]; for ($i = 1; $i < sizeof($tab); $i++) { $query_suite = ""; if ($n_res) { $query_suite = " ( n_resume REGEXP '{$tab[$i]}' OR n_contenu REGEXP '{$tab[$i]}' "; } if ($n_gen) { if ($query_suite) { $query_suite .= " OR n_gen REGEXP '{$tab[$i]}'"; } else { $query_suite = "( n_gen REGEXP '{$tab[$i]}'"; } } if ($n_tit) { if ($query_suite) { $query_suite .= " OR tit1 REGEXP '{$tab[$i]}' OR tit2 REGEXP '{$tab[$i]}' OR tit3 REGEXP '{$tab[$i]}' OR tit4 REGEXP '{$tab[$i]}' OR index_serie REGEXP '{$tab[$i]}'"; } else { $query_suite = "( tit1 REGEXP '{$tab[$i]}' OR tit2 REGEXP '{$tab[$i]}' OR tit3 REGEXP '{$tab[$i]}' OR tit4 REGEXP '{$tab[$i]}' OR index_serie REGEXP '{$tab[$i]}' "; } } if ($n_mat) { if ($query_suite) { $query_suite .= " OR index_l REGEXP '{$tab[$i]}' "; } else { $query_suite = "( index_l REGEXP '{$tab[$i]}' "; } } if ($query_suite) { $query_suite .= " ) "; $query_result['restr'] .= " {$dopt} " . $query_suite; } //$query_result['restr'] .= " $dopt (n_resume REGEXP '${tab[$i]}'"; //$query_result['restr'] .= " OR n_contenu REGEXP '${tab[$i]}')"; $query_result['display'] .= " {$dopt} {$tab[$i]}"; } //echo "<br /><br /><br />".$query_result['restr']."<br /><br /><br />"; // contitution de la clause de tri $query_result['order'] = "index_serie ASC, tnvol ASC, index_sew ASC"; } else { // méthode FULLTEXT $query_result['type'] = 1; // membre restricteur if ($n_res) { $query_result['restr'] = "( MATCH (n_resume, n_contenu) AGAINST ('{$tab[0]}') "; } else { $query_result['restr'] = ""; } if ($n_gen) { if ($query_result['restr']) { $query_result['restr'] .= " OR MATCH (n_gen) AGAINST ('{$tab[0]}') "; } else { $query_result['restr'] = "( MATCH (n_gen) AGAINST ('{$tab[0]}') "; } } if ($n_tit) { if ($query_result['restr']) { $query_result['restr'] .= " OR MATCH (index_wew) AGAINST ('{$tab[0]}') "; } else { $query_result['restr'] = "( MATCH (index_wew) AGAINST ('{$tab[0]}') "; } } if ($n_mat) { if ($query_result['restr']) { $query_result['restr'] .= " OR MATCH (index_matieres) AGAINST ('{$tab[0]}') "; } else { $query_result['restr'] = "( MATCH (index_matieres) AGAINST ('{$tab[0]}') "; } } $query_result['restr'] .= ") "; //$query_result['restr'] = "MATCH (n_resume, n_contenu) AGAINST ('${tab[0]}')"; $query_result['display'] = $tab[0]; for ($i = 1; $i < sizeof($tab); $i++) { $query_suite = ""; if ($n_res) { $query_suite = " ( MATCH (n_resume, n_contenu) AGAINST ('{$tab[$i]}') "; } if ($n_gen) { if ($query_suite) { $query_suite .= " OR MATCH (n_gen) AGAINST ('{$tab[$i]}') "; } else { $query_suite = "( MATCH (n_gen) AGAINST ('{$tab[$i]}')"; } } if ($n_tit) { if ($query_suite) { $query_suite .= " OR MATCH (index_wew) AGAINST ('{$tab[$i]}') "; } else { $query_suite = "( MATCH (index_wew) AGAINST ('{$tab[$i]}') "; } } if ($n_mat) { if ($query_suite) { $query_suite .= " OR MATCH (index_matieres) AGAINST ('{$tab[$i]}') "; } else { $query_suite = "( MATCH (index_matieres) AGAINST ('{$tab[$i]}') "; } } if ($query_suite) { $query_suite .= " ) "; $query_result['restr'] .= " {$dopt} " . $query_suite; } //$query_result['restr'] .= " $dopt MATCH"; //$query_result['restr'] .= " (n_resume, n_contenu)"; //$query_result['restr'] .= " AGAINST ('${tab[$i]}')"; $query_result['display'] .= " {$dopt} {$tab[$i]}"; } // membre de tri $query_result['order'] = "index_serie ASC, tnvol ASC, index_sew ASC"; } } // récupération du nombre de lignes $rws = "SELECT count(1) FROM notices WHERE {$query_result['restr']}"; $result = @pmb_mysql_query($rws, $dbh); $query_result['nbr_rows'] = pmb_mysql_result($result, 0, 0); return $query_result; }
function pmb_substr_replace($string, $replacement, $start, $length = null) { global $charset; if ($length === null) { $length = pmb_strlen($string); } if ($charset != 'utf-8') { return substr_replace($string, $replacement, $start, $length); } else { $result = mb_substr($string, 0, $start, $charset); $result .= $replacement; if ($length > 0) { $result .= mb_substr($string, $start + $length, null, $charset); } return $result; } }
function aff_ellipse($param) { // $param[0] = chaine de caractère à réduire // $param[1] = nb de caractères max à afficher // $param[2] = chaine de remplacement if (pmb_strlen($param[0]) <= $param[1]) { return $param[0]; } else { return pmb_substr_replace($param[0], $param[2], $param[1]); } }
function cherche_child() { global $dbh; global $pmb_indexint_decimal; $this->childs = array(); if (!$pmb_indexint_decimal) { $this->has_child = 0; return; } /* calcul de l'arbo : si 3ème carac != 0 niveau 3 sinon si 2eme carac != 0 niveau 2 sinon prendre le premier carac rechercher quand même avec les trois carac entiers */ $entier = substr($this->name, 0, 3); if (pmb_strlen($this->name) > 3) { $clause = " indexint_name like '" . $entier . "%'"; } else { $carac1 = substr($this->name, 0, 1); $carac2 = substr($this->name, 1, 1); $carac3 = substr($this->name, 2, 1); if ($carac3 != "0") { $clause = " indexint_name like '" . $entier . "%' "; } elseif ($carac2 != "0") { $clause = " indexint_name like '" . $carac1 . $carac2 . "%' "; } else { $clause = " indexint_name like '" . $carac1 . "%' "; } } if ($this->pclass) { $clause .= " AND num_pclass='" . $this->pclass . "' "; } // avec affichage de l'indexation parente // $query = "select indexint_id,indexint_name,indexint_comment from indexint where ".$clause." order by indexint_name "; // sans affichage de l'indexation parente $query = "select indexint_id,indexint_name,indexint_comment from indexint where " . $clause . " and indexint_name <> '" . addslashes($this->name) . "' order by indexint_name "; $res = pmb_mysql_query($query, $dbh); $this->has_child = pmb_mysql_num_rows($res); if ($this->has_child) { while ($obj = pmb_mysql_fetch_object($res)) { $this->childs[] = array('idchild' => $obj->indexint_id, 'namechild' => $obj->indexint_name, 'commentchild' => $obj->indexint_comment); } } return; }
while ($id_aut = pmb_mysql_fetch_object($res_auteurs)) { $clause_auteurs .= ", '" . $id_aut->aut . "' "; $rqt_auteursuite = "select author_id as aut from authors where author_see='{$id_aut->aut}' and author_id!=0 "; $res_auteursuite = pmb_mysql_query($rqt_auteursuite, $dbh); while ($id_autsuite = pmb_mysql_fetch_object($res_auteursuite)) { $clause_auteurs .= ", '" . $id_autsuite->aut . "' "; } } $clause_auteurs .= " ) "; $renvoi = ""; // récupération des formes rejetées pour affichage $requete = "select distinct author_id as aut from authors where author_id {$clause_auteurs} and author_id!={$id} "; $res = pmb_mysql_query($requete, $dbh); while ($obj = pmb_mysql_fetch_object($res)) { $objRenvoi = new auteur($obj->aut); pmb_strlen($renvoi) ? $renvoi .= ', (' . $objRenvoi->isbd_entry . ")" : ($renvoi = $objRenvoi->isbd_entry); } //récupération de la liste... // affichage des notices associées $records_list = "<h3><span class=\"aut_details_liste_titre\">"; if ($ourAuteur->type == 72) { //Congrès $records_list .= pmb_bidi($msg[documents_disponibles_meme_congres]); } else { $records_list .= pmb_bidi($msg[documents_disponibles_meme_auteur]); } $records_list .= "</span></h3>\n"; //droits d'acces emprunteur/notice $acces_j = ''; if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) { require_once "{$class_path}/acces.class.php";
function Body() { /*---------------------------------------------------------* ! Create the body of the catalographic card ! *---------------------------------------------------------*/ global $width; global $length; global $height; global $exemplaire; global $notice; global $auteur; global $pmb_pdf_font; $body = ""; $body = $body . $notice->tit1 . " : "; /* book title(s) */ if (strlen($notice->tit2) > 0) { $body = $body . $notice->tit2 . " : "; if (strlen($notice->tit3) > 0) { $body = $body . $notice->tit3 . " : "; if (strlen($notice->tit4) > 0) { $body = $body . $notice->tit4 . " : "; } } } $body = pmb_substr($body, 0, pmb_strlen($body) - 3) . " / "; /* book author(s) */ for ($i = 0; $i < count($notice->responsabilites["auteurs"]); $i++) { unset($auteur); $auteur = new auteur($notice->responsabilites["auteurs"][$i]["id"]); $body = $body . $auteur->name . ", "; } $body = pmb_substr($body, 0, pmb_strlen($body) - 2) . ". -"; /* book edition */ if (strlen($notice->mention_edition) > 0) { $body .= $notice->mention_edition . ". -"; } /* book editor(s) */ if (strlen($notice->ed1) > 0) { $body = $body . $notice->ed1 . ", "; if (strlen($notice->ed2) > 0) { $body = $body . $notice->ed2 . ", "; } } if (strlen($notice->ed1) > 0 || strlen($notice->ed2) > 0) { $body = pmb_substr($body, 0, pmb_strlen($body) - 2); } if (strlen($notice->year) > 0) { $body = $body . " :" . $notice->year; } $body = $body . ". -"; /* book format */ if (strlen($notice->npage) > 0) { $body = $body . $notice->npage; if (strlen($notice->size) > 0) { $body = $body . "; " . $notice->size; } $body = $body . ". -"; } /* book collection */ if (strlen($notice->coll) > 0) { $body = $body . "(" . $notice->coll; if (strlen($notice->nocoll) > 0) { $body = $body . "; " . $notice->nocoll; } $body = $body . "). -"; } /* book note */ if (strlen(trim($notice->n_contenu)) > 0) { $body = $body . trim($notice->n_contenu) . ". -"; } $this->setFont($pmb_pdf_font, "", 10); $this->Ln(); $this->MultiCell($length * 9 / 10, $height, $body); $this->Cell($length, $height, "ISBN : " . $notice->code); }