当前位置: 首页>>代码示例>>PHP>>正文


PHP convert_diacrit函数代码示例

本文整理汇总了PHP中convert_diacrit函数的典型用法代码示例。如果您正苦于以下问题:PHP convert_diacrit函数的具体用法?PHP convert_diacrit怎么用?PHP convert_diacrit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了convert_diacrit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cre_login

function cre_login($nom, $prenom, $dbh)
{
    $empr_login = substr($prenom, 0, 1) . $nom;
    $empr_login = strtolower($empr_login);
    $empr_login = clean_string($empr_login);
    $empr_login = convert_diacrit(strtolower($empr_login));
    $empr_login = preg_replace('/[^a-z0-9\\.]/', '', $empr_login);
    $pb = 1;
    $num_login = 1;
    while ($pb == 1) {
        $requete = "SELECT empr_login FROM empr WHERE empr_login='{$empr_login}' AND empr_nom <> '{$nom}' AND empr_prenom <> '{$prenom}' LIMIT 1 ";
        $res = mysql_query($requete, $dbh);
        $nbr_lignes = mysql_num_rows($res);
        if ($nbr_lignes) {
            $empr_login .= $num_login;
            $num_login++;
        } else {
            $pb = 0;
        }
    }
    return $empr_login;
}
开发者ID:bouchra012,项目名称:PMB,代码行数:22,代码来源:import_lecteurs_localises_ouche.inc.php

示例2: get_categories

 /**
  * Retourne les catégories de la notice
  * @return categorie Tableau des catégories
  */
 public function get_categories()
 {
     if (!isset($this->categories)) {
         global $dbh, $opac_categories_affichage_ordre, $opac_categories_show_only_last;
         $this->categories = array();
         // Tableau qui va nous servir à trier alphabétiquement les catégories
         if (!$opac_categories_affichage_ordre) {
             $sort_array = array();
         }
         $query = "select distinct num_noeud from notices_categories where notcateg_notice = " . $this->id . " order by ordre_vedette, ordre_categorie";
         $result = pmb_mysql_query($query, $dbh);
         if ($result && pmb_mysql_num_rows($result)) {
             while ($row = pmb_mysql_fetch_object($result)) {
                 /* @var $object categorie */
                 $object = authorities_collection::get_authority('category', $row->num_noeud);
                 $format_label = $object->libelle;
                 // On ajoute les parents si nécessaire
                 if (!$opac_categories_show_only_last) {
                     $parent_id = $object->parent;
                     while ($parent_id && $parent_id != 1 && !in_array($parent_id, array($object->thes->num_noeud_racine, $object->thes->num_noeud_nonclasses, $object->thes->num_noeud_orphelins))) {
                         $parent = authorities_collection::get_authority('category', $parent_id);
                         $format_label = $parent->libelle . ':' . $format_label;
                         $parent_id = $parent->parent;
                     }
                 }
                 $categorie = array('object' => $object, 'format_label' => $format_label);
                 if (!$opac_categories_affichage_ordre) {
                     $sort_array[$object->thes->id_thesaurus][] = strtoupper(convert_diacrit($format_label));
                 }
                 $this->categories[$object->thes->id_thesaurus][] = $categorie;
             }
             // On tri par ordre alphabétique
             if (!$opac_categories_affichage_ordre) {
                 foreach ($this->categories as $thes_id => &$categories) {
                     array_multisort($sort_array[$thes_id], $categories);
                 }
             }
             // On tri par index de thésaurus
             ksort($this->categories);
         }
     }
     return $this->categories;
 }
开发者ID:hogsim,项目名称:PMB,代码行数:47,代码来源:record_datas.class.php

