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 prefill_cote($id_notice = 0, $cote = "") { global $dbh; global $deflt_docs_location; global $value_prefix_cote; $res_dewey = ''; $res_author = ''; $res_title = ''; $res_nvol = ''; $res_cote = ''; if (!$cote) { // fetch the dewey code $requete = "SELECT indexint_name FROM indexint, notices where notice_id='{$id_notice}' and indexint=indexint_id "; $result = @pmb_mysql_query($requete, $dbh); $nbr_lignes = pmb_mysql_num_rows($result); if ($nbr_lignes) { $res = pmb_mysql_fetch_object($result); $res_dewey = $res->indexint_name; } // fetch the title and the volume number $requete = "SELECT index_sew, tnvol FROM notices WHERE notice_id= '{$id_notice}' "; $result = @pmb_mysql_query($requete, $dbh); $res = pmb_mysql_fetch_object($result); $res_title = pmb_strtoupper(pmb_str_replace(" ", "", $res->index_sew)); $res_nvol = $res->tnvol; // récupération du libellé de la localisation par défaut du catalogueur // si la localisation a dans son libellé ou son codage d'import ENSAI, on récupèrera 4 lettres pour l'auteur, dans les autres cas, on récupèrera 3 lettres $requete = "SELECT location_libelle, locdoc_codage_import FROM docs_location WHERE idlocation= '" . $deflt_docs_location . "' "; $result = @pmb_mysql_query($requete, $dbh); $res = pmb_mysql_fetch_object($result); if (preg_match("#ENSAI#", $res->location_libelle) || preg_match("#ENSAI#", $res->locdoc_codage_import)) { $nb_car_auteur_cote = 4; } else { $nb_car_auteur_cote = 3; } // fetch the first author, but only if his responsability_type is 0 $requete = "SELECT index_author, responsability_type FROM authors, responsability WHERE author_id=responsability_author and responsability_notice = '{$id_notice}' ORDER BY responsability_type, responsability_ordre LIMIT 1"; $result = @pmb_mysql_query($requete, $dbh); $nbr_lignes = pmb_mysql_num_rows($result); // build the code using also the author name if ($nbr_lignes) { $res = pmb_mysql_fetch_object($result); $res_author = pmb_strtoupper(pmb_substr(pmb_str_replace(" ", "", $res->index_author), 0, $nb_car_auteur_cote)); $res_cote = $res_dewey . " " . $res_author; } else { // no author at responsability_type 0 so build the code using only the title $res_title = pmb_substr($res_title, 0, $nb_car_auteur_cote); $res_cote = $res_dewey . " " . $res_title . " " . $res_nvol; } return $value_prefix_cote . $res_cote; } else { return $cote; } }
function prefill_cote($id_notice = 0, $cote = "") { global $dbh; global $value_prefix_cote; $res_dewey = ''; $res_author = ''; $res_title = ''; $res_nvol = ''; $res_cote = ''; if (!$cote) { // fetch the dewey code $requete = "SELECT indexint_name FROM indexint, notices where notice_id='{$id_notice}' and indexint=indexint_id "; $result = @mysql_query($requete, $dbh); $nbr_lignes = mysql_num_rows($result); if ($nbr_lignes) { $res = mysql_fetch_object($result); $res_dewey = $res->indexint_name; } // fetch the title and the volume number $requete = "SELECT index_sew, tnvol FROM notices WHERE notice_id= '{$id_notice}' "; $result = @mysql_query($requete, $dbh); $res = mysql_fetch_object($result); $res_title = pmb_strtoupper(pmb_str_replace(" ", "", $res->index_sew)); $res_nvol = $res->tnvol; // fetch the editor $requete = "SELECT ed_name, index_publisher FROM publishers, notices WHERE ed1_id=ed_id and notice_id = '{$id_notice}'"; $result = @mysql_query($requete, $dbh); $nbr_lignes = mysql_num_rows($result); // build the code using also the author name if ($nbr_lignes) { $res = mysql_fetch_object($result); if (strpos($res->ed_name, '(') > 0) { $res_editor = substr(stristr($res->ed_name, '('), 1, 4); } else { $res_editor = strtoupper(substr($res->ed_name, 0, 4)); } $res_title = pmb_substr($res_title, 0, 3); $res_cote = $res_dewey . " " . $res_editor; } else { // no author at responsability_type 0 so build the code using only the title $res_title = pmb_substr($res_title, 0, 4); $res_cote = $res_dewey . " " . $res_title . " " . $res_nvol; } return $value_prefix_cote . $res_cote; } else { return $cote; } }
function show_procs($dbh) { global $msg; global $charset; global $PMBuserid, $javascript_path, $form_notice_tpl; print "\n\t\t<script type=\"text/javascript\" src=\"" . $javascript_path . "/tablist.js\"></script>\n\t\t<a href=\"javascript:expandAll()\"><img src='./images/expand_all.gif' border='0' id=\"expandall\"></a>\n\t\t<a href=\"javascript:collapseAll()\"><img src='./images/collapse_all.gif' border='0' id=\"collapseall\"></a>\n\t\t"; // affichage du tableau des procédures $requete = "SELECT idproc, name, requete, comment, autorisations, libproc_classement, num_classement FROM procs left join procs_classements on idproc_classement=num_classement ORDER BY libproc_classement,name "; $res = mysql_query($requete, $dbh); $nbr = mysql_num_rows($res); $class_prec = $msg[proc_clas_aucun]; $buf_tit = ""; $buf_class = 0; $parity = 1; for ($i = 0; $i < $nbr; $i++) { $row = mysql_fetch_row($res); $rqt_autorisation = explode(" ", $row[4]); if (($PMBuserid == 1 || array_search($PMBuserid, $rqt_autorisation) !== FALSE) && pmb_strtolower(pmb_substr(trim($row[2]), 0, 6)) == 'select') { $classement = $row[5]; if ($class_prec != $classement) { if (!$row[5]) { $row[5] = $msg[proc_clas_aucun]; } if ($buf_tit) { $buf_contenu = "<table><tr><th colspan=4>" . $buf_tit . "</th></tr>" . $buf_contenu . "</table>"; print gen_plus("procclass" . $buf_class, $buf_tit, $buf_contenu); $buf_contenu = ""; } $buf_tit = $row[5]; $buf_class = $row[6]; $class_prec = $classement; } if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity++; $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./edit.php?categ=procs&sub=&action=execute&id_proc={$row['0']}';\" "; $buf_contenu .= "\n<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'>\n\t\t\t\t\t<td><strong>{$row['1']}</strong><br />\n\t\t\t\t\t\t<small>{$row['3']}</small></td>\n\t\t\t\t</tr>"; } } $buf_contenu = "<table><tr><th colspan=4>" . $buf_tit . "</th></tr>" . $buf_contenu . "</table>"; print gen_plus("procclass" . $buf_class, $buf_tit, $buf_contenu); }
function prefill_cote($id_notice = 0, $cote = "") { global $dbh; global $value_prefix_cote; $res_dewey = ''; $res_author = ''; $res_title = ''; $res_nvol = ''; $res_cote = ''; if (!$cote) { // fetch the dewey code $requete = "SELECT indexint_name FROM indexint, notices where notice_id='{$id_notice}' and indexint=indexint_id "; $result = @mysql_query($requete, $dbh); $nbr_lignes = mysql_num_rows($result); if ($nbr_lignes) { $res = mysql_fetch_object($result); $res_dewey = $res->indexint_name; } // fetch the title and the volume number $requete = "SELECT index_sew, tnvol FROM notices WHERE notice_id= '{$id_notice}' "; $result = @mysql_query($requete, $dbh); $res = mysql_fetch_object($result); $res_title = pmb_strtoupper(pmb_str_replace(" ", "", $res->index_sew)); $res_nvol = $res->tnvol; // fetch the first author, but only if his responsability_type is 0 $requete = "SELECT index_author, responsability_type FROM authors, responsability WHERE author_id=responsability_author and responsability_notice = '{$id_notice}' and responsability_type = '0' LIMIT 1"; $result = @mysql_query($requete, $dbh); $nbr_lignes = mysql_num_rows($result); // build the code using also the author name if ($nbr_lignes) { $res = mysql_fetch_object($result); $res_author = pmb_strtoupper(pmb_substr(pmb_str_replace(" ", "", $res->index_author), 0, 3)); $res_title = pmb_substr($res_title, 0, 3); $res_cote = $res_dewey . " " . $res_author . "-" . $res_title . " " . $res_nvol; } else { // no author at responsability_type 0 so build the code using only the title $res_title = pmb_substr($res_title, 0, 7); $res_cote = $res_dewey . " " . $res_title . " " . $res_nvol; } return $value_prefix_cote . $res_cote; } else { return $cote; } }
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 get_onglet($onglet_sel = '1_1') { global $dbh, $msg, $charset, $base_path; global $a2z_perio_display, $onglet_a2z, $a2z_perio, $a2z_tpl_ajax; global $filtre_select; $myArray = explode("_", $onglet_sel); $onglet_sel = $myArray[0]; $ongletSub_sel = $myArray[1]; $form = $a2z_tpl_ajax; $form_list = ""; if (count($this->onglets_sub_contens[$onglet_sel])) { foreach ($this->onglets_sub_contens[$onglet_sel] as $onglet_num => $onglet) { if ($onglet_num == $ongletSub_sel) { // onglet actif $line = str_replace('!!onglet_class!!', "isbd_public_active", $line); // liste des périodiques $perio_list = ""; $view = 0; $perio_id_list = ""; if (is_array($onglet["id"])) { //tri de la liste par titre $serials_ids = implode(",", $onglet["id"]); foreach ($onglet["id"] as $id_brute) { if (pmb_substr($id_brute, 0, 2) == "es") { //notice externe if ($filtre_select != 2) { // si cataloguée, on ne l'affiche pas. sauf si on filtre par fonds externe ($filtre_select!=2) if ($this->get_doublon_ex($this->extract_external_id($id_brute))) { continue; } } $requete = "SELECT source_id FROM external_count WHERE rid=" . addslashes($this->extract_external_id($id_brute)); $myQuery = pmb_mysql_query($requete, $dbh); $source_id = pmb_mysql_result($myQuery, 0, 0); $query = "select ufield,value from entrepot_source_{$source_id} where recid='" . addslashes($this->extract_external_id($id_brute)) . "' and ((ufield='200' and usubfield='a') or (ufield='461' and usubfield='t') or (ufield='bl') or (ufield='hl')) "; $result = pmb_mysql_query($query, $dbh); if ($result) { while ($row = pmb_mysql_fetch_object($result)) { $infos[$row->ufield] = $row->value; } switch ($infos['bl'] . $infos['hl']) { case "a2": case "s2": $tit1 = $infos['461']; break; default: $tit1 = $infos['200']; break; } $perio = $a2z_perio; $perio = str_replace('!!id!!', $id_brute, $perio); $perio = str_replace('!!perio_title!!', $tit1, $perio); $perio = str_replace('!!abt_actif!!', $this->get_external_icon($id_brute), $perio); $perio_list .= $perio; if (!$view) { $view++; $form = str_replace('!!perio_display!!', $this->get_perio($id_brute), $form); } } } else { $query = "select notice_id,tit1 from notices where notice_id ={$id_brute}"; //print $query."<br>"; $result = pmb_mysql_query($query, $dbh); if ($result) { if ($notice = pmb_mysql_fetch_object($result)) { $perio = $a2z_perio; $perio = str_replace('!!id!!', $notice->notice_id, $perio); $perio = str_replace('!!perio_title!!', $notice->tit1, $perio); $req = "select abt_id from abts_abts where num_notice=" . $notice->notice_id . " and date_fin >= CURDATE() "; $res = pmb_mysql_query($req); if (pmb_mysql_num_rows($res)) { $perio = str_replace('!!abt_actif!!', "<img src='" . get_url_icon('check.png') . "'>", $perio); } else { $perio = str_replace('!!abt_actif!!', "", $perio); } $perio_list .= $perio; if (!$view) { $view++; $form = str_replace('!!perio_display!!', $this->get_perio($notice->notice_id), $form); } } } } } } } $form_list .= $line; } } else { $perio_list = $msg["a2z_abt_actif_filter_no_result"]; $form = str_replace('!!perio_display!!', "", $form); } $form = str_replace('!!perio_id_list!!', $perio_id_list, $form); $form = str_replace('!!a2z_perio_list!!', $perio_list, $form); return $form; }
$line = pmb_split("\n", $hp->final_query); $nb_element_avant = $myCart->nb_item; while (list($cle, $valeur) = each($line)) { if ($valeur != '') { if (pmb_strtolower(pmb_substr($valeur, 0, 6)) == "select" || pmb_strtolower(pmb_substr($valeur, 0, 6)) == "create") { } else { echo pmb_substr($valeur, 0, 6); error_message_history($msg['caddie_action_invalid_query'], $msg['requete_selection'], 1); exit; } $result_selection = mysql_query($valeur, $dbh); if (!$result_selection) { error_message_history($msg['caddie_action_invalid_query'], $msg['requete_echouee'] . mysql_error(), 1); exit; } if (pmb_strtolower(pmb_substr($valeur, 0, 6)) == "select") { $nb_element_a_ajouter += mysql_num_rows($result_selection); if (mysql_num_rows($result_selection)) { while ($obj_selection = mysql_fetch_object($result_selection)) { $myCart->add_item($obj_selection->object_id); } } // fin if mysql_num_rows $myCart->compte_items(); } // fin if rqt sélection } //fin valeur nonvide } // fin while list $cle $nb_element_apres = $myCart->nb_item;
if ($virgule) { $tri .= ", "; } // regarde si le champ est déjà dans la liste des champs à trier et le remplace si besoin $new_s = preg_replace("/{$sortfield}, /", "", $s); $new_s = preg_replace("/{$sortfield}/", "", $new_s); // ajoute la clause order by correcte $new_s = preg_replace("/order\\s+by\\s+/i", "order by {$tri}", $new_s); // replace l'ancienne chaîne par la nouvelle $valeur = str_replace($s, $new_s, $valeur); } else { $valeur .= " order by {$tri}"; } } print pmb_bidi("<strong>{$msg['procs_ligne']} {$cle} </strong>: {$valeur}<br /><br />"); if (pmb_strtolower(pmb_substr($valeur, 0, 6)) == "select" || pmb_strtolower(pmb_substr($valeur, 0, 6)) == "create") { } else { echo "rqt=" . $valeur . "=<br />"; error_message_history("Requête invalide", "Vous ne pouvez tester que des requêtes de sélection", 1); exit; } if (!explain_requete($valeur)) { die("<br /><br />" . $valeur . "<br /><br />" . $msg["proc_param_explain_failed"] . "<br /><br />" . $erreur_explain_rqt); } $res = @pmb_mysql_query($valeur, $dbh); $nbr_lignes = @pmb_mysql_num_rows($res); $nbr_champs = @pmb_mysql_num_fields($res); if ($nbr_lignes) { echo "<table >"; for ($i = 0; $i < $nbr_champs; $i++) { // ajout de liens pour trier les pages
//------------------------------------------- $jscript = "\n<script type='text/javascript'>\n<!--\nfunction set_parent(id_value, libelle_value)\n{\n\twindow.opener.document.forms['{$caller}'].elements['{$p1}'].value = id_value;\n\twindow.opener.document.forms['{$caller}'].elements['{$p2}'].value = reverse_html_entities(libelle_value);\n\twindow.close();\n}\n-->\n</script>\n"; $sel_header = "\n<div class='row'>\n\t<label for='titre_select_music_form' class='etiquette'>" . $msg['aut_oeuvre_form_forme_list'] . "</label>\n\t</div>\n<div class='row'>\n"; //------------------------------------------- // $sel_footer : footer //------------------------------------------- $sel_footer = "\n</div>\n"; $baseurl = "./select.php?what=music_form&caller={$caller}&p1={$p1}&p2={$p2}&no_display={$no_display}&bt_ajouter={$bt_ajouter}"; require_once "{$class_path}/marc_table.class.php"; // récupération des codes music_form if (!count($s_music_form)) { $s_music_form = new marc_list('music_form'); } $amusic_form = $s_music_form->table; foreach ($amusic_form as $key => $val) { $alphabet[] = strtoupper(convert_diacrit(pmb_substr($val, 0, 1))); } $alphabet = array_unique($alphabet); print $sel_header; print $jscript; // affichage d'un sommaire par lettres print "<div class='row'>"; foreach ($alphabet as $dummykey => $char) { $present = pmb_preg_grep("/^{$char}/i", $s_music_form->table); if (sizeof($present) && strcasecmp($letter, $char)) { print "<a href='{$baseurl}&letter={$char}'>{$char}</a> "; } else { if (!strcasecmp($letter, $char)) { print "<font size='+1'><strong><u>{$char}</u></strong></font> "; } }
} if ($idcaddie) { $myCart = new caddie($idcaddie); print pmb_bidi(aff_cart_titre($myCart)); $droit = verif_droit_proc_caddie($id); switch ($action) { case 'form_proc': $hp = new parameters($id); $hp->gen_form("./catalog.php?categ=caddie&sub=pointage&moyen=selection&action=pointe_item&idcaddie={$idcaddie}&id={$id}"); break; case 'pointe_item': if ($droit) { $hp = new parameters($id); $hp->get_final_query(); echo "<hr />" . $hp->final_query . "<hr />"; if (pmb_strtolower(pmb_substr($hp->final_query, 0, 6)) != "select") { error_message_history($msg['caddie_action_invalid_query'], $msg['requete_echouee'], 1); exit; } if (!explain_requete($hp->final_query)) { die("<br /><br />" . $hp->final_query . "<br /><br />" . $msg["proc_param_explain_failed"] . "<br /><br />" . $erreur_explain_rqt); } $result_selection = pmb_mysql_query($hp->final_query, $dbh); if (!$result_selection) { error_message_history($msg['caddie_action_invalid_query'], $msg['requete_echouee'] . pmb_mysql_error(), 1); exit; } if (pmb_mysql_num_rows($result_selection)) { while ($obj_selection = pmb_mysql_fetch_object($result_selection)) { $myCart->pointe_item($obj_selection->object_id, $obj_selection->object_type); }
$form_empr_login = pmb_alphabetic('^a-z0-9\\.\\_\\-\\@', '', $form_empr_login); if ($form_empr_login != "") { $form_empr_login = pmb_strtolower($form_empr_login); if (strlen($form_empr_login) < 2) { $error_message .= "<p>{$form_empr_login} : {$msg['empr_form_login']}</p>"; $nberrors++; } $requete = "SELECT id_empr, empr_login FROM empr WHERE empr_login='******' and id_empr!='{$id}' "; $res = pmb_mysql_query($requete, $dbh); $nbr_lignes = pmb_mysql_num_rows($res); if ($nbr_lignes) { $error_message .= "<p>{$form_empr_login} : {$msg['empr_form_login_existant']}</p>"; $nberrors++; } } else { $form_empr_login = pmb_substr($form_prenom, 0, 1) . $form_nom; $form_empr_login = str_replace(CHR(32), "", $form_empr_login); $form_empr_login = pmb_strtolower($form_empr_login); $form_empr_login = clean_string($form_empr_login); $form_empr_login = convert_diacrit(pmb_strtolower($form_empr_login)); $form_empr_login = pmb_alphabetic('^a-z0-9\\.\\_\\-\\@', '', $form_empr_login); $form_empr_login_original = $form_empr_login; $pb = 1; $num_login = 1; while ($pb == 1) { $requete = "SELECT empr_login FROM empr WHERE empr_login='******' LIMIT 1 "; $res = pmb_mysql_query($requete, $dbh); $nbr_lignes = pmb_mysql_num_rows($res); if ($nbr_lignes) { $form_empr_login = $form_empr_login_original . $num_login; $num_login++;
if (!$nb_per_page) { $nb_per_page = $nb_per_page_select; } //parcours du tableau de mots, découpage en colonne et détermination des valeurs par rapport à la pagination et la lettre foreach ($words_for_syn as $key => $valeur_syn) { if ($valeur_syn != "") { if ($letter != 'My') { if (preg_match("/^{$letter}/i", convert_diacrit(pmb_strtolower($valeur_syn)))) { if ($compt >= ($page - 1) * $nb_per_page && $compt < $page * $nb_per_page) { $affichage_mots .= "<a href='#' onClick=\"set_parent('" . $key . "','" . htmlentities(addslashes($valeur_syn), ENT_QUOTES, $charset) . "')\">"; $affichage_mots .= htmlentities($valeur_syn, ENT_QUOTES, $charset) . "</a><br />\n"; } $compt++; } } else { if (pmb_substr($valeur_syn, 0, 1) == '0' || !array_search(convert_diacrit(pmb_strtolower(pmb_substr($valeur_syn, 0, 1))), $alphabet)) { if ($compt >= ($page - 1) * $nb_per_page && $compt < $page * $nb_per_page) { $affichage_mots .= "<a href='#' onClick=\"set_parent('" . $key . "','" . htmlentities(addslashes($valeur_syn), ENT_QUOTES, $charset) . "')\">"; $affichage_mots .= htmlentities($valeur_syn, ENT_QUOTES, $charset) . "</a><br />\n"; } } $compt++; } } } $affichage_mots .= "</div>"; $affichage_mots .= "<div class='row'> </div><hr />\n"; //affichage de la pagination $affichage_mots .= aff_pagination($baseurl . "&user_input={$user_input}&letter=" . $letter, $compt, $nb_per_page, $page); $affichage_mots .= "<div class='row'> </div>\n"; }
// autre procédure $final_query = preg_replace("/CADDIE\\(.*[^\\)]\\)/i", implode(",", $liste_flag), $hp->final_query); $result_selection_flag = @pmb_mysql_query($final_query, $dbh); if ($result_selection_flag) { $nb_elements_flag = pmb_mysql_affected_rows($dbh); } else { $error_message_flag = pmb_mysql_error(); } } // fin if autre procédure } } if ($elt_no_flag) { $liste_no_flag = $myCart->get_cart("NOFLAG"); if (count($liste_no_flag)) { if (pmb_strtolower(pmb_substr($hp->final_query, 0, 6)) == 'insert') { // procédure insert for ($icount = 0; $icount < count($liste_no_flag); $icount++) { $final_query = str_replace("CADDIE(NOTI)", $liste_no_flag[$icount], $hp->final_query); $final_query = str_replace("CADDIE(EXPL)", $liste_no_flag[$icount], $final_query); $final_query = str_replace("CADDIE(BULL)", $liste_no_flag[$icount], $final_query); $result_selection_no_flag = @pmb_mysql_query($final_query, $dbh); $nb_elts_traites = pmb_mysql_affected_rows($dbh); if ($nb_elts_traites > 0) { $nb_elements_no_flag += $nb_elts_traites; } } // fin for } else { // autre procédure $final_query = preg_replace("/CADDIE\\(.*[^\\)]\\)/i", implode(",", $liste_no_flag), $hp->final_query);
// récupération des codes de fonction if (!count($s_func)) { $s_func = new marc_list('function'); } print $sel_header; print $jscript; $afunc = $s_func->table; $special = false; $favorite = false; $alphabet = array(); asort($afunc); foreach ($afunc as $key => $val) { if ($key >= 900) { $special = true; } else { $alphabet[] = pmb_substr($val, 0, 1); } if ($s_func->tablefav[$key]) { $favorite = true; } } $alphabet = array_unique($alphabet); if (!$letter) { if ($favorite) { $letter = "Fav"; } elseif ($special) { $letter = "My"; } else { $letter = "a"; } }
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); }