Exemplo n.º 1
0
/* $caller = Nom du formulaire appelant
 * $objs = type d'objet demandé
 * $code = id du champ recevant l'identifiant de la sélection dans le formulaire appelant
 * $label = id du champ recevant le libellé de la sélection dans le formulaire appelant
 * $cpt = id du champ recevant le compteur d'objets dans le formulaire appelant
 * $deb_rech = texte à rechercher 
 */
$racine = preg_replace("/_[0-9]+\$/", "", $label);
//voir js sel_ontology.tpl.php
//$base_url = "./select.php?what=ontology&caller=$caller&objs=$objs&code=$code&label=$label&cpt=$cpt&deb_rech=$deb_rech";
$base_url = "./select.php?what=ontology&caller={$caller}&objs={$objs}&code={$code}&label={$label}&cpt={$cpt}&infield={$infield}&callback={$callback}&dyn={$dyn}";
// contenu popup selection
require './selectors/templates/sel_ontology.tpl.php';
require_once "{$class_path}/rdf/ontology.class.php";
$op = new ontology_parser("{$class_path}/rdf/skos_pmb.rdf");
$sh = new skos_handler($op);
// affichage du header
$t_objs = explode(',', $objs);
$ontology_search_field = "";
foreach ($t_objs as $value) {
    if ($tmp2 = $sh->format($value)) {
        if ($ontology_search_field) {
            $ontology_search_field .= ", ";
        }
        $ontology_search_field .= $msg["ontology_" . $tmp2];
    }
}
print str_replace("!!ontology_search_field!!", $ontology_search_field, $sel_header);
// traitement en entree des requetes utilisateur
if ($deb_rech) {
    $f_user_input = $deb_rech;
Exemplo n.º 2
0
<?php

// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: concepts.inc.php,v 1.2 2013-08-14 15:47:58 dbellamy Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
require_once "{$class_path}/rdf/ontology.class.php";
require_once "{$include_path}/templates/concepts.tpl.php";
//construction du sous-menu
$aut_concepts_menu = str_replace('!!menu_sous_rub!!', $msg['ontology_skos_' . $sub], $aut_concepts_menu);
$tpl = $aut_concepts_menu;
$op = new ontology_parser("{$class_path}/rdf/skos_pmb.rdf");
$sh = new skos_handler($op);
$page += 0;
if (!$page) {
    $page = 1;
}
$limit = $nb_per_page_gestion;
$object_uri = '';
if ($uri) {
    $object_uri = rawurldecode(stripslashes($uri));
}
switch ($action) {
    case 'edit':
    case 'add':
        switch ($sub) {
            case 'concept':
                $t = array('object' => 'skos:Concept', 'object_uri' => $object_uri, 'url_base' => './autorites.php?categ=concepts&sub=concept&action=');
$q_sel = "\nselect t.t as num_triple, s.val as subject_uri, p.val as predicat_uri, o.id as num_object, o.val as object_val, l.val as object_lang \nfrom rdfstore_triple t, rdfstore_s2val s, rdfstore_id2val p, rdfstore_o2val o, rdfstore_id2val l  \nwhere t.o_type=2 and t.o_lang_dt=l.id and length(l.val)<3 and t.s=s.id and t.p=p.id and t.o=o.id \norder by t.t LIMIT {$start}, {$lot}";
$r_sel = pmb_mysql_query($q_sel, $dbh);
if (pmb_mysql_num_rows($r_sel)) {
    // définition de l'état de la jauge
    $state = floor($start / ($count / $jauge_size));
    $state .= "px";
    // mise à jour de l'affichage de la jauge
    print "<table border='0' align='center' width='{$jauge_size}' cellpadding='0'><tr><td class='jauge' width='100%'>";
    print "<img src='../../images/jauge.png' width='{$state}' height='16px'></td></tr></table>";
    // calcul pourcentage avancement
    $percent = floor($start / $count * 100);
    // affichage du % d'avancement et de l'état
    print "<div align='center'>{$percent}%</div>";
    require_once "{$class_path}/rdf/ontology.class.php";
    $op = new ontology_parser("{$class_path}/rdf/skos_pmb.rdf");
    $sh = new skos_handler($op);
    while ($triple = pmb_mysql_fetch_object($r_sel)) {
        $type = $sh->op->from_ns($sh->get_object_type($triple->subject_uri));
        $q_ins = "insert ignore into rdfstore_index ";
        $q_ins .= "set num_triple='" . $triple->num_triple . "', ";
        $q_ins .= "subject_uri='" . addslashes($triple->subject_uri) . "', ";
        $q_ins .= "subject_type='" . addslashes($type) . "', ";
        $q_ins .= "predicat_uri='" . addslashes($triple->predicat_uri) . "', ";
        $q_ins .= "num_object='" . $triple->num_object . "', ";
        $q_ins .= "object_val ='" . addslashes($triple->object_val) . "', ";
        $q_ins .= "object_index=' " . strip_empty_chars($triple->object_val) . " ', ";
        $q_ins .= "object_lang ='" . addslashes($triple->object_lang) . "' ";
        $r_ins = pmb_mysql_query($q_ins, $dbh);
    }
    $next = $start + $lot;
    print "\n\t\t<form class='form-{$current_module}' name='current_state' action='./clean.php' method='post'>\n\t\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t\t<input type='hidden' name='start' value=\"{$next}\">\n\t\t<input type='hidden' name='count' value=\"{$count}\">\n\t\t</form>\n\t\t<script type=\"text/javascript\"><!-- \n\t\tsetTimeout(\"document.forms['current_state'].submit()\",1000); \n\t\t-->\n\t\t</script>";
Exemplo n.º 4
0
 function cleanRdfStore()
 {
     global $msg, $dbh, $charset, $PMBusername;
     global $class_path;
     if (SESSrights & ADMINISTRATION_AUTH) {
         $result .= "<h3>" . htmlentities($msg["nettoyage_rdfstore_reindexation"], ENT_QUOTES, $charset) . "</h3>";
         //remise a zero de la table au début
         pmb_mysql_query("TRUNCATE rdfstore_index", $dbh);
         $query = "select t.t as num_triple, s.val as subject_uri, p.val as predicat_uri, o.id as num_object, o.val as object_val, l.val as object_lang \n\t\t\t\tfrom rdfstore_triple t, rdfstore_s2val s, rdfstore_id2val p, rdfstore_o2val o, rdfstore_id2val l  \n\t\t\t\twhere t.o_type=2 and t.o_lang_dt=l.id and length(l.val)<3 and t.s=s.id and t.p=p.id and t.o=o.id \n\t\t\t\torder by t.t";
         $rdfStore = pmb_mysql_query($query, $dbh);
         if (pmb_mysql_num_rows($rdfStore)) {
             $op = new ontology_parser("{$class_path}/rdf/skos_pmb.rdf");
             $sh = new skos_handler($op);
             while ($triple = pmb_mysql_fetch_object($rdfStore)) {
                 $type = $sh->op->from_ns($sh->get_object_type($triple->subject_uri));
                 $q_ins = "insert ignore into rdfstore_index ";
                 $q_ins .= "set num_triple='" . $triple->num_triple . "', ";
                 $q_ins .= "subject_uri='" . addslashes($triple->subject_uri) . "', ";
                 $q_ins .= "subject_type='" . addslashes($type) . "', ";
                 $q_ins .= "predicat_uri='" . addslashes($triple->predicat_uri) . "', ";
                 $q_ins .= "num_object='" . $triple->num_object . "', ";
                 $q_ins .= "object_val ='" . addslashes($triple->object_val) . "', ";
                 $q_ins .= "object_index=' " . strip_empty_chars($triple->object_val) . " ', ";
                 $q_ins .= "object_lang ='" . addslashes($triple->object_lang) . "' ";
                 $r_ins = pmb_mysql_query($q_ins, $dbh);
             }
         }
         $rdfStore = pmb_mysql_query("select count(1) from rdfstore_triple where o_type=2", $dbh);
         $count = pmb_mysql_result($rdfStore, 0, 0);
         $result .= $count . " " . htmlentities($msg['nettoyage_rdfstore_reindex_elt'], ENT_QUOTES, $charset);
     } else {
         $result .= sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername);
     }
     return $result;
 }