示例3: is_same_lib

 function is_same_lib($categ_libelle, $categ_id)
 {
     $r = new category($categ_id);
     if (pmb_strtolower(convert_diacrit($r->libelle)) == pmb_strtolower(convert_diacrit($categ_libelle))) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:9,代码来源:term_show.class.php

示例4: asort

             }
         }
     }
     print "</div><hr />";
     if ($options[METHOD_SORT_VALUE][0][value] == "2" && $options[METHOD_SORT_ASC][0][value] == "1") {
         asort($marclist_type->table);
     } elseif ($options[METHOD_SORT_VALUE][0][value] == "1" && $options[METHOD_SORT_ASC][0][value] == "1") {
         ksort($marclist_type->table);
     } elseif ($options[METHOD_SORT_VALUE][0][value] == "2" && $options[METHOD_SORT_ASC][0][value] == "2") {
         arsort($marclist_type->table);
     } elseif ($options[METHOD_SORT_VALUE][0][value] == "2" && $options[METHOD_SORT_ASC][0][value] == "2") {
         krsort($marclist_type->table);
     }
     reset($marclist_type->table);
     foreach ($marclist_type->table as $code => $libelle) {
         if (preg_match("/^{$letter}/i", convert_diacrit($libelle)) || $letter == 'Fav' && $marclist_type->tablefav[$code]) {
             $marclist_tab[$code] = $libelle;
         }
     }
     $has_searchable = false;
     $has_paginated = false;
     break;
 default:
     if ($options[METHOD_SORT_VALUE][0][value] == "2" && $options[METHOD_SORT_ASC][0][value] == "1") {
         asort($marclist_type->table);
     } elseif ($options[METHOD_SORT_VALUE][0][value] == "1" && $options[METHOD_SORT_ASC][0][value] == "1") {
         ksort($marclist_type->table);
     } elseif ($options[METHOD_SORT_VALUE][0][value] == "2" && $options[METHOD_SORT_ASC][0][value] == "2") {
         arsort($marclist_type->table);
     } elseif ($options[METHOD_SORT_VALUE][0][value] == "2" && $options[METHOD_SORT_ASC][0][value] == "2") {
         krsort($marclist_type->table);
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:31,代码来源:perso.inc.php

示例5: make_proc


//.........这里部分代码省略.........
     // conditions fixes
     for ($i = 0; $i < count($this->fixed_params); $i++) {
         if (substr($this->fixed_params[$i], 0, 1) == "f") {
             for ($j = 0; $j < count($this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"]); $j++) {
                 if ($this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["NAME"] == $this->list_fields[substr($this->fixed_params[$i], 2)]["TABLE"]) {
                     $tleft = "tf_" . $i;
                 } else {
                     if ($this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["NAME"] == "notices") {
                         $tleft = "notices";
                     } else {
                         $tleft = "tf_j_" . $i;
                     }
                 }
                 if ($this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["NAME"] == $this->list_fields[substr($this->fixed_params[$i], 2)]["TABLE"]) {
                     $tright = "tf_" . $i;
                 }
                 if ($this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["NAME"] == "notices") {
                     $tright = "notices";
                 } else {
                     $tright = "tf_j_" . $i;
                 }
                 $jointure[] = $tleft . "." . $this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["ID"][0]["value"] . "=" . $tright . "." . $this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["ID"][0]["value"];
             }
             if ($this->list_fields[substr($this->fixed_params[$i], 2)]["TABLE"] == "notices") {
                 $tf = "notices";
             } else {
                 $tf = "tf_" . $i;
             }
             switch ($this->op_param[$i]) {
                 case "CONTAINS_ALL":
                     $op = " AND ";
                     $argu = explode(" ", $this->val_param[$i]);
                     for ($j = 0; $j < count($argu); $j++) {
                         $argu[$j] = $tf . "." . $this->list_fields[substr($this->fixed_params[$i], 2)]["INDEX"] . $this->operateur[$this->op_param[$i]]["DEB"] . pmb_strtolower(convert_diacrit($argu[$j])) . $this->operateur[$this->op_param[$i]]["FIN"];
                     }
                     $jointure[] = " (" . implode($op, $argu) . ") ";
                     break;
                 case "CONTAINS_AT_LEAST":
                     $op = " OR ";
                     $argu = explode(" ", $this->val_param[$i]);
                     for ($j = 0; $j < count($argu); $j++) {
                         $argu[$j] = $tf . "." . $this->list_fields[substr($this->fixed_params[$i], 2)]["INDEX"] . $this->operateur[$this->op_param[$i]]["DEB"] . pmb_strtolower(convert_diacrit($argu[$j])) . $this->operateur[$this->op_param[$i]]["FIN"];
                     }
                     $jointure[] = " (" . implode($op, $argu) . ") ";
                     break;
                 default:
                     $jointure[] = $tf . "." . $this->list_fields[substr($this->fixed_params[$i], 2)]["INDEX"] . $this->operateur[$this->op_param[$i]]["DEB"] . pmb_strtolower(convert_diacrit($this->val_param[$i])) . $this->operateur[$this->op_param[$i]]["FIN"];
             }
         } else {
             // champs perso
             $jointure[] = "ncvf_" . $i . ".notices_custom_origine = notices.notice_id";
             $jointure[] = "ncvf_" . $i . ".notices_custom_champ = " . substr($this->fixed_params[$i], 2);
             switch ($this->op_param[$i]) {
                 case "CONTAINS_ALL":
                     $op = " AND ";
                     $argu = explode(" ", $this->val_param[$i]);
                     for ($j = 0; $j < count($argu); $j++) {
                         $argu[$j] = "ncvf_" . $i . ".notices_custom_" . $this->pp->t_fields[substr($this->fixed_params[$i], 2)]["DATATYPE"] . $this->operateur[$this->op_param[$i]]["DEB"] . $argu[$j] . $this->operateur[$this->op_param[$i]]["FIN"];
                     }
                     $jointure[] = " (" . implode($op, $argu) . ") ";
                     break;
                 case "CONTAINS_AT_LEAST":
                     $op = " OR ";
                     $argu = explode(" ", $this->val_param[$i]);
                     for ($j = 0; $j < count($argu); $j++) {
                         $argu[$j] = "ncvf_" . $i . ".notices_custom_" . $this->pp->t_fields[substr($this->fixed_params[$i], 2)]["DATATYPE"] . $this->operateur[$this->op_param[$i]]["DEB"] . $argu[$j] . $this->operateur[$this->op_param[$i]]["FIN"];
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:67,代码来源:create_proc.class.php

示例6: bold

 function bold($str, $needle)
 {
     //cherche si un des mots de $needle existe dans $str et le met en gras
     $str_propre = strtolower(convert_diacrit($str));
     $mot = strtolower(convert_diacrit($needle));
     if (!(($pos = strpos($str_propre, $mot)) === false)) {
         $size = strlen("<span class='tagQuery'>") + strlen($needle) + $pos;
         $str = substr_replace($str, "<span class='tagQuery'>", $pos, 0);
         $str = substr_replace($str, "</span>", $size, 0);
     }
     return $str;
 }
开发者ID:bouchra012,项目名称:PMB,代码行数:12,代码来源:tags.class.php

示例7: cleanString

 function cleanString($string)
 {
     $string = str_replace("%", "", $string);
     $string = convert_diacrit($string);
     $string = strip_empty_words($string);
     return $string;
 }
开发者ID:bouchra012,项目名称:PMB,代码行数:7,代码来源:suggest.class.php

示例8: search

 function search($user_query)
 {
     global $charset;
     $matches = array();
     if (!file_exists($this->doc->driver->get_cached_filename($this->doc->id) . ".bbox")) {
         exec("pdftotext -bbox -enc UTF-8 " . $this->doc->driver->get_cached_filename($this->doc->id) . " " . $this->doc->driver->get_cached_filename($this->doc->id) . ".bbox");
     }
     ini_set("zend.ze1_compatibility_mode", "0");
     $dom = new DOMDocument('1.0', 'UTF-8');
     file_put_contents($this->doc->driver->get_cached_filename($this->doc->id) . ".bbox", str_replace(array(chr("0x01"), chr("0x02"), chr("0x1f"), chr("0x1e")), "", file_get_contents($this->doc->driver->get_cached_filename($this->doc->id) . ".bbox")));
     $dom->load($this->doc->driver->get_cached_filename($this->doc->id) . ".bbox");
     // On nettoie la recherche
     $user_query = strip_empty_words(strtolower(convert_diacrit($user_query)));
     $terms = explode(" ", $user_query);
     $pages = $dom->getElementsByTagName("page");
     $height = 0;
     $width = 0;
     //on parcourt les pages
     for ($i = 0; $i < $pages->length; $i++) {
         $current_page = $pages->item($i);
         $height = $current_page->getAttribute("height");
         $width = $current_page->getAttribute("width");
         $h_ratio = $this->getHeight($i + 1) / $height;
         $w_ratio = $this->getWidth($i + 1) / $width;
         $words = $current_page->getElementsByTagName("word");
         //on parcourt les mots du fichier
         for ($j = 0; $j < $words->length; $j++) {
             //on parcourt les termes de la recherche
             $current_word = $words->item($j);
             if ($charset == "iso-8859-1") {
                 $current_word_value = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $current_word->nodeValue);
             } else {
                 $current_word_value = $current_word->nodeValue;
             }
             foreach ($terms as $term) {
                 if (strpos(strtolower(convert_diacrit($current_word_value)), $term) !== false) {
                     //trouvé
                     //texte à afficher en aperçu
                     $text = "...";
                     for ($k = $j - 3; $k <= $j + 3; $k++) {
                         if ($j == $k) {
                             $text .= "<span style='background-color:#CCCCFF;font-size:100%;font-style:normal;color:#000000;'>";
                         }
                         if ($charset == "iso-8859-1") {
                             $text .= htmlentities(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $words->item($k)->nodeValue), ENT_QUOTES, $charset) . " ";
                         } else {
                             $text .= htmlentities($words->item($k)->nodeValue, ENT_QUOTES, $charset);
                         }
                         if ($j == $k) {
                             $text .= "</span>";
                         }
                         $text .= " ";
                     }
                     $text .= "... ";
                     $matches[] = array("text" => $text, 'par' => array(array('page' => $i + 1, 'page_height' => $height, 'b' => $height, 't' => 0, 'page_width' => $width, 'r' => $width, 'l' => 0, 'boxes' => array(array('l' => $current_word->getAttribute("xMin") * $w_ratio, 'r' => $current_word->getAttribute("xMax") * $w_ratio, 'b' => $current_word->getAttribute("yMax") * $h_ratio, 't' => $current_word->getAttribute("yMin") * $h_ratio, 'page' => $i + 1)))));
                 } else {
                     if (strpos($term, strtolower(convert_diacrit($current_word_value))) === 0) {
                         // On regarde si le terme n'est pas découpé dans le document
                         // Le mot correspond au début du terme, on va regarder les mots suivants
                         $offset = 0;
                         $word_index = $j;
                         $word_index_value = $current_word_value;
                         do {
                             $offset += strlen(strtolower(convert_diacrit($word_index_value)));
                             $word_index++;
                             if ($charset == "iso-8859-1") {
                                 $word_index_value = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $words->item($word_index)->nodeValue);
                             } else {
                                 $word_index_value = $words->item($word_index)->nodeValue;
                             }
                         } while (strpos($term, strtolower(convert_diacrit($word_index_value)), $offset) === $offset);
                         if ($offset >= strlen($term)) {
                             // le terme à été trouvé
                             //texte à afficher en aperçu
                             $word_index--;
                             $text = "...";
                             for ($k = $j - 3; $k <= $word_index + 3; $k++) {
                                 if ($j == $k) {
                                     $text .= "<span style='background-color:#CCCCFF;font-size:100%;font-style:normal;color:#000000;'>";
                                 }
                                 if ($charset == "iso-8859-1") {
                                     $text .= htmlentities(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $words->item($k)->nodeValue), ENT_QUOTES, $charset);
                                 } else {
                                     $text .= htmlentities($words->item($k)->nodeValue, ENT_QUOTES, $charset);
                                 }
                                 if ($k == $word_index) {
                                     $text .= "</span>";
                                 }
                                 $text .= " ";
                             }
                             $text .= "... ";
                             $matches[] = array("text" => $text, 'par' => array(array('page' => $i + 1, 'page_height' => $height, 'b' => $height, 't' => 0, 'page_width' => $width, 'r' => $width, 'l' => 0, 'boxes' => array(array('l' => $current_word->getAttribute("xMin") * $w_ratio, 'r' => $words->item($word_index)->getAttribute("xMax") * $w_ratio, 'b' => $words->item($word_index)->getAttribute("yMax") * $h_ratio, 't' => $current_word->getAttribute("yMin") * $h_ratio, 'page' => $i + 1)))));
                         }
                     } else {
                         //perdu
                         continue;
                     }
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:101,代码来源:bookreaderPDF.class.php

示例9: max

                    $VALUE[count($ITEM) - 1] = max(array_map("tonum", $VALUE)) * 1 + 1;
                    $ORDRE[count($ITEM) - 1] = "";
                }
            } else {
                $ITEM[count($ITEM)] = "";
                $VALUE[count($ITEM) - 1] = "";
                $ORDRE[count($ITEM) - 1] = "";
            }
        }
        if ($first == 4) {
            //Tri des options
            if ($ITEM) {
                $ITEM_REVERSE = $ITEM;
                reset($ITEM_REVERSE);
                while (list($key, $val) = each($ITEM_REVERSE)) {
                    $ITEM_REVERSE[$key] = convert_diacrit($ITEM_REVERSE[$key]);
                }
                /*asort($ITEM_REVERSE);*/
                reset($ITEM_REVERSE);
                natcasesort($ITEM_REVERSE);
                reset($ITEM_REVERSE);
                $n_o = 0;
                while (list($key, $val) = each($ITEM_REVERSE)) {
                    $ORDRE[$key] = $n_o;
                    $n_o++;
                }
            }
        }
    }
    ?>
	<form class='form-<?php 
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:31,代码来源:options_list.php

示例10: test_title_query

function test_title_query($query, $operator = TRUE, $force_regexp = FALSE)
{
    // Armelle : a priori utilise uniquement dans édition des périodique. Changer la-bas.
    // fonction d'analyse d'une recherche sur titre
    // la fonction retourne un tableau :
    $query_result = array('type' => 0, 'restr' => '', 'order' => '', 'nbr_rows' => 0);
    // FORCAGE ER 12/05/2004 : le match against avec la troncature* ne fonctionne pas...
    $force_regexp = TRUE;
    // $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['indice'] = façon d'obtenir un indice de pertinence
    // $query_result['nbr_rows'] = nombre de lignes qui matchent
    // 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 = strtolower($query);
    // espaces en début et fin
    $query = preg_replace('/^\\s+|\\s+$/', '', $query);
    // espaces en double
    $query = preg_replace('/\\s+/', ' ', $query);
    // traitement des caractères accentués
    $query = convert_diacrit($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 (preg_match('/\\^|\\$|\\[|\\]|\\.|\\*|\\{|\\}|\\|/', $query)) {
        // regexp pure : pas de modif de la saisie utilisateur
        $query_result['type'] = 3;
        $query_result['restr'] = "index_serie REGEXP '{$query}'";
        $query_result['restr'] .= " OR tit1 REGEXP '{$query}'";
        $query_result['restr'] .= " OR tit2 REGEXP '{$query}'";
        $query_result['restr'] .= " OR tit3 REGEXP '{$query}'";
        $query_result['restr'] .= " OR tit4 REGEXP '{$query}'";
        $query_result['order'] = "index_serie ASC, tnvol ASC, tit1 ASC";
    } else {
        // nettoyage de la chaîne
        $query = 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 = preg_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 (strlen($word) < 4) {
                $stopwords = TRUE;
                break;
            }
        }
        if ($stopwords || $force_regexp) {
            // méthode REGEXP
            $query_result['type'] = 2;
            // constitution du membre restricteur
            // premier mot
            $query_result['restr'] = "(index_sew REGEXP '{$tab[0]} ) '";
            for ($i = 1; $i < sizeof($tab); $i++) {
                $query_result['restr'] .= " {$dopt} (index_sew REGEXP '{$tab[$i]}' )";
            }
            // contitution de la clause de tri
            $query_result['order'] = "index_serie ASC, tnvol ASC, tit1 ASC";
        } else {
            // méthode FULLTEXT
            $query_result['type'] = 1;
            // membre restricteur
            $query_result['restr'] = "MATCH (index_wew) AGAINST ('*{$tab[0]}*')";
            for ($i = 1; $i < sizeof($tab); $i++) {
                $query_result['restr'] .= " {$dopt} MATCH";
                $query_result['restr'] .= " (index_wew)";
                $query_result['restr'] .= " AGAINST ('*{$tab[$i]}*')";
            }
            // membre de tri
            $query_result['order'] = "index_serie DESC, tnvol ASC, index_sew ASC";
        }
    }
    // récupération du nombre de lignes
    $rws = "SELECT count(1) FROM notices WHERE {$query_result['restr']}";
    $result = @mysql_query($rws, $dbh);
    $query_result['nbr_rows'] = @mysql_result($result, 0, 0);
    return $query_result;
}
开发者ID:bouchra012,项目名称:PMB,代码行数:97,代码来源:misc.inc.php

示例11: import_lecteurs


//.........这里部分代码省略.........
                        //civilité
                        $t_xml[$i]['INM:CIVILITE'][0] = substr(strtolower(trim($t_xml[$i]['INM:CIVILITE'][0])), 0, 2);
                        switch ($t_xml[$i]['INM:CIVILITE'][0]) {
                            case 'm.':
                            case 'mr':
                            case 'mo':
                                $e_data['sexe'] = 1;
                                break;
                            case 'ma':
                            case 'me':
                            case 'ml':
                                $e_data['sexe'] = 2;
                                break;
                            default:
                                $e_data['sexe'] = 0;
                                break;
                        }
                        //tel
                        $e_data['tel1'] = trim($t_xml[$i]['INM:TELEPHONE'][0]);
                        //mail
                        $e_data['mail'] = trim($t_xml[$i]['INM:MEL'][0]);
                        //adresse
                        $e_data['adr1'] = trim($t_xml[$i]['INM:ADRESSE'][0]);
                        //cp
                        $e_data['cp'] = trim($t_xml[$i]['INM:CP'][0]);
                        //ville
                        $e_data['ville'] = trim($t_xml[$i]['INM:VILLE'][0]);
                        //pays
                        $e_data['pays'] = trim($t_xml[$i]['INM:PAYS'][0]);
                        //notes
                        $e_data['msg'] = trim($t_xml[$i]['INM:NOTES'][0]);
                        //categorie
                        $t_xml[$i]['INM:DROITEMPRUNTEUR'][0] = strtolower($t_xml[$i]['INM:DROITEMPRUNTEUR'][0]);
                        $t_xml[$i]['INM:DROITEMPRUNTEUR'][0] = convert_diacrit($t_xml[$i]['INM:DROITEMPRUNTEUR'][0]);
                        if (strpos($t_xml[$i]['INM:DROITEMPRUNTEUR'][0], "eleve") !== FALSE) {
                            $e_data['categ'] = 1;
                        } elseif (strpos($t_xml[$i]['INM:DROITEMPRUNTEUR'][0], "professeur") !== FALSE) {
                            $e_data['categ'] = 2;
                        } else {
                            $e_data['categ'] = 3;
                        }
                        //code statistique
                        $e_data['codestat'] = 1;
                        //statut
                        if (strtolower(trim($t_xml[$i]['INM:EXCLUSION-DU-PRET'][0])) == 'yes') {
                            $e_data['statut'] = 2;
                        } else {
                            $e_data['statut'] = 1;
                        }
                        //date creation lecteur
                        $t_xml[$i]['INM:DATE-DE-CREATION'][0] = trim($t_xml[$i]['INM:DATE-DE-CREATION'][0]);
                        $e_data['date_creation'] = substr($t_xml[$i]['INM:DATE-DE-CREATION'][0], 6, 4) . '-' . substr($t_xml[$i]['INM:DATE-DE-CREATION'][0], 3, 2) . '-' . substr($t_xml[$i]['INM:DATE-DE-CREATION'][0], 0, 2);
                        //date adhesion
                        $e_data['date_adhesion'] = today();
                        //date fin adhesion
                        $qda = "select duree_adhesion from empr_categ where id_categ_empr='" . $e_data['categ'] . "' ";
                        $rda = mysql_query($qda, $dbh);
                        if (mysql_num_rows($rda)) {
                            $da = mysql_result($rda, 0, 0);
                        } else {
                            $da = 365;
                        }
                        $qd = "select date_add('" . $e_data['date_adhesion'] . "', INTERVAL " . $da . " DAY) ";
                        $rd = mysql_query($qd, $dbh);
                        if (mysql_num_rows($rd)) {
                            $de = mysql_result($rd, 0, 0);
开发者ID:bouchra012,项目名称:PMB,代码行数:67,代码来源:import_aix.inc.php

示例12: gen_groupby_id

 /**
  *
  * On renvoi un id de groupement en fonction de ses éléments
  *
  * @param String $name
  * @param String $code_champ
  * @param String $code_ss_champ
  */
 public static function gen_groupby_id($name, $code_champ, $code_ss_champ)
 {
     $id = $name . "_" . $code_champ . "_" . $code_ss_champ;
     $id = convert_diacrit($id) . md5($id);
     $id = str_replace("'", "", $id);
     return $id;
 }
开发者ID:hogsim,项目名称:PMB,代码行数:15,代码来源:facette_search_compare.class.php

示例13: search

 public function search($user_query)
 {
     $matches = array();
     //pour chaque page
     $terms = explode(" ", strtolower(convert_diacrit($user_query)));
     $pages = $this->refnum->getElementsByTagName("vueObjet");
     foreach ($pages as $page) {
         //on va chercher la couche OCR
         $img = $page->getElementsByTagName("image")->item(0);
         $image = $img->getAttribute("nomImage");
         $ocr = str_replace("T", "X", $image);
         $num_page = str_replace("T", "", $image);
         if ($this->file_exists($this->get_file_path("X/" . $ocr . ".xml.gz"))) {
             ob_start();
             readgzfile($this->get_file($this->get_file_path("X/" . $ocr . ".xml.gz")));
             $file = ob_get_clean();
             $xml = new domDocument("1.0", "iso-8859-1");
             $xml->loadXML($file);
             //on va avoir besoin de la résolution d'origine pour calculer le ratio...
             $page = $xml->getElementsByTagName("Page")->item(0);
             $original_width = $page->getAttribute('WIDTH');
             $original_height = $page->getAttribute('HEIGHT');
             $height = $this->getHeight($num_page);
             $width = $this->getWidth($num_page);
             $h_ratio = $height / $original_height;
             $w_ratio = $width / $original_width;
             $strings = $xml->getElementsByTagName('String');
             foreach ($strings as $string) {
                 foreach ($terms as $term) {
                     if (strtolower(convert_diacrit(utf8_decode($string->getAttribute("CONTENT")))) == $term) {
                         $matches[] = array("text" => $this->get_paragraphe($string), 'par' => array(array('page' => $num_page * 1, 'page_height' => $height, 'b' => $height, 't' => 0, 'page_width' => $width, 'r' => $width, 'l' => 0, 'boxes' => array(array('l' => $string->getAttribute("HPOS") * $w_ratio, 'r' => ($string->getAttribute("HPOS") + $string->getAttribute("WIDTH")) * $w_ratio, 'b' => ($string->getAttribute("VPOS") + $string->getAttribute("HEIGHT")) * $h_ratio, 't' => $string->getAttribute("VPOS") * $h_ratio, 'page' => $num_page * 1)))));
                     }
                 }
             }
         }
     }
     return array('matches' => $matches);
 }
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:38,代码来源:docbnf.class.php

示例14: array_to_xml

        $options = array_to_xml($param, "OPTIONS");
        if ($first == 2) {
            for ($i = 0; $i < count($ITEMS); $i++) {
                if (count($checked) == 0 || count($checked) > 0 && !in_array($ITEMS[$i]['value'], $checked)) {
                    if ($ITEMS[$i]['value'] && $ITEMS[$i]['label']) {
                        $array = array('value' => $ITEMS[$i]['value'], 'label' => $ITEMS[$i]['label'], 'order' => $ITEMS[$i]['order'] ? $ITEMS[$i]['order'] : 0);
                        $items[] = $array;
                    }
                }
            }
        }
        if ($first == 3) {
            //Tri des options
            $options = array();
            for ($i = 0; $i < count($ITEMS); $i++) {
                $options[$i] = convert_diacrit($ITEMS[$i]['label']);
            }
            asort($options);
            foreach ($options as $i => $option) {
                $array = array('value' => $ITEMS[$i]['value'], 'label' => $ITEMS[$i]['label'], 'order' => $i);
                $items[] = $array;
            }
        }
    }
    //Formulaire
    ?>
 
	
	<form class='form-<?php 
    echo $current_module;
    ?>
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:31,代码来源:options_q_txt_i18n.php

示例15: search

 function search($user_query)
 {
     global $charset;
     $matches = array();
     if (!file_exists($this->doc->driver->get_cached_filename($this->doc->id) . ".bbox")) {
         exec("pdftotext -bbox " . $this->doc->driver->get_cached_filename($this->doc->id) . ".pdf " . $this->doc->driver->get_cached_filename($this->doc->id) . ".bbox");
         //bbox ne gère pas les entités html présentent dans le titre
         $contents = file_get_contents($this->doc->driver->get_cached_filename($this->doc->id) . ".bbox");
         if (preg_match("/\\<title\\>(.*)\\<\\/title\\>/", $contents, $match) && $match[1]) {
             file_put_contents($this->doc->driver->get_cached_filename($this->doc->id) . ".bbox", str_replace($match[1], htmlentities($match[1], ENT_QUOTES, $charset), $contents));
         }
     }
     $dom = new DOMDocument();
     $dom->load($this->doc->driver->get_cached_filename($this->doc->id) . ".bbox");
     // On nettoie la recherche
     $user_query = strip_empty_words(strtolower(convert_diacrit($user_query)));
     $terms = explode(" ", $user_query);
     $pages = $dom->getElementsByTagName("page");
     $height = 0;
     $width = 0;
     //on parcourt les pages
     for ($i = 0; $i < $pages->length; $i++) {
         $current_page = $pages->item($i);
         $height = $current_page->getAttribute("height");
         $width = $current_page->getAttribute("width");
         $h_ratio = $this->getHeight($i + 1) / $height;
         $w_ratio = $this->getWidth($i + 1) / $width;
         $words = $current_page->getElementsByTagName("word");
         //on parcourt les mots du fichier
         for ($j = 0; $j < $words->length; $j++) {
             //on parcourt les termes de la recherche
             $current_word = $words->item($j);
             if ($charset == "iso-8859-1") {
                 $current_word_value = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $current_word->nodeValue);
             } else {
                 $current_word_value = $current_word->nodeValue;
             }
             foreach ($terms as $term) {
                 if (strpos(strtolower(convert_diacrit($current_word_value)), $term) !== false) {
                     //trouvé
                     //texte à afficher en aperçu
                     $text = "...";
                     for ($k = $j - 3; $k <= $j + 3; $k++) {
                         if ($j == $k) {
                             $text .= "<span style='background-color:#CCCCFF;font-size:100%;font-style:normal;color:#000000;'>";
                         }
                         if ($charset == "iso-8859-1") {
                             $text .= htmlentities(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $words->item($k)->nodeValue), ENT_QUOTES, $charset) . " ";
                         } else {
                             $text .= htmlentities($words->item($k)->nodeValue, ENT_QUOTES, $charset);
                         }
                         if ($j == $k) {
                             $text .= "</span>";
                         }
                         $text .= " ";
                     }
                     $text .= "... ";
                     $matches[] = array("text" => $text, 'par' => array(array('page' => $i + 1, 'page_height' => $height, 'b' => $height, 't' => 0, 'page_width' => $width, 'r' => $width, 'l' => 0, 'boxes' => array(array('l' => $current_word->getAttribute("xMin") * $w_ratio, 'r' => $current_word->getAttribute("xMax") * $w_ratio, 'b' => $current_word->getAttribute("yMax") * $h_ratio, 't' => $current_word->getAttribute("yMin") * $h_ratio, 'page' => $i + 1)))));
                     // 					} else if (strpos($term, strtolower(convert_diacrit($current_word_value))) === 0) {
                     // 						// On regarde si le terme n'est pas découpé dans le document
                     // 						// Le mot correspond au début du terme, on va regarder les mots suivants
                     // 						$offset = 0;
                     // 						$word_index = $j;
                     // 						$word_index_value = $current_word_value;
                     // 						do {
                     // 							$offset += strlen(strtolower(convert_diacrit($word_index_value)));
                     // 							$word_index++;
                     // 							if ($charset == "iso-8859-1") $word_index_value = iconv("UTF-8", "ISO-8859-1//TRANSLIT",$words->item($word_index)->nodeValue);
                     // 							else $word_index_value = $words->item($word_index)->nodeValue;
                     // 						} while (strpos($term, strtolower(convert_diacrit($word_index_value)), $offset) === $offset);
                     // 						if ($offset >= strlen($term)) {
                     // 							// le terme à été trouvé
                     // 							//texte à afficher en aperçu
                     // 							$word_index--;
                     // 							$text = "...";
                     // 							for ($k=$j-3 ; $k<=$word_index+3 ; $k++){
                     // 								if ($j == $k) $text .= "<span style='background-color:#CCCCFF;font-size:100%;font-style:normal;color:#000000;'>";
                     // 								if ($charset == "iso-8859-1") {
                     // 									$text .= htmlentities(iconv("UTF-8", "ISO-8859-1//TRANSLIT",$words->item($k)->nodeValue),ENT_QUOTES,$charset);
                     // 								} else {
                     // 									$text .= htmlentities($words->item($k)->nodeValue,ENT_QUOTES,$charset);
                     // 								}
                     // 								if ($k == $word_index) $text .= "</span>";
                     // 								$text .= " ";
                     // 							}
                     // 							$text .= "... ";
                     // 							$matches[] = array(
                     // 								"text"=> $text,
                     // 								'par' => array(
                     // 									array(
                     // 										'page' => ($i+1),
                     // 										'page_height' => $height,
                     // 										'b' => $height,
                     // 										't' => 0,
                     // 										'page_width' => $width,
                     // 										'r' => $width,
                     // 										'l' =>  0,
                     // 										'boxes' => array(
                     // 											array(
                     // 												'l' => $current_word->getAttribute("xMin")*$w_ratio,
//.........这里部分代码省略.........
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:101,代码来源:bookreaderEPUB.class.php


注:本文中的convert_diacrit函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。