コード例 #1
0
 function get_list()
 {
     global $msg, $charset, $dbh;
     global $user_query, $user_input, $page, $nbr_lignes, $last_param;
     global $url_base;
     global $authority_statut;
     if (!$user_input) {
         $user_input = '*';
     }
     $nb_per_page = 10;
     if (!$page) {
         $page = 1;
     }
     $debut = ($page - 1) * $nb_per_page;
     if (!($nb_per_page * 1)) {
         $nb_per_page = $nb_per_page_search;
     }
     $authperso_searcher = new searcher_authorities_authpersos(stripslashes($user_input));
     $nbr_lignes = $authperso_searcher->get_nb_results();
     $user_query = str_replace('!!user_query_title!!', $msg["authperso_search_title"], $user_query);
     $user_query = str_replace('!!action!!', "./autorites.php?categ=authperso&sub=reach&id_authperso=" . $this->id . "&id=", $user_query);
     $user_query = str_replace('!!add_auth_msg!!', $msg["authperso_search_add"], $user_query);
     $user_query = str_replace('!!add_auth_act!!', './autorites.php?categ=authperso&sub=authperso_form&id_authperso=' . $this->id, $user_query);
     $user_query = str_replace('<!-- lien_derniers -->', "<a href='./autorites.php?categ=authperso&sub=authperso_last&last_param=authperso_last&id_authperso=" . $this->id . "'>" . $msg["authperso_search_last"] . "</a>", $user_query);
     $user_query = str_replace("!!user_input!!", htmlentities(stripslashes($user_input), ENT_QUOTES, $charset), $user_query);
     $user_query = str_replace('!!user_input_url!!', rawurlencode(stripslashes($user_input)), $user_query);
     $user_query = str_replace("<!-- sel_authority_statuts -->", authorities_statuts::get_form_for($this->id + 1000, $authority_statut, true), $user_query);
     if ($nbr_lignes) {
         $sorted_authperso = $authperso_searcher->get_sorted_result('default', $debut, $nb_per_page);
         if (!$page) {
             $page = 1;
         }
         $parity = 1;
         foreach ($sorted_authperso as $id_authperso) {
             if ($parity % 2) {
                 $pair_impair = "even";
             } else {
                 $pair_impair = "odd";
             }
             $parity += 1;
             $authority = new authority($id_authperso);
             $authority_instance = $authority->get_object_instance();
             $id = $authority->get_num_object();
             $this->fetch_data_auth($id);
             $auth_line = "<td style='text-align:center; width:25px;'>\n\t        \t\t\t\t\t<a title='" . $msg['authority_list_see_label'] . "' href='./autorites.php?categ=see&sub=authperso&id=" . $id . "'>\n\t        \t\t\t\t\t\t<i class='fa fa-eye'></i>\n\t        \t\t\t\t\t</a>\n\t        \t\t    \t  </td>";
             //$this->info['fields'][$i]['data'][$id][$field['name']]
             foreach ($this->info['fields'] as $field) {
                 $data_label = $field['data'][$id]['values'][0]['format_value'];
                 $auth_line .= "<td onmousedown=\"document.location='./autorites.php?categ=authperso&sub=authperso_form&id_authperso=" . $this->id . "&amp;id={$id}&amp;user_input=!!user_input_url!!&amp;nbr_lignes={$nbr_lignes}&amp;page={$page}';\" title='' valign='top'>";
                 //$auth_line.= "<td onmousedown=\"document.location='./autorites.php?categ=see&sub=authperso&id=$id';\" title='' valign='top'>";
                 $auth_line .= $data_label . "</td>";
                 $auth_line = str_replace('!!user_input_url!!', rawurlencode(stripslashes($user_input)), $auth_line);
             }
             // usage
             $auth_line .= "\n\t\t\t\t\t<td onmousedown=\"document.location='./catalog.php?categ=search&mode=" . ($this->id + 1000) . "&etat=aut_search&aut_type=authperso&authperso_id=" . $this->id . "&aut_id={$id}';\" title='' valign='top'>" . $this->get_count_notice($id) . "</td>";
             $auth_lines .= "\r\n\t\t\t\t<tr class='{$parity}' onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='even'\" style=\"cursor: pointer\">\r\n\t\t\t\t\t{$auth_line}\r\n\t\t\t\t</tr>\r\n\t\t\t\t";
         }
         if ($error) {
             $user_query . error_message($msg["searcher_syntax_error"], sprintf($msg["searcher_syntax_error_desc"], $aq->current_car, $aq->input_html, $aq->error_message));
             exit;
         }
         $authperso_list_tpl = $user_query . "\n\t\t\t<br />\n\t\t\t<br />\n\t\t\t<div class='row'>\n\t\t\t\t<h3><! --!!nb_autorite_found!!-- >" . $msg["authperso_search_found"] . " !!cle!! </h3>\n\t\t\t\t</div>\n\t\t\t\t<script type='text/javascript' src='./javascript/sorttable.js'></script>\n\t\t\t\t<table class='sortable'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th></th>\n\t\t\t\t\t!!th_fields!!\n\t\t\t\t\t</tr>\n\t\t\t\t\t!!list!!\n\t\t\t\t</table>\n\t\t\t<div class='row'>\n\t\t\t\t!!nav_bar!!\n\t\t\t</div>\n\t\t\t";
         foreach ($this->info['fields'] as $field) {
             $th_fields .= "<th>" . htmlentities($field['label'], ENT_QUOTES, $charset) . "</th>";
         }
         $th_fields .= "<th>" . htmlentities($msg['authperso_usage'], ENT_QUOTES, $charset) . "</th>";
         $nav_bar = aff_pagination($url_base, $nbr_lignes, $nb_per_page, $page, 10, false, true);
         $authperso_list_tpl = str_replace("<! --!!nb_autorite_found!!-- >", $nbr_lignes . ' ', $authperso_list_tpl);
         $authperso_list_tpl = str_replace("!!th_fields!!", $th_fields, $authperso_list_tpl);
         $authperso_list_tpl = str_replace("!!cle!!", $user_input, $authperso_list_tpl);
         $authperso_list_tpl = str_replace("!!list!!", $auth_lines, $authperso_list_tpl);
         $authperso_list_tpl = str_replace("!!nav_bar!!", $nav_bar, $authperso_list_tpl);
     } else {
         $authperso_list_tpl = $user_query;
         $error_message = str_replace('!!user_input!!', stripslashes($user_input), $msg['authority_authperso_no_authority_found_with_key']);
         $error_message = str_replace('!!authperso_name!!', $this->info['name'], $error_message);
         $authperso_list_tpl .= return_error_message($msg[211], $error_message);
     }
     return $authperso_list_tpl;
 }
コード例 #2
0
ファイル: receptions.class.php プロジェクト: bouchra012/PMB
 function calcNbLignes($all_query = '')
 {
     global $dbh, $msg;
     //analyse_query
     switch ($this->type_acte) {
         case TYP_ACT_CDE:
             if ($all_query == '') {
                 $q_cde = "create temporary table tmp_cde as ";
                 $q_cde .= "select distinct id_ligne, id_acte, numero, actes.num_fournisseur as num_fournisseur, raison_sociale, type_ligne, date_acte, lignes_actes.nb as nb_cde, ";
                 $q_cde .= "lignes_actes.code as code, libelle, lignes_actes.statut, lignes_actes.commentaires_gestion, lignes_actes.commentaires_opac, lignes_actes.num_produit as num_produit, num_acquisition ";
                 $q_cde .= "from lignes_actes join actes on num_acte=id_acte join entites on actes.num_fournisseur=id_entite ";
                 $q_cde .= "left join suggestions on num_acquisition=id_suggestion left join suggestions_origine on num_suggestion=id_suggestion ";
                 $q_cde .= "where ";
                 $q_cde .= $this->filtre_actes . $this->filtre_lignes . $this->filtre_origines;
                 mysql_query($q_cde, $dbh);
                 //echo $q_cde.'<br />';
                 $q_liv = "create temporary table tmp_liv as ";
                 $q_liv .= "select lig_ref, sum(nb) as nb_liv from lignes_actes ";
                 $q_liv .= "join actes on num_acte=id_acte and type_acte='" . TYP_ACT_LIV . "' ";
                 $q_liv .= "where lig_ref in (select id_ligne from tmp_cde)";
                 $q_liv .= "group by lig_ref ";
                 mysql_query($q_liv, $dbh);
                 //echo $q_liv.'<br />';
                 $q_sol = "select distinct id_ligne, id_acte, numero, num_fournisseur, raison_sociale, type_ligne, date_acte, nb_cde ,if(nb_liv is null,0,nb_liv) as nb_liv, if(nb_liv is null,nb_cde,((nb_cde*1)-(nb_liv*1))) as nb_sol, ";
                 $q_sol .= "code, libelle, statut, commentaires_gestion, commentaires_opac, num_produit, num_acquisition ";
                 $q_sol .= "from tmp_cde left join tmp_liv on id_ligne=lig_ref ";
                 $q_sol .= "where ((nb_cde*1)-(nb_liv*1)) > 0 or nb_liv is null ";
                 $q_sol .= "order by raison_sociale, numero ";
                 $r_sol = mysql_query($q_sol, $dbh);
                 //echo $q_sol.'<br />';
                 $r = mysql_num_rows($r_sol);
                 if ($r) {
                     while ($row = mysql_fetch_object($r_sol)) {
                         $i = $row->id_acte;
                         $j = $row->id_ligne;
                         $this->t_list[$i][$j] = array();
                         $this->t_list[$i][$j]['numero'] = $row->numero;
                         $this->t_list[$i][$j]['date_acte'] = $row->date_acte;
                         $this->t_list[$i][$j]['num_fournisseur'] = $row->num_fournisseur;
                         $this->t_list[$i][$j]['raison_sociale'] = $row->raison_sociale;
                         $this->t_list[$i][$j]['type_ligne'] = $row->type_ligne;
                         $this->t_list[$i][$j]['nb_cde'] = $row->nb_cde;
                         $this->t_list[$i][$j]['nb_liv'] = $row->nb_liv;
                         $this->t_list[$i][$j]['nb_sol'] = $row->nb_sol;
                         $this->t_list[$i][$j]['code'] = $row->code;
                         $this->t_list[$i][$j]['libelle'] = $row->libelle;
                         $this->t_list[$i][$j]['statut'] = $row->statut;
                         $this->t_list[$i][$j]['commentaires_gestion'] = $row->commentaires_gestion;
                         $this->t_list[$i][$j]['commentaires_opac'] = $row->commentaires_opac;
                         $this->t_list[$i][$j]['num_produit'] = $row->num_produit;
                         $this->t_list[$i][$j]['num_acquisition'] = $row->num_acquisition;
                     }
                 }
             } else {
                 $aq = new analyse_query(stripslashes($all_query), 0, 0, 0, 0);
                 if ($aq->error) {
                     $this->error = return_error_message($msg["searcher_syntax_error"], sprintf($msg["searcher_syntax_error_desc"], $aq->current_car, $aq->input_html, $aq->error_message));
                 } else {
                     //$members_actes = $aq->get_query_members("actes","numero","index_acte", "id_acte");
                     $members_actes = '0';
                     $members_lignes = $aq->get_query_members("lignes_actes", "code", "index_ligne", "id_ligne");
                     $members_global = $aq->get_query_members("notices_global_index", "infos_global", "index_infos_global", "num_notice");
                     $q_cde = "create temporary table tmp_cde as ( ";
                     $q_cde .= "select distinct id_ligne,id_acte, numero, actes.num_fournisseur as num_fournisseur, raison_sociale, type_ligne, date_acte, lignes_actes.nb as nb_cde,  ";
                     $q_cde .= "lignes_actes.code as code, libelle, lignes_actes.statut, lignes_actes.commentaires_gestion, lignes_actes.commentaires_opac, lignes_actes.num_produit as num_produit, num_acquisition ";
                     $q_cde .= "from lignes_actes join actes on num_acte=id_acte join entites on actes.num_fournisseur=id_entite ";
                     $q_cde .= "left join notices_global_index on num_produit=notices_global_index.num_notice and type_ligne in ('1','5') ";
                     $q_cde .= "left join suggestions on num_acquisition=id_suggestion left join suggestions_origine on num_suggestion=id_suggestion ";
                     $q_cde .= "where ";
                     $q_cde .= $this->filtre_actes . $this->filtre_lignes . $this->filtre_origines;
                     $q_cde .= "and (" . $members_actes['where'] . " ";
                     $q_cde .= "or " . $members_lignes['where'] . " ";
                     $q_cde .= "or " . $members_global['where'] . ") ";
                     $q_cde .= ") union (";
                     $q_cde .= "select distinct id_ligne,id_acte, numero, actes.num_fournisseur as num_fournisseur, raison_sociale, type_ligne, date_acte, lignes_actes.nb as nb_cde, ";
                     $q_cde .= "lignes_actes.code as code, libelle, lignes_actes.statut, lignes_actes.commentaires_gestion, lignes_actes.commentaires_opac, lignes_actes.num_produit as num_produit, num_acquisition ";
                     $q_cde .= "from lignes_actes join actes on num_acte=id_acte join entites on actes.num_fournisseur=id_entite ";
                     $q_cde .= "left join bulletins on num_produit=bulletins.num_notice and type_ligne='2' ";
                     $q_cde .= "left join notices_global_index on bulletins.num_notice=notices_global_index.num_notice ";
                     $q_cde .= "left join suggestions on num_acquisition=id_suggestion left join suggestions_origine on num_suggestion=id_suggestion ";
                     $q_cde .= "where ";
                     $q_cde .= $this->filtre_actes . $this->filtre_lignes . $this->filtre_origines;
                     $q_cde .= "and (" . $members_actes['where'] . " ";
                     $q_cde .= "or " . $members_lignes['where'] . " ";
                     $q_cde .= "or " . $members_global['where'] . ") ";
                     $q_cde .= ")  ";
                     mysql_query($q_cde, $dbh);
                     //echo $q_cde.'<br />';
                     $q_liv = "create temporary table tmp_liv as ";
                     $q_liv .= "select lig_ref,sum(nb) as nb_liv from lignes_actes ";
                     $q_liv .= "join actes on lignes_actes.num_acte=actes.id_acte and actes.type_acte='" . TYP_ACT_LIV . "' ";
                     $q_liv .= "where lig_ref in (select id_ligne from tmp_cde) ";
                     $q_liv .= "group by lig_ref ";
                     mysql_query($q_liv, $dbh);
                     //echo $q_liv.'<br />';
                     $q_sol = "select distinct id_ligne, id_acte, numero, num_fournisseur, raison_sociale, type_ligne, date_acte, nb_cde, if(nb_liv is null,0,nb_liv) as nb_liv, if(nb_liv is null,nb_cde, ((nb_cde*1)-(nb_liv*1))) as nb_sol, ";
                     $q_sol .= "code, libelle, statut, commentaires_gestion, commentaires_opac, num_produit, num_acquisition ";
                     $q_sol .= "from tmp_cde left join tmp_liv on id_ligne=lig_ref ";
                     $q_sol .= "where ((nb_cde*1)-(nb_liv*1)) > 0 or nb_liv is null ";
                     $q_sol .= "order by raison_sociale, numero ";
                     $r_sol = mysql_query($q_sol, $dbh);
                     //echo $q_sol.'<br />';
                     $r = mysql_num_rows($r_sol);
                     if ($r) {
                         while ($row = mysql_fetch_object($r_sol)) {
                             $i = $row->id_acte;
                             $j = $row->id_ligne;
                             $this->t_list[$i][$j] = array();
                             $this->t_list[$i][$j]['numero'] = $row->numero;
                             $this->t_list[$i][$j]['date_acte'] = $row->date_acte;
                             $this->t_list[$i][$j]['num_fournisseur'] = $row->num_fournisseur;
                             $this->t_list[$i][$j]['raison_sociale'] = $row->raison_sociale;
                             $this->t_list[$i][$j]['type_ligne'] = $row->type_ligne;
                             $this->t_list[$i][$j]['nb_cde'] = $row->nb_cde;
                             $this->t_list[$i][$j]['nb_liv'] = $row->nb_liv;
                             $this->t_list[$i][$j]['nb_sol'] = $row->nb_sol;
                             $this->t_list[$i][$j]['code'] = $row->code;
                             $this->t_list[$i][$j]['libelle'] = $row->libelle;
                             $this->t_list[$i][$j]['statut'] = $row->statut;
                             $this->t_list[$i][$j]['commentaires_gestion'] = $row->commentaires_gestion;
                             $this->t_list[$i][$j]['commentaires_opac'] = $row->commentaires_opac;
                         }
                         $this->t_list[$i][$j]['num_produit'] = $row->num_produit;
                         $this->t_list[$i][$j]['num_acquisition'] = $row->num_acquisition;
                     }
                 }
             }
             break;
         case TYP_ACT_DEV:
             if ($all_query == '') {
                 /*			
                 	$this->q_count = "select count(distinct id_ligne) from lignes_actes ";
                 	$this->q_count.= "join actes on lignes_actes.num_acte=actes.id_acte ";
                 	if ($this->filtre_origines) $this->q_count.="join suggestions on lignes_actes.num_acquisition=suggestions.id_suggestion join suggestions_origine on num_suggestion=id_suggestion ";
                 	$this->q_count.= "where ";
                 	$this->q_count.= $this->filtre_actes.$this->filtre_lignes.$this->filtre_origines;
                 	
                 	$this->q_list = "select lignes_actes.*, actes.numero, nom_acte from lignes_actes ";
                 	$this->q_list.= "join actes on lignes_actes.num_acte=actes.id_acte ";
                 	if ($this->filtre_origines) $this->q_list.="join suggestions on lignes_actes.num_acquisition=suggestions.id_suggestion join suggestions_origine on num_suggestion=id_suggestion ";
                 	$this->q_list.= "where ";
                 	$this->q_list.= $this->filtre_actes.$this->filtre_lignes.$this->filtre_origines;
                 	$this->q_list.= "group by id_ligne order by date_acte";	
                 */
             } else {
             }
             break;
     }
     if ($this->error) {
         return 0;
     } else {
         return $r;
     }
 }
コード例 #3
0
ファイル: ontology.class.php プロジェクト: bouchra012/PMB
 /** 
  * @abstract 
  * Retourne une liste d'objets sous forme de tableau selon le type demandé
  * et la recherche effectuée
  * 
  * @param	array 	$params
  * array	$params['objects']			: tableau de types d'objet
  * string	$params['user_input']		: chaine recherchée	
  * 
  * @return array
  * [index]	=>	[subject_uri]			=> uri de l'objet
  * 				
  * 
  */
 public function search_objects($params = array())
 {
     global $msg;
     $this->params = $params;
     $result = array();
     if (!$params['objects'] || !is_array($params['objects']) || !count($params['objects'])) {
         return $result;
     } else {
         //On ne garde dans le tableau que les objects possibles
         $object_final = array();
         foreach ($params['objects'] as $value) {
             if (array_key_exists($value, $this->op->t_objects)) {
                 $object_final[] = $value;
             }
         }
         $params['objects'] = $object_final;
     }
     if (!$params['user_input']) {
         return $msg["ontology_selector_do_search"];
     }
     //On prepare la requete
     $aq = new analyse_query(stripslashes($params['user_input']));
     if ($aq->error) {
         return return_error_message($msg["searcher_syntax_error"], sprintf($msg["searcher_syntax_error_desc"], $aq->current_car, $aq->input_html, $aq->error_message));
     }
     $members = $aq->get_query_members("rdfstore_index", "object_val", "object_index", "subject_uri");
     // On restreint la recheche aux objets demandés et aux labels définit pour les recherches dans skos_pmb.rdf
     $restrict = array();
     foreach ($params['objects'] as $key => $value) {
         $restrict[$key] = "( subject_type='" . addslashes($this->op->from_ns($value)) . "' ";
         $search_label = array();
         $search_label = $this->op->get_pmb_search_label($value);
         if ($search_label && is_array($search_label) && count($search_label)) {
             $restrict[$key] .= " AND (";
             $tmp = "";
             foreach ($search_label as $value2) {
                 if ($tmp) {
                     $tmp .= " OR ";
                 }
                 $tmp .= "predicat_uri='" . addslashes($this->op->from_ns($value2)) . "'";
             }
             $restrict[$key] .= $tmp . ")";
         }
         $restrict[$key] .= ")";
     }
     $restrict_f = "";
     if (count($restrict)) {
         $restrict_f = "(" . implode(" OR ", $restrict) . ")";
     }
     $requete = "select *," . $members["select"] . " as pert from rdfstore_index where " . $members["where"] . ($restrict_f ? " AND " . $restrict_f : "") . " " . $members["post"];
     $res = mysql_query($requete);
     if ($res && mysql_num_rows($res)) {
         while ($ligne = mysql_fetch_object($res)) {
             $result[] = array("subject_uri" => $ligne->subject_uri, "subject_type" => $this->op->to_ns($ligne->subject_type));
         }
     } else {
         return $msg["ontology_selector_not_result"];
     }
     return $result;
 }
コード例 #4
0
ファイル: pret.inc.php プロジェクト: hogsim/PMB
                        $serialcirc_empr = new serialcirc_empr($id);
                        $msgs = $serialcirc_empr->unsbuscribe($serialcirc);
                        if (count($msgs['errors'])) {
                            $affichage .= return_error_message($msg['540'], implode("<br />", $msgs['errors']));
                            $affichage .= " <div class='row'>&nbsp;</div>";
                        }
                    } else {
                        if ($serialcirc_action == "tr") {
                            $serialcirc_empr = new serialcirc_empr($id);
                            $msgs = $serialcirc_empr->forward($serialcirc, $serialcirc_new_empr);
                            if (count($msgs['messages'])) {
                                $affichage .= "\n\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td><img src='./images/idea.gif' align='left'></td>\n\t\t\t\t\t\t\t\t<td><p><strong>" . implode("<br>", $msgs['messages']) . "</strong></p></td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>";
                                $affichage .= " <div class='row'>&nbsp;</div>";
                            }
                            if (count($msgs['errors'])) {
                                $affichage .= return_error_message($msg['540'], implode("<br>", $msgs['errors']));
                                $affichage .= " <div class='row'>&nbsp;</div>";
                            }
                        }
                    }
                    $empr = new emprunteur($id, $erreur_affichage, FALSE, 1);
                    $affichage .= $empr->fiche;
                }
            } else {
                include './circ/empr/empr_list.inc.php';
            }
        }
        /* fin if else ajouté par ER pour fonction annulation */
    }
}
//Comme dans $affichage on met la fiche de l'emprunteur ($affichage = $empr -> fiche) à aucun moment !!voir_sugg!! ne peut être encore présent
コード例 #5
0
ファイル: init.inc.php プロジェクト: noble82/proyectos-ULS
             print "<div id='login-box'>" . return_error_message($msg[11], $msg[checkuser_session_depassee], 1, './index.php', basename($_SERVER['REQUEST_URI'])) . "</div>";
             break;
         case CHECK_USER_SESSION_INVALIDE:
             print "<div id='login-box'>" . return_error_message($msg[11], $msg[checkuser_session_invalide], 1, './index.php', basename($_SERVER['REQUEST_URI'])) . "</div>";
             break;
         case CHECK_USER_AUCUN_DROIT:
             print "<div id='login-box'>" . return_error_message($msg[11], $msg[checkuser_aucun_droit], 1) . "</div>";
             break;
         case CHECK_USER_PB_ENREG_SESSION:
             print "<div id='login-box'>" . return_error_message($msg[11], $msg[checkuser_pb_enreg_session], 1, './index.php') . "</div>";
             break;
         case CHECK_USER_PB_OUVERTURE_SESSION:
             print "<div id='login-box'>" . return_error_message($msg[11], $msg[checkuser_pb_ouverture_session], 1, './index.php') . "</div>";
             break;
         default:
             print "<div id='login-box'>" . return_error_message($msg[11], $msg[12], 1) . "</div>";
             break;
     }
     print $footer;
     exit;
 }
 if (SESSlang) {
     $lang = SESSlang;
     $helpdir = $lang;
 }
 if (!$pmb_indexation_lang) {
     $pmb_indexation_lang = $lang;
 }
 // localisation (fichier XML)
 $messages = new XMLlist("{$include_path}/messages/{$lang}.xml", 0);
 $messages->analyser